diff --git a/website/docs/usage/layers-architectures.md b/website/docs/usage/layers-architectures.md index 419048f65..e24b776c8 100644 --- a/website/docs/usage/layers-architectures.md +++ b/website/docs/usage/layers-architectures.md @@ -103,7 +103,7 @@ bit of validation goes a long way, especially if you tools to highlight these errors early. The config file is also validated at the beginning of training, to verify that all the types match correctly. - + If you're using a modern editor like Visual Studio Code, you can [set up `mypy`](https://thinc.ai/docs/usage-type-checking#install) with the @@ -143,11 +143,11 @@ nO = null spaCy has two additional built-in `textcat` architectures, and you can easily use those by swapping out the definition of the textcat's model. For instance, -to use the simpel and fast [bag-of-words model](/api/architectures#TextCatBOW), -you can change the config to: +to use the simple and fast bag-of-words model +[TextCatBOW](/api/architectures#TextCatBOW), you can change the config to: ```ini -### config.cfg (excerpt) +### config.cfg (excerpt) {highlight="6-10"} [components.textcat] factory = "textcat" labels = [] @@ -160,8 +160,9 @@ no_output_layer = false nO = null ``` -The details of all prebuilt architectures and their parameters, can be consulted -on the [API page for model architectures](/api/architectures). +For details on all pre-defined architectures shipped with spaCy and how to +configure them, check out the [model architectures](/api/architectures) +documentation. ### Defining sublayers {#sublayers} diff --git a/website/docs/usage/training.md b/website/docs/usage/training.md index 2967a0353..43e1193ab 100644 --- a/website/docs/usage/training.md +++ b/website/docs/usage/training.md @@ -669,10 +669,9 @@ def custom_logger(log_path): #### Example: Custom batch size schedule {#custom-code-schedule} -You can also implement your own batch size schedule to use -during training. The `@spacy.registry.schedules` decorator lets you register -that function in the `schedules` [registry](/api/top-level#registry) and assign -it a string name: +You can also implement your own batch size schedule to use during training. The +`@spacy.registry.schedules` decorator lets you register that function in the +`schedules` [registry](/api/top-level#registry) and assign it a string name: > #### Why the version in the name? > @@ -806,14 +805,22 @@ def filter_batch(size: int) -> Callable[[Iterable[Example]], Iterator[List[Examp ### Defining custom architectures {#custom-architectures} -Built-in pipeline components such as the tagger or named entity recognizer are -constructed with default neural network [models](/api/architectures). -You can change the model architecture -entirely by implementing your own custom models and providing those in the config -when creating the pipeline component. See the -documentation on -[layers and model architectures](/usage/layers-architectures) for more details. +Built-in pipeline components such as the tagger or named entity recognizer are +constructed with default neural network [models](/api/architectures). You can +change the model architecture entirely by implementing your own custom models +and providing those in the config when creating the pipeline component. See the +documentation on [layers and model architectures](/usage/layers-architectures) +for more details. +> ```ini +> ### config.cfg +> [components.tagger] +> factory = "tagger" +> +> [components.tagger.model] +> @architectures = "custom_neural_network.v1" +> output_width = 512 +> ``` ```python ### functions.py @@ -828,16 +835,6 @@ def MyModel(output_width: int) -> Model[List[Doc], List[Floats2d]]: return create_model(output_width) ``` -```ini -### config.cfg (excerpt) -[components.tagger] -factory = "tagger" - -[components.tagger.model] -@architectures = "custom_neural_network.v1" -output_width = 512 -``` - ## Internal training API {#api}