Update docs [ci skip]

This commit is contained in:
Ines Montani 2020-09-03 10:07:45 +02:00
parent 6f46d4e4d2
commit 1815c613c9
2 changed files with 25 additions and 27 deletions

View File

@ -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 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. beginning of training, to verify that all the types match correctly.
<Accordion title="Tip: Static type checking in your editor" emoji="💡"> <Accordion title="Tip: Static type checking in your editor">
If you're using a modern editor like Visual Studio Code, you can 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 [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 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, 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), to use the simple and fast bag-of-words model
you can change the config to: [TextCatBOW](/api/architectures#TextCatBOW), you can change the config to:
```ini ```ini
### config.cfg (excerpt) ### config.cfg (excerpt) {highlight="6-10"}
[components.textcat] [components.textcat]
factory = "textcat" factory = "textcat"
labels = [] labels = []
@ -160,8 +160,9 @@ no_output_layer = false
nO = null nO = null
``` ```
The details of all prebuilt architectures and their parameters, can be consulted For details on all pre-defined architectures shipped with spaCy and how to
on the [API page for model architectures](/api/architectures). configure them, check out the [model architectures](/api/architectures)
documentation.
### Defining sublayers {#sublayers} ### Defining sublayers {#sublayers}

View File

@ -669,10 +669,9 @@ def custom_logger(log_path):
#### Example: Custom batch size schedule {#custom-code-schedule} #### Example: Custom batch size schedule {#custom-code-schedule}
You can also implement your own batch size schedule to use You can also implement your own batch size schedule to use during training. The
during training. The `@spacy.registry.schedules` decorator lets you register `@spacy.registry.schedules` decorator lets you register that function in the
that function in the `schedules` [registry](/api/top-level#registry) and assign `schedules` [registry](/api/top-level#registry) and assign it a string name:
it a string name:
> #### Why the version in the name? > #### Why the version in the name?
> >
@ -807,13 +806,21 @@ def filter_batch(size: int) -> Callable[[Iterable[Example]], Iterator[List[Examp
### Defining custom architectures {#custom-architectures} ### Defining custom architectures {#custom-architectures}
Built-in pipeline components such as the tagger or named entity recognizer are Built-in pipeline components such as the tagger or named entity recognizer are
constructed with default neural network [models](/api/architectures). constructed with default neural network [models](/api/architectures). You can
You can change the model architecture change the model architecture entirely by implementing your own custom models
entirely by implementing your own custom models and providing those in the config and providing those in the config when creating the pipeline component. See the
when creating the pipeline component. See the documentation on [layers and model architectures](/usage/layers-architectures)
documentation on for more details.
[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 ```python
### functions.py ### functions.py
@ -828,16 +835,6 @@ def MyModel(output_width: int) -> Model[List[Doc], List[Floats2d]]:
return create_model(output_width) 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} ## Internal training API {#api}
<Infobox variant="warning"> <Infobox variant="warning">