set default to 0.0, update quickstart

This commit is contained in:
vinit 2023-02-28 15:40:33 +05:30
parent 344e2d6314
commit 7e270de51f
5 changed files with 8 additions and 8 deletions

View File

@ -69,6 +69,7 @@ grad_factor = 1.0
{% if "tagger" in components %}
[components.tagger]
factory = "tagger"
label_smoothing = 0.05
[components.tagger.model]
@architectures = "spacy.Tagger.v2"

View File

@ -45,7 +45,7 @@ DEFAULT_TAGGER_MODEL = Config().from_str(default_model_config)["model"]
@Language.factory(
"tagger",
assigns=["token.tag"],
default_config={"model": DEFAULT_TAGGER_MODEL, "overwrite": False, "scorer": {"@scorers": "spacy.tagger_scorer.v1"}, "neg_prefix": "!", "label_smoothing": 0.05},
default_config={"model": DEFAULT_TAGGER_MODEL, "overwrite": False, "scorer": {"@scorers": "spacy.tagger_scorer.v1"}, "neg_prefix": "!", "label_smoothing": 0.0},
default_score_weights={"tag_acc": 1.0},
)
def make_tagger(

View File

@ -70,10 +70,10 @@ PARTIAL_DATA = [
def test_label_smoothing():
util.fix_random_seed()
nlp = Language()
tagger_no_ls = nlp.add_pipe(
"tagger", "no_label_smoothing", config=dict(label_smoothing=0.0)
tagger_no_ls = nlp.add_pipe("tagger", "no_label_smoothing")
tagger_ls = nlp.add_pipe(
"tagger", "label_smoothing", config=dict(label_smoothing=0.05)
)
tagger_ls = nlp.add_pipe("tagger", "label_smoothing")
train_examples = []
losses = {}
for tag in TAGS:
@ -160,7 +160,7 @@ def test_no_data():
def test_incomplete_data():
# Test that the tagger works with incomplete information
nlp = English()
nlp.add_pipe("tagger", config=dict(label_smoothing=0.0))
nlp.add_pipe("tagger")
train_examples = []
for t in PARTIAL_DATA:
train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1]))
@ -180,7 +180,7 @@ def test_incomplete_data():
def test_overfitting_IO():
# Simple test to try and quickly overfit the tagger - ensuring the ML models work correctly
nlp = English()
tagger = nlp.add_pipe("tagger", config=dict(label_smoothing=0.0))
tagger = nlp.add_pipe("tagger")
train_examples = []
for t in TRAIN_DATA:
train_examples.append(Example.from_dict(nlp.make_doc(t[0]), t[1]))

View File

@ -115,7 +115,6 @@ cfg_string = """
[components.tagger]
factory = "tagger"
label_smoothing = 0.0
[components.tagger.model]
@architectures = "spacy.Tagger.v2"

View File

@ -46,7 +46,7 @@ architectures and their arguments and hyperparameters.
| `overwrite` <Tag variant="new">3.2</Tag> | Whether existing annotation is overwritten. Defaults to `False`. ~~bool~~ |
| `scorer` <Tag variant="new">3.2</Tag> | The scoring method. Defaults to [`Scorer.score_token_attr`](/api/scorer#score_token_attr) for the attribute `"tag"`. ~~Optional[Callable]~~ |
| `neg_prefix` <Tag variant="new">3.2.1</Tag> | The prefix used to specify incorrect tags while training. The tagger will learn not to predict exactly this tag. Defaults to `!`. ~~str~~ |
| `label_smoothing` <Tag variant="new">3.6</Tag> | Label smoothing factor. Defaults to `0.05`. ~~float~~ |
| `label_smoothing` <Tag variant="new">3.6</Tag> | Label smoothing factor. Defaults to `0.0`. ~~float~~ |
```python
%%GITHUB_SPACY/spacy/pipeline/tagger.pyx