From 842bbeae292f749bbfdfa1cb35335efb11812e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danie=CC=88l=20de=20Kok?= Date: Thu, 11 Apr 2024 15:48:48 +0200 Subject: [PATCH] Type and doc fixes --- spacy/cli/distill.py | 2 +- website/docs/api/cli.mdx | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/spacy/cli/distill.py b/spacy/cli/distill.py index fb3563045..40de23853 100644 --- a/spacy/cli/distill.py +++ b/spacy/cli/distill.py @@ -55,7 +55,7 @@ def distill_cli( def distill( - teacher_model: str, + teacher_model: Union[str, Path], student_config_path: Union[str, Path], output_path: Optional[Union[str, Path]] = None, *, diff --git a/website/docs/api/cli.mdx b/website/docs/api/cli.mdx index 2191fd83c..74d788a8e 100644 --- a/website/docs/api/cli.mdx +++ b/website/docs/api/cli.mdx @@ -1707,17 +1707,18 @@ $ python -m spacy project dvc [project_dir] [workflow] [--force] [--verbose] [-- Distill a _student_ pipeline from a _teacher_ pipeline. Distillation trains the models in the student pipeline on the activations of the teacher's models. A typical use case for distillation is to extract a smaller, more performant model -from a larger high-accuracy model. Since distillation uses the activations of the -teacher, distillation can be performed on a corpus of raw text without (gold standard) -annotations. +from a larger high-accuracy model. Since distillation uses the activations of +the teacher, distillation can be performed on a corpus of raw text without (gold +standard) annotations. A development set of gold annotations _is_ needed to +evaluate the distilled model on during distillation. -`distill` will save out the best performing pipeline across all epochs, as well as the final -pipeline. The `--code` argument can be used to provide a Python file that's -imported before the training process starts. This lets you register +`distill` will save out the best performing pipeline across all epochs, as well +as the final pipeline. The `--code` argument can be used to provide a Python +file that's imported before the training process starts. This lets you register [custom functions](/usage/training#custom-functions) and architectures and refer to them in your config, all while still using spaCy's built-in `train` workflow. -If you need to manage complex multi-step training workflows, check out the new -[spaCy projects](/usage/projects). +If you need to manage complex multi-step training workflows, check out the +[Weasel](https://github.com/explosion/weasel). > #### Example > @@ -1731,14 +1732,14 @@ $ python -m spacy distill [teacher_model] [student_config_path] [--output] [--co | Name | Description | | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `teacher_model` | The teacher pipeline to distill the student from. ~~Path (positional)~~ | +| `teacher_model` | The teacher pipeline (name or path) to distill the student from. ~~Union[str, Path] (positional)~~ | | `student_config_path` | The configuration of the student pipeline. ~~Path (positional)~~ | | `--output`, `-o` | Directory to store the distilled pipeline in. Will be created if it doesn't exist. ~~Optional[Path] \(option)~~ | | `--code`, `-c` | Comma-separated paths to Python files with additional code to be imported. Allows [registering custom functions](/usage/training#custom-functions) for new architectures. ~~Optional[Path] \(option)~~ | | `--verbose`, `-V` | Show more detailed messages during distillation. ~~bool (flag)~~ | | `--gpu-id`, `-g` | GPU ID or `-1` for CPU. Defaults to `-1`. ~~int (option)~~ | | `--help`, `-h` | Show help message and available arguments. ~~bool (flag)~~ | -| **CREATES** | A `dvc.yaml` file in the project directory, based on the steps defined in the given workflow. | +| **CREATES** | The final trained pipeline and the best trained pipeline. | ## huggingface-hub {id="huggingface-hub",version="3.1"}