From 014da12f1d4ea238b31629764a2ae2979564ac85 Mon Sep 17 00:00:00 2001 From: Edward <43848523+thomashacker@users.noreply.github.com> Date: Wed, 20 Oct 2021 17:30:19 +0200 Subject: [PATCH] Dont add tok2vec when efficiency textcat (#9502) --- spacy/cli/templates/quickstart_training.jinja | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spacy/cli/templates/quickstart_training.jinja b/spacy/cli/templates/quickstart_training.jinja index bb4061177..50dbc6e42 100644 --- a/spacy/cli/templates/quickstart_training.jinja +++ b/spacy/cli/templates/quickstart_training.jinja @@ -16,7 +16,8 @@ gpu_allocator = null [nlp] 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 %} {%- else -%} {%- set full_pipeline = components %} @@ -198,7 +199,7 @@ no_output_layer = false {# NON-TRANSFORMER PIPELINE #} {% else -%} - +{% if not no_tok2vec-%} [components.tok2vec] factory = "tok2vec" @@ -223,6 +224,7 @@ width = {{ 96 if optimize == "efficiency" else 256 }} depth = {{ 4 if optimize == "efficiency" else 8 }} window_size = 1 maxout_pieces = 3 +{% endif -%} {% if "morphologizer" in components %} [components.morphologizer]