spaCy/website/docs/api
Daniël de Kok 5e297aa20e
Add TrainablePipe.{distill,get_teacher_student_loss} (#12016)
* Add `TrainablePipe.{distill,get_teacher_student_loss}`

This change adds two methods:

- `TrainablePipe::distill` which performs a training step of a
   student pipe on a teacher pipe, giving a batch of `Doc`s.
- `TrainablePipe::get_teacher_student_loss` computes the loss
  of a student relative to the teacher.

The `distill` or `get_teacher_student_loss` methods are also implemented
in the tagger, edit tree lemmatizer, and parser pipes, to enable
distillation in those pipes and as an example for other pipes.

* Fix stray `Beam` import

* Fix incorrect import

* Apply suggestions from code review

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* TrainablePipe.distill: use `Iterable[Example]`

* Add Pipe.is_distillable method

* Add `validate_distillation_examples`

This first calls `validate_examples` and then checks that the
student/teacher tokens are the same.

* Update distill documentation

* Add distill documentation for all pipes that support distillation

* Fix incorrect identifier

* Apply suggestions from code review

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>

* Add comment to explain `is_distillable`

Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
2023-01-16 10:25:53 +01:00
..
architectures.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
attributeruler.mdx Merge branch 'copy_master' into copy_v4 2023-01-11 18:40:55 +01:00
attributes.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
cli.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
coref.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
corpus.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
cython-classes.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
cython-structs.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
cython.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
data-formats.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
dependencymatcher.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
dependencyparser.mdx Add TrainablePipe.{distill,get_teacher_student_loss} (#12016) 2023-01-16 10:25:53 +01:00
doc.mdx Merge branch 'copy_master' into copy_v4 2023-01-11 18:40:55 +01:00
docbin.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
edittreelemmatizer.mdx Add TrainablePipe.{distill,get_teacher_student_loss} (#12016) 2023-01-16 10:25:53 +01:00
entitylinker.mdx Merge branch 'copy_master' into copy_v4 2023-01-11 18:40:55 +01:00
entityrecognizer.mdx Add TrainablePipe.{distill,get_teacher_student_loss} (#12016) 2023-01-16 10:25:53 +01:00
entityruler.mdx Merge branch 'copy_master' into copy_v4 2023-01-11 18:40:55 +01:00
example.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
index.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
kb_in_memory.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
kb.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
language.mdx Merge branch 'copy_master' into copy_v4 2023-01-11 18:40:55 +01:00
legacy.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
lemmatizer.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
lexeme.mdx Merge branch 'copy_master' into copy_v4 2023-01-11 18:40:55 +01:00
lookups.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
matcher.mdx Merge branch 'copy_master' into copy_v4 2023-01-11 18:40:55 +01:00
morphologizer.mdx Add TrainablePipe.{distill,get_teacher_student_loss} (#12016) 2023-01-16 10:25:53 +01:00
morphology.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
phrasematcher.mdx Merge branch 'copy_master' into copy_v4 2023-01-11 18:40:55 +01:00
pipe.mdx Add TrainablePipe.{distill,get_teacher_student_loss} (#12016) 2023-01-16 10:25:53 +01:00
pipeline-functions.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
scorer.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
sentencerecognizer.mdx Add TrainablePipe.{distill,get_teacher_student_loss} (#12016) 2023-01-16 10:25:53 +01:00
sentencizer.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
span-resolver.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
span.mdx Merge branch 'copy_master' into copy_v4 2023-01-11 18:40:55 +01:00
spancategorizer.mdx Merge branch 'copy_master' into copy_v4 2023-01-11 18:40:55 +01:00
spangroup.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
spanruler.mdx Merge branch 'copy_master' into copy_v4 2023-01-11 18:40:55 +01:00
stringstore.mdx fix anchors (#12095) 2023-01-13 11:14:58 +01:00
tagger.mdx Add TrainablePipe.{distill,get_teacher_student_loss} (#12016) 2023-01-16 10:25:53 +01:00
textcategorizer.mdx Merge branch 'copy_master' into copy_v4 2023-01-11 18:40:55 +01:00
tok2vec.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
token.mdx Merge branch 'copy_master' into copy_v4 2023-01-11 18:40:55 +01:00
tokenizer.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
top-level.mdx Add TrainablePipe.{distill,get_teacher_student_loss} (#12016) 2023-01-16 10:25:53 +01:00
transformer.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
vectors.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00
vocab.mdx Website migration from Gatsby to Next (#12058) 2023-01-11 17:30:07 +01:00