references to usage page on layers and architectures

This commit is contained in:
svlandeg 2020-09-09 14:47:32 +02:00
parent e80898092b
commit 9a7c6cc61a
2 changed files with 17 additions and 14 deletions

View File

@ -415,11 +415,11 @@ with Model.define_operators({">>": chain}):
model.initialize(X=input_sample, Y=output_sample) model.initialize(X=input_sample, Y=output_sample)
``` ```
The built-in The built-in [pipeline components](/usage/processing-pipelines) in spaCy ensure
[pipeline components](http://localhost:8000/usage/processing-pipelines) in spaCy that their internal models are always initialized with appropriate sample data.
ensure that their internal models are always initialized with appropriate sample In this case, `X` is typically a `List` of `Doc` objects, while `Y` is a `List`
data. In this case, `X` is typically a `List` of `Doc` objects, while `Y` is a of 1D or 2D arrays, depending on the specific task. This functionality is
`List` of 1D or 2D arrays, depending on the specific task. triggered when [`nlp.begin_training`](/api/language#begin_training) is called.
### Dropout and normalization {#drop-norm} ### Dropout and normalization {#drop-norm}
@ -443,7 +443,7 @@ with Model.define_operators({">>": chain}):
model.initialize(X=input_sample, Y=output_sample) model.initialize(X=input_sample, Y=output_sample)
``` ```
## Create new components {#components} ## Create new trainable components {#components}
<!-- TODO: <!-- TODO:
@ -452,6 +452,8 @@ with Model.define_operators({">>": chain}):
Example: relation extraction component (implemented as project template) Example: relation extraction component (implemented as project template)
Avoid duplication with usage/processing-pipelines#trainable-components ?
--> -->
![Diagram of a pipeline component with its model](../images/layers-architectures.svg) ![Diagram of a pipeline component with its model](../images/layers-architectures.svg)

View File

@ -1028,11 +1028,11 @@ plug fully custom machine learning components into your pipeline. You'll need
the following: the following:
1. **Model:** A Thinc [`Model`](https://thinc.ai/docs/api-model) instance. This 1. **Model:** A Thinc [`Model`](https://thinc.ai/docs/api-model) instance. This
can be a model using [layers](https://thinc.ai/docs/api-layers) implemented can be a model using implemented in
in Thinc, or a [wrapped model](https://thinc.ai/docs/usage-frameworks) [Thinc](/usage/layers-architectures#thinc), or a
implemented in PyTorch, TensorFlow, MXNet or a fully custom solution. The [wrapped model](/usage/layers-architectures#frameworks) implemented in
model must take a list of [`Doc`](/api/doc) objects as input and can have any PyTorch, TensorFlow, MXNet or a fully custom solution. The model must take a
type of output. list of [`Doc`](/api/doc) objects as input and can have any type of output.
2. **Pipe subclass:** A subclass of [`Pipe`](/api/pipe) that implements at least 2. **Pipe subclass:** A subclass of [`Pipe`](/api/pipe) that implements at least
two methods: [`Pipe.predict`](/api/pipe#predict) and two methods: [`Pipe.predict`](/api/pipe#predict) and
[`Pipe.set_annotations`](/api/pipe#set_annotations). [`Pipe.set_annotations`](/api/pipe#set_annotations).
@ -1078,8 +1078,9 @@ _first_ create a `Model` from a [registered architecture](/api/architectures),
validate its arguments and _then_ pass the object forward to the component. This validate its arguments and _then_ pass the object forward to the component. This
means that the config can express very complex, nested trees of objects but means that the config can express very complex, nested trees of objects but
the objects don't have to pass the model settings all the way down to the the objects don't have to pass the model settings all the way down to the
components. It also makes the components more **modular** and lets you swap components. It also makes the components more **modular** and lets you
different architectures in your config, and re-use model definitions. [swap](/usage/layers-architectures#swap-architectures) different architectures
in your config, and re-use model definitions.
```ini ```ini
### config.cfg (excerpt) ### config.cfg (excerpt)
@ -1134,7 +1135,7 @@ loss is calculated and to add evaluation scores to the training output.
For more details on how to implement your own trainable components and model For more details on how to implement your own trainable components and model
architectures, and plug existing models implemented in PyTorch or TensorFlow architectures, and plug existing models implemented in PyTorch or TensorFlow
into your spaCy pipeline, see the usage guide on into your spaCy pipeline, see the usage guide on
[layers and model architectures](/usage/layers-architectures#components). [layers and model architectures](/usage/layers-architectures).
</Infobox> </Infobox>