Skip to content

Commit

Permalink
Add more information to custom code docs (#12491)
Browse files Browse the repository at this point in the history
* Add info to sections

* Update website/docs/usage/training.mdx

---------

Co-authored-by: Adriane Boyd <[email protected]>
  • Loading branch information
thomashacker and adrianeboyd committed Apr 6, 2023
1 parent 314a7ce commit 9fbb8ee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion website/docs/api/top-level.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ and call the package's own `load()` method. If a pipeline is loaded from a path,
spaCy will assume it's a data directory, load its
[`config.cfg`](/api/data-formats#config) and use the language and pipeline
information to construct the `Language` class. The data will be loaded in via
[`Language.from_disk`](/api/language#from_disk).
[`Language.from_disk`](/api/language#from_disk). Loading a pipeline from a
package will also import any custom code, if present, whereas loading from a
directory does not. For these cases, you need to manually import your custom
code.

<Infobox variant="warning" title="Changed in v3.0">

Expand Down
9 changes: 9 additions & 0 deletions website/docs/usage/training.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,15 @@ any custom architectures, functions or
your pipeline and registered when it's loaded. See the documentation on
[saving and loading pipelines](/usage/saving-loading#models-custom) for details.
<Infobox variant="warning">
Note that the unpackaged models produced by `spacy train` are data directories
that **do not include custom code**. You need to import the code in your script
before loading in unpackaged models. For more details, see
[`spacy.load`](/api/top-level#spacy.load).
</Infobox>
#### Example: Modifying the nlp object {id="custom-code-nlp-callbacks"}
For many use cases, you don't necessarily want to implement the whole `Language`
Expand Down

0 comments on commit 9fbb8ee

Please sign in to comment.