Dont add tok2vec when efficiency textcat (#9502)

This commit is contained in:
Edward 2021-10-20 17:30:19 +02:00 committed by GitHub
parent ddc1bf5b8b
commit 014da12f1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,8 @@ gpu_allocator = null
[nlp] [nlp]
lang = "{{ lang }}" lang = "{{ lang }}"
{%- if "tagger" in components or "morphologizer" in components or "parser" in components or "ner" in components or "entity_linker" in components or (("textcat" in components or "textcat_multilabel" in components) and optimize == "accuracy") -%} {%- set no_tok2vec = components|length == 1 and (("textcat" in components or "textcat_multilabel" in components) and optimize == "efficiency")-%}
{%- if not no_tok2vec and ("tagger" in components or "morphologizer" in components or "parser" in components or "ner" in components or "entity_linker" in components or "textcat" in components or "textcat_multilabel" in components) -%}
{%- set full_pipeline = ["transformer" if use_transformer else "tok2vec"] + components %} {%- set full_pipeline = ["transformer" if use_transformer else "tok2vec"] + components %}
{%- else -%} {%- else -%}
{%- set full_pipeline = components %} {%- set full_pipeline = components %}
@ -198,7 +199,7 @@ no_output_layer = false
{# NON-TRANSFORMER PIPELINE #} {# NON-TRANSFORMER PIPELINE #}
{% else -%} {% else -%}
{% if not no_tok2vec-%}
[components.tok2vec] [components.tok2vec]
factory = "tok2vec" factory = "tok2vec"
@ -223,6 +224,7 @@ width = {{ 96 if optimize == "efficiency" else 256 }}
depth = {{ 4 if optimize == "efficiency" else 8 }} depth = {{ 4 if optimize == "efficiency" else 8 }}
window_size = 1 window_size = 1
maxout_pieces = 3 maxout_pieces = 3
{% endif -%}
{% if "morphologizer" in components %} {% if "morphologizer" in components %}
[components.morphologizer] [components.morphologizer]