mirror of
https://github.com/explosion/spaCy.git
synced 2025-11-11 13:25:43 +03:00
* 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>
14 lines
880 B
Python
14 lines
880 B
Python
from .corpus import Corpus, JsonlCorpus # noqa: F401
|
|
from .example import Example, validate_examples, validate_get_examples # noqa: F401
|
|
from .example import validate_distillation_examples # noqa: F401
|
|
from .alignment import Alignment # noqa: F401
|
|
from .augment import dont_augment, orth_variants_augmenter # noqa: F401
|
|
from .iob_utils import iob_to_biluo, biluo_to_iob # noqa: F401
|
|
from .iob_utils import offsets_to_biluo_tags, biluo_tags_to_offsets # noqa: F401
|
|
from .iob_utils import biluo_tags_to_spans, tags_to_entities # noqa: F401
|
|
from .iob_utils import split_bilu_label, remove_bilu_prefix # noqa: F401
|
|
from .gold_io import docs_to_json, read_json_file # noqa: F401
|
|
from .batchers import minibatch_by_padded_size, minibatch_by_words # noqa: F401
|
|
from .loggers import console_logger # noqa: F401
|
|
from .callbacks import create_copy_from_base_model # noqa: F401
|