mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-29 02:34:08 +03:00
d33953037e
* Create aryaprabhudesai.md (#2681) * Update _install.jade (#2688) Typo fix: "models" -> "model" * Add FAC to spacy.explain (resolves #2706) * Remove docstrings for deprecated arguments (see #2703) * When calling getoption() in conftest.py, pass a default option (#2709) * When calling getoption() in conftest.py, pass a default option This is necessary to allow testing an installed spacy by running: pytest --pyargs spacy * Add contributor agreement * update bengali token rules for hyphen and digits (#2731) * Less norm computations in token similarity (#2730) * Less norm computations in token similarity * Contributor agreement * Remove ')' for clarity (#2737) Sorry, don't mean to be nitpicky, I just noticed this when going through the CLI and thought it was a quick fix. That said, if this was intention than please let me know. * added contributor agreement for mbkupfer (#2738) * Basic support for Telugu language (#2751) * Lex _attrs for polish language (#2750) * Signed spaCy contributor agreement * Added polish version of english lex_attrs * Introduces a bulk merge function, in order to solve issue #653 (#2696) * Fix comment * Introduce bulk merge to increase performance on many span merges * Sign contributor agreement * Implement pull request suggestions * Describe converters more explicitly (see #2643) * Add multi-threading note to Language.pipe (resolves #2582) [ci skip] * Fix formatting * Fix dependency scheme docs (closes #2705) [ci skip] * Don't set stop word in example (closes #2657) [ci skip] * Add words to portuguese language _num_words (#2759) * Add words to portuguese language _num_words * Add words to portuguese language _num_words * Update Indonesian model (#2752) * adding e-KTP in tokenizer exceptions list * add exception token * removing lines with containing space as it won't matter since we use .split() method in the end, added new tokens in exception * add tokenizer exceptions list * combining base_norms with norm_exceptions * adding norm_exception * fix double key in lemmatizer * remove unused import on punctuation.py * reformat stop_words to reduce number of lines, improve readibility * updating tokenizer exception * implement is_currency for lang/id * adding orth_first_upper in tokenizer_exceptions * update the norm_exception list * remove bunch of abbreviations * adding contributors file * Fixed spaCy+Keras example (#2763) * bug fixes in keras example * created contributor agreement * Adding French hyphenated first name (#2786) * Fix typo (closes #2784) * Fix typo (#2795) [ci skip] Fixed typo on line 6 "regcognizer --> recognizer" * Adding basic support for Sinhala language. (#2788) * adding Sinhala language package, stop words, examples and lex_attrs. * Adding contributor agreement * Updating contributor agreement * Also include lowercase norm exceptions * Fix error (#2802) * Fix error ValueError: cannot resize an array that references or is referenced by another array in this way. Use the resize function * added spaCy Contributor Agreement * Add charlax's contributor agreement (#2805) * agreement of contributor, may I introduce a tiny pl languge contribution (#2799) * Contributors agreement * Contributors agreement * Contributors agreement * Add jupyter=True to displacy.render in documentation (#2806) * Revert "Also include lowercase norm exceptions" This reverts commit70f4e8adf3
. * Remove deprecated encoding argument to msgpack * Set up dependency tree pattern matching skeleton (#2732) * Fix bug when too many entity types. Fixes #2800 * Fix Python 2 test failure * Require older msgpack-numpy * Restore encoding arg on msgpack-numpy * Try to fix version pin for msgpack-numpy * Update Portuguese Language (#2790) * Add words to portuguese language _num_words * Add words to portuguese language _num_words * Portuguese - Add/remove stopwords, fix tokenizer, add currency symbols * Extended punctuation and norm_exceptions in the Portuguese language * Correct error in spacy universe docs concerning spacy-lookup (#2814) * Update Keras Example for (Parikh et al, 2016) implementation (#2803) * bug fixes in keras example * created contributor agreement * baseline for Parikh model * initial version of parikh 2016 implemented * tested asymmetric models * fixed grevious error in normalization * use standard SNLI test file * begin to rework parikh example * initial version of running example * start to document the new version * start to document the new version * Update Decompositional Attention.ipynb * fixed calls to similarity * updated the README * import sys package duh * simplified indexing on mapping word to IDs * stupid python indent error * added code from https://github.com/tensorflow/tensorflow/issues/3388 for tf bug workaround * Fix typo (closes #2815) [ci skip] * Update regex version dependency * Set version to 2.0.13.dev3 * Skip seemingly problematic test * Remove problematic test * Try previous version of regex * Revert "Remove problematic test" This reverts commitbdebbef455
. * Unskip test * Try older version of regex * 💫 Update training examples and use minibatching (#2830) <!--- Provide a general summary of your changes in the title. --> ## Description Update the training examples in `/examples/training` to show usage of spaCy's `minibatch` and `compounding` helpers ([see here](https://spacy.io/usage/training#tips-batch-size) for details). The lack of batching in the examples has caused some confusion in the past, especially for beginners who would copy-paste the examples, update them with large training sets and experienced slow and unsatisfying results. ### Types of change enhancements ## Checklist <!--- Before you submit the PR, go over this checklist and make sure you can tick off all the boxes. [] -> [x] --> - [x] I have submitted the spaCy Contributor Agreement. - [x] I ran the tests, and all new and existing tests passed. - [x] My changes don't require a change to the documentation, or if they do, I've added all required information. * Visual C++ link updated (#2842) (closes #2841) [ci skip] * New landing page * Add contribution agreement * Correcting lang/ru/examples.py (#2845) * Correct some grammatical inaccuracies in lang\ru\examples.py; filled Contributor Agreement * Correct some grammatical inaccuracies in lang\ru\examples.py * Move contributor agreement to separate file * Set version to 2.0.13.dev4 * Add Persian(Farsi) language support (#2797) * Also include lowercase norm exceptions * Remove in favour of https://github.com/explosion/spaCy/graphs/contributors * Rule-based French Lemmatizer (#2818) <!--- Provide a general summary of your changes in the title. --> ## Description <!--- Use this section to describe your changes. If your changes required testing, include information about the testing environment and the tests you ran. If your test fixes a bug reported in an issue, don't forget to include the issue number. If your PR is still a work in progress, that's totally fine – just include a note to let us know. --> Add a rule-based French Lemmatizer following the english one and the excellent PR for [greek language optimizations](https://github.com/explosion/spaCy/pull/2558) to adapt the Lemmatizer class. ### Types of change <!-- What type of change does your PR cover? Is it a bug fix, an enhancement or new feature, or a change to the documentation? --> - Lemma dictionary used can be found [here](http://infolingu.univ-mlv.fr/DonneesLinguistiques/Dictionnaires/telechargement.html), I used the XML version. - Add several files containing exhaustive list of words for each part of speech - Add some lemma rules - Add POS that are not checked in the standard Lemmatizer, i.e PRON, DET, ADV and AUX - Modify the Lemmatizer class to check in lookup table as a last resort if POS not mentionned - Modify the lemmatize function to check in lookup table as a last resort - Init files are updated so the model can support all the functionalities mentioned above - Add words to tokenizer_exceptions_list.py in respect to regex used in tokenizer_exceptions.py ## Checklist <!--- Before you submit the PR, go over this checklist and make sure you can tick off all the boxes. [] -> [x] --> - [X] I have submitted the spaCy Contributor Agreement. - [X] I ran the tests, and all new and existing tests passed. - [X] My changes don't require a change to the documentation, or if they do, I've added all required information. * Set version to 2.0.13 * Fix formatting and consistency * Update docs for new version [ci skip] * Increment version [ci skip] * Add info on wheels [ci skip] * Adding "This is a sentence" example to Sinhala (#2846) * Add wheels badge * Update badge [ci skip] * Update README.rst [ci skip] * Update murmurhash pin * Increment version to 2.0.14.dev0 * Update GPU docs for v2.0.14 * Add wheel to setup_requires * Import prefer_gpu and require_gpu functions from Thinc * Add tests for prefer_gpu() and require_gpu() * Update requirements and setup.py * Workaround bug in thinc require_gpu * Set version to v2.0.14 * Update push-tag script * Unhack prefer_gpu * Require thinc 6.10.6 * Update prefer_gpu and require_gpu docs [ci skip] * Fix specifiers for GPU * Set version to 2.0.14.dev1 * Set version to 2.0.14 * Update Thinc version pin * Increment version * Fix msgpack-numpy version pin * Increment version * Update version to 2.0.16 * Update version [ci skip] * Redundant ')' in the Stop words' example (#2856) <!--- Provide a general summary of your changes in the title. --> ## Description <!--- Use this section to describe your changes. If your changes required testing, include information about the testing environment and the tests you ran. If your test fixes a bug reported in an issue, don't forget to include the issue number. If your PR is still a work in progress, that's totally fine – just include a note to let us know. --> ### Types of change <!-- What type of change does your PR cover? Is it a bug fix, an enhancement or new feature, or a change to the documentation? --> ## Checklist <!--- Before you submit the PR, go over this checklist and make sure you can tick off all the boxes. [] -> [x] --> - [ ] I have submitted the spaCy Contributor Agreement. - [ ] I ran the tests, and all new and existing tests passed. - [ ] My changes don't require a change to the documentation, or if they do, I've added all required information. * Documentation improvement regarding joblib and SO (#2867) Some documentation improvements ## Description 1. Fixed the dead URL to joblib 2. Fixed Stack Overflow brand name (with space) ### Types of change Documentation ## Checklist <!--- Before you submit the PR, go over this checklist and make sure you can tick off all the boxes. [] -> [x] --> - [x] I have submitted the spaCy Contributor Agreement. - [x] I ran the tests, and all new and existing tests passed. - [x] My changes don't require a change to the documentation, or if they do, I've added all required information. * raise error when setting overlapping entities as doc.ents (#2880) * Fix out-of-bounds access in NER training The helper method state.B(1) gets the index of the first token of the buffer, or -1 if no such token exists. Normally this is safe because we pass this to functions like state.safe_get(), which returns an empty token. Here we used it directly as an array index, which is not okay! This error may have been the cause of out-of-bounds access errors during training. Similar errors may still be around, so much be hunted down. Hunting this one down took a long time...I printed out values across training runs and diffed, looking for points of divergence between runs, when no randomness should be allowed. * Change PyThaiNLP Url (#2876) * Fix missing comma * Add example showing a fix-up rule for space entities * Set version to 2.0.17.dev0 * Update regex version * Revert "Update regex version" This reverts commit62358dd867
. * Try setting older regex version, to align with conda * Set version to 2.0.17 * Add spacy-js to universe [ci-skip] * Add spacy-raspberry to universe (closes #2889) * Add script to validate universe json [ci skip] * Removed space in docs + added contributor indo (#2909) * - removed unneeded space in documentation * - added contributor info * Allow input text of length up to max_length, inclusive (#2922) * Include universe spec for spacy-wordnet component (#2919) * feat: include universe spec for spacy-wordnet component * chore: include spaCy contributor agreement * Minor formatting changes [ci skip] * Fix image [ci skip] Twitter URL doesn't work on live site * Check if the word is in one of the regular lists specific to each POS (#2886) * 💫 Create random IDs for SVGs to prevent ID clashes (#2927) Resolves #2924. ## Description Fixes problem where multiple visualizations in Jupyter notebooks would have clashing arc IDs, resulting in weirdly positioned arc labels. Generating a random ID prefix so even identical parses won't receive the same IDs for consistency (even if effect of ID clash isn't noticable here.) ### Types of change bug fix ## Checklist <!--- Before you submit the PR, go over this checklist and make sure you can tick off all the boxes. [] -> [x] --> - [x] I have submitted the spaCy Contributor Agreement. - [x] I ran the tests, and all new and existing tests passed. - [x] My changes don't require a change to the documentation, or if they do, I've added all required information. * Fix typo [ci skip] * fixes symbolic link on py3 and windows (#2949) * fixes symbolic link on py3 and windows during setup of spacy using command python -m spacy link en_core_web_sm en closes #2948 * Update spacy/compat.py Co-Authored-By: cicorias <cicorias@users.noreply.github.com> * Fix formatting * Update universe [ci skip] * Catalan Language Support (#2940) * Catalan language Support * Ddding Catalan to documentation * Sort languages alphabetically [ci skip] * Update tests for pytest 4.x (#2965) <!--- Provide a general summary of your changes in the title. --> ## Description - [x] Replace marks in params for pytest 4.0 compat ([see here](https://docs.pytest.org/en/latest/deprecations.html#marks-in-pytest-mark-parametrize)) - [x] Un-xfail passing tests (some fixes in a recent update resolved a bunch of issues, but tests were apparently never updated here) ### Types of change <!-- What type of change does your PR cover? Is it a bug fix, an enhancement or new feature, or a change to the documentation? --> ## Checklist <!--- Before you submit the PR, go over this checklist and make sure you can tick off all the boxes. [] -> [x] --> - [x] I have submitted the spaCy Contributor Agreement. - [x] I ran the tests, and all new and existing tests passed. - [x] My changes don't require a change to the documentation, or if they do, I've added all required information. * Fix regex pin to harmonize with conda (#2964) * Update README.rst * Fix bug where Vocab.prune_vector did not use 'batch_size' (#2977) Fixes #2976 * Fix typo * Fix typo * Remove duplicate file * Require thinc 7.0.0.dev2 Fixes bug in gpu_ops that would use cupy instead of numpy on CPU * Add missing import * Fix error IDs * Fix tests
693 lines
22 KiB
Plaintext
693 lines
22 KiB
Plaintext
//- 💫 DOCS > API > COMMAND LINE INTERFACE
|
||
|
||
include ../_includes/_mixins
|
||
|
||
p
|
||
| As of v1.7.0, spaCy comes with new command line helpers to download and
|
||
| link models and show useful debugging information. For a list of available
|
||
| commands, type #[code spacy --help].
|
||
|
||
+h(3, "download") Download
|
||
|
||
p
|
||
| Download #[+a("/usage/models") models] for spaCy. The downloader finds the
|
||
| best-matching compatible version, uses pip to download the model as a
|
||
| package and automatically creates a
|
||
| #[+a("/usage/models#usage") shortcut link] to load the model by name.
|
||
| Direct downloads don't perform any compatibility checks and require the
|
||
| model name to be specified with its version (e.g.
|
||
| #[code en_core_web_sm-2.0.0]).
|
||
|
||
+aside("Downloading best practices")
|
||
| The #[code download] command is mostly intended as a convenient,
|
||
| interactive wrapper – it performs compatibility checks and prints
|
||
| detailed messages in case things go wrong. It's #[strong not recommended]
|
||
| to use this command as part of an automated process. If you know which
|
||
| model your project needs, you should consider a
|
||
| #[+a("/usage/models#download-pip") direct download via pip], or
|
||
| uploading the model to a local PyPi installation and fetching it straight
|
||
| from there. This will also allow you to add it as a versioned package
|
||
| dependency to your project.
|
||
|
||
+code(false, "bash", "$").
|
||
python -m spacy download [model] [--direct]
|
||
|
||
+table(["Argument", "Type", "Description"])
|
||
+row
|
||
+cell #[code model]
|
||
+cell positional
|
||
+cell
|
||
| Model name or shortcut (#[code en], #[code de],
|
||
| #[code en_core_web_sm]).
|
||
|
||
+row
|
||
+cell #[code --direct], #[code -d]
|
||
+cell flag
|
||
+cell Force direct download of exact model version.
|
||
|
||
+row
|
||
+cell other
|
||
+tag-new(2.1)
|
||
+cell -
|
||
+cell
|
||
| Additional installation options to be passed to
|
||
| #[code pip install] when installing the model package. For
|
||
| example, #[code --user] to install to the user home directory.
|
||
|
||
+row
|
||
+cell #[code --help], #[code -h]
|
||
+cell flag
|
||
+cell Show help message and available arguments.
|
||
|
||
+row("foot")
|
||
+cell creates
|
||
+cell directory, symlink
|
||
+cell
|
||
| The installed model package in your #[code site-packages]
|
||
| directory and a shortcut link as a symlink in #[code spacy/data].
|
||
|
||
+h(3, "link") Link
|
||
|
||
p
|
||
| Create a #[+a("/usage/models#usage") shortcut link] for a model,
|
||
| either a Python package or a local directory. This will let you load
|
||
| models from any location using a custom name via
|
||
| #[+api("spacy#load") #[code spacy.load()]].
|
||
|
||
+infobox("Important note")
|
||
| In spaCy v1.x, you had to use the model data directory to set up a shortcut
|
||
| link for a local path. As of v2.0, spaCy expects all shortcut links to
|
||
| be #[strong loadable model packages]. If you want to load a data directory,
|
||
| call #[+api("spacy#load") #[code spacy.load()]] or
|
||
| #[+api("language#from_disk") #[code Language.from_disk()]] with the path,
|
||
| or use the #[+api("cli#package") #[code package]] command to create a
|
||
| model package.
|
||
|
||
+code(false, "bash", "$").
|
||
python -m spacy link [origin] [link_name] [--force]
|
||
|
||
+table(["Argument", "Type", "Description"])
|
||
+row
|
||
+cell #[code origin]
|
||
+cell positional
|
||
+cell Model name if package, or path to local directory.
|
||
|
||
+row
|
||
+cell #[code link_name]
|
||
+cell positional
|
||
+cell Name of the shortcut link to create.
|
||
|
||
+row
|
||
+cell #[code --force], #[code -f]
|
||
+cell flag
|
||
+cell Force overwriting of existing link.
|
||
|
||
+row
|
||
+cell #[code --help], #[code -h]
|
||
+cell flag
|
||
+cell Show help message and available arguments.
|
||
|
||
+row("foot")
|
||
+cell creates
|
||
+cell symlink
|
||
+cell
|
||
| A shortcut link of the given name as a symlink in
|
||
| #[code spacy/data].
|
||
|
||
+h(3, "info") Info
|
||
|
||
p
|
||
| Print information about your spaCy installation, models and local setup,
|
||
| and generate #[+a("https://en.wikipedia.org/wiki/Markdown") Markdown]-formatted
|
||
| markup to copy-paste into #[+a(gh("spacy") + "/issues") GitHub issues].
|
||
|
||
+code(false, "bash").
|
||
python -m spacy info [--markdown]
|
||
python -m spacy info [model] [--markdown]
|
||
|
||
+table(["Argument", "Type", "Description"])
|
||
+row
|
||
+cell #[code model]
|
||
+cell positional
|
||
+cell A model, i.e. shortcut link, package name or path (optional).
|
||
|
||
+row
|
||
+cell #[code --markdown], #[code -md]
|
||
+cell flag
|
||
+cell Print information as Markdown.
|
||
|
||
+row
|
||
+cell #[code --silent], #[code -s]
|
||
+tag-new("2.0.12")
|
||
+cell flag
|
||
+cell Don't print anything, just return the values.
|
||
|
||
+row
|
||
+cell #[code --help], #[code -h]
|
||
+cell flag
|
||
+cell Show help message and available arguments.
|
||
|
||
+row("foot")
|
||
+cell prints
|
||
+cell #[code stdout]
|
||
+cell Information about your spaCy installation.
|
||
|
||
+h(3, "validate") Validate
|
||
+tag-new(2)
|
||
|
||
p
|
||
| Find all models installed in the current environment (both packages and
|
||
| shortcut links) and check whether they are compatible with the currently
|
||
| installed version of spaCy. Should be run after upgrading spaCy via
|
||
| #[code pip install -U spacy] to ensure that all installed models are
|
||
| can be used with the new version. The command is also useful to detect
|
||
| out-of-sync model links resulting from links created in different virtual
|
||
| environments. It will a list of models, the installed versions, the
|
||
| latest compatible version (if out of date) and the commands for updating.
|
||
|
||
+aside("Automated validation")
|
||
| You can also use the #[code validate] command as part of your build
|
||
| process or test suite, to ensure all models are up to date before
|
||
| proceeding. If incompatible models or shortcut links are found, it will
|
||
| return #[code 1].
|
||
|
||
+code(false, "bash", "$").
|
||
python -m spacy validate
|
||
|
||
+table(["Argument", "Type", "Description"])
|
||
+row("foot")
|
||
+cell prints
|
||
+cell #[code stdout]
|
||
+cell Details about the compatibility of your installed models.
|
||
|
||
+h(3, "convert") Convert
|
||
|
||
p
|
||
| Convert files into spaCy's #[+a("/api/annotation#json-input") JSON format]
|
||
| for use with the #[code train] command and other experiment management
|
||
| functions. The converter can be specified on the command line, or
|
||
| chosen based on the file extension of the input file.
|
||
|
||
+code(false, "bash", "$", false, false, true).
|
||
python -m spacy convert [input_file] [output_dir] [--converter] [--n-sents]
|
||
[--morphology]
|
||
|
||
+table(["Argument", "Type", "Description"])
|
||
+row
|
||
+cell #[code input_file]
|
||
+cell positional
|
||
+cell Input file.
|
||
|
||
+row
|
||
+cell #[code output_dir]
|
||
+cell positional
|
||
+cell Output directory for converted JSON file.
|
||
|
||
+row
|
||
+cell #[code converter], #[code -c]
|
||
+cell option
|
||
+cell #[+tag-new(2)] Name of converter to use (see below).
|
||
|
||
+row
|
||
+cell #[code --n-sents], #[code -n]
|
||
+cell option
|
||
+cell Number of sentences per document.
|
||
|
||
+row
|
||
+cell #[code --morphology], #[code -m]
|
||
+cell option
|
||
+cell Enable appending morphology to tags.
|
||
|
||
+row
|
||
+cell #[code --help], #[code -h]
|
||
+cell flag
|
||
+cell Show help message and available arguments.
|
||
|
||
+row("foot")
|
||
+cell creates
|
||
+cell JSON
|
||
+cell Data in spaCy's #[+a("/api/annotation#json-input") JSON format].
|
||
|
||
p The following file format converters are available:
|
||
|
||
+table(["ID", "Description"])
|
||
+row
|
||
+cell #[code auto]
|
||
+cell Automatically pick converter based on file extension (default).
|
||
|
||
+row
|
||
+cell #[code conllu], #[code conll]
|
||
+cell Universal Dependencies #[code .conllu] or #[code .conll] format.
|
||
|
||
+row
|
||
+cell #[code ner]
|
||
+cell Tab-based named entity recognition format.
|
||
|
||
+row
|
||
+cell #[code iob]
|
||
+cell IOB named entity recognition format.
|
||
|
||
+h(3, "train") Train
|
||
|
||
p
|
||
| Train a model. Expects data in spaCy's
|
||
| #[+a("/api/annotation#json-input") JSON format]. On each epoch, a model
|
||
| will be saved out to the directory. Accuracy scores and model details
|
||
| will be added to a #[+a("/usage/training#models-generating") #[code meta.json]]
|
||
| to allow packaging the model using the
|
||
| #[+api("cli#package") #[code package]] command.
|
||
|
||
+code(false, "bash", "$", false, false, true).
|
||
python -m spacy train [lang] [output_dir] [train_data] [dev_data] [--n-iter]
|
||
[--n-sents] [--use-gpu] [--meta-path] [--vectors] [--no-tagger] [--no-parser]
|
||
[--no-entities] [--gold-preproc] [--verbose]
|
||
|
||
+table(["Argument", "Type", "Description"])
|
||
+row
|
||
+cell #[code lang]
|
||
+cell positional
|
||
+cell Model language.
|
||
|
||
+row
|
||
+cell #[code output_dir]
|
||
+cell positional
|
||
+cell Directory to store model in.
|
||
|
||
+row
|
||
+cell #[code train_data]
|
||
+cell positional
|
||
+cell Location of JSON-formatted training data.
|
||
|
||
+row
|
||
+cell #[code dev_data]
|
||
+cell positional
|
||
+cell Location of JSON-formatted development data for evaluation.
|
||
|
||
+row
|
||
+cell #[code --n-iter], #[code -n]
|
||
+cell option
|
||
+cell Number of iterations (default: #[code 30]).
|
||
|
||
+row
|
||
+cell #[code --n-sents], #[code -ns]
|
||
+cell option
|
||
+cell Number of sentences (default: #[code 0]).
|
||
|
||
+row
|
||
+cell #[code --use-gpu], #[code -g]
|
||
+cell option
|
||
+cell Use GPU.
|
||
|
||
+row
|
||
+cell #[code --vectors], #[code -v]
|
||
+cell option
|
||
+cell Model to load vectors from.
|
||
|
||
+row
|
||
+cell #[code --meta-path], #[code -m]
|
||
+cell option
|
||
+cell
|
||
| #[+tag-new(2)] Optional path to model
|
||
| #[+a("/usage/training#models-generating") #[code meta.json]].
|
||
| All relevant properties like #[code lang], #[code pipeline] and
|
||
| #[code spacy_version] will be overwritten.
|
||
|
||
+row
|
||
+cell #[code --version], #[code -V]
|
||
+cell option
|
||
+cell
|
||
| Model version. Will be written out to the model's
|
||
| #[code meta.json] after training.
|
||
|
||
+row
|
||
+cell #[code --no-tagger], #[code -T]
|
||
+cell flag
|
||
+cell Don't train tagger.
|
||
|
||
+row
|
||
+cell #[code --no-parser], #[code -P]
|
||
+cell flag
|
||
+cell Don't train parser.
|
||
|
||
+row
|
||
+cell #[code --no-entities], #[code -N]
|
||
+cell flag
|
||
+cell Don't train NER.
|
||
|
||
+row
|
||
+cell #[code --gold-preproc], #[code -G]
|
||
+cell flag
|
||
+cell Use gold preprocessing.
|
||
|
||
+row
|
||
+cell #[code --help], #[code -h]
|
||
+cell flag
|
||
+cell Show help message and available arguments.
|
||
|
||
+row
|
||
+cell #[code --verbose]
|
||
+tag-new("2.0.13")
|
||
+cell flag
|
||
+cell Show more detail message during training.
|
||
|
||
+row("foot")
|
||
+cell creates
|
||
+cell model, pickle
|
||
+cell A spaCy model on each epoch, and a final #[code .pickle] file.
|
||
|
||
+h(4, "train-hyperparams") Environment variables for hyperparameters
|
||
+tag-new(2)
|
||
|
||
p
|
||
| spaCy lets you set hyperparameters for training via environment variables.
|
||
| This is useful, because it keeps the command simple and allows you to
|
||
| #[+a("https://askubuntu.com/questions/17536/how-do-i-create-a-permanent-bash-alias/17537#17537") create an alias]
|
||
| for your custom #[code train] command while still being able to easily
|
||
| tweak the hyperparameters. For example:
|
||
|
||
+code(false, "bash", "$").
|
||
parser_hidden_depth=2 parser_maxout_pieces=1 spacy train [...]
|
||
|
||
+code("Usage with alias", "bash", "$").
|
||
alias train-parser="spacy train en /output /data /train /dev -n 1000"
|
||
parser_maxout_pieces=1 train-parser
|
||
|
||
+table(["Name", "Description", "Default"])
|
||
+row
|
||
+cell #[code dropout_from]
|
||
+cell Initial dropout rate.
|
||
+cell #[code 0.2]
|
||
|
||
+row
|
||
+cell #[code dropout_to]
|
||
+cell Final dropout rate.
|
||
+cell #[code 0.2]
|
||
|
||
+row
|
||
+cell #[code dropout_decay]
|
||
+cell Rate of dropout change.
|
||
+cell #[code 0.0]
|
||
|
||
+row
|
||
+cell #[code batch_from]
|
||
+cell Initial batch size.
|
||
+cell #[code 1]
|
||
|
||
+row
|
||
+cell #[code batch_to]
|
||
+cell Final batch size.
|
||
+cell #[code 64]
|
||
|
||
+row
|
||
+cell #[code batch_compound]
|
||
+cell Rate of batch size acceleration.
|
||
+cell #[code 1.001]
|
||
|
||
+row
|
||
+cell #[code token_vector_width]
|
||
+cell Width of embedding tables and convolutional layers.
|
||
+cell #[code 128]
|
||
|
||
+row
|
||
+cell #[code embed_size]
|
||
+cell Number of rows in embedding tables.
|
||
+cell #[code 7500]
|
||
|
||
//- +row
|
||
//- +cell #[code parser_maxout_pieces]
|
||
//- +cell Number of pieces in the parser's and NER's first maxout layer.
|
||
//- +cell #[code 2]
|
||
|
||
//- +row
|
||
//- +cell #[code parser_hidden_depth]
|
||
//- +cell Number of hidden layers in the parser and NER.
|
||
//- +cell #[code 1]
|
||
|
||
+row
|
||
+cell #[code hidden_width]
|
||
+cell Size of the parser's and NER's hidden layers.
|
||
+cell #[code 128]
|
||
|
||
//- +row
|
||
//- +cell #[code history_feats]
|
||
//- +cell Number of previous action ID features for parser and NER.
|
||
//- +cell #[code 128]
|
||
|
||
//- +row
|
||
//- +cell #[code history_width]
|
||
//- +cell Number of embedding dimensions for each action ID.
|
||
//- +cell #[code 128]
|
||
|
||
+row
|
||
+cell #[code learn_rate]
|
||
+cell Learning rate.
|
||
+cell #[code 0.001]
|
||
|
||
+row
|
||
+cell #[code optimizer_B1]
|
||
+cell Momentum for the Adam solver.
|
||
+cell #[code 0.9]
|
||
|
||
+row
|
||
+cell #[code optimizer_B2]
|
||
+cell Adagrad-momentum for the Adam solver.
|
||
+cell #[code 0.999]
|
||
|
||
+row
|
||
+cell #[code optimizer_eps]
|
||
+cell Epsylon value for the Adam solver.
|
||
+cell #[code 1e-08]
|
||
|
||
+row
|
||
+cell #[code L2_penalty]
|
||
+cell L2 regularisation penalty.
|
||
+cell #[code 1e-06]
|
||
|
||
+row
|
||
+cell #[code grad_norm_clip]
|
||
+cell Gradient L2 norm constraint.
|
||
+cell #[code 1.0]
|
||
|
||
+h(3, "vocab") Vocab
|
||
+tag-new(2)
|
||
|
||
p
|
||
| Compile a vocabulary from a
|
||
| #[+a("/api/annotation#vocab-jsonl") lexicon JSONL] file and optional
|
||
| word vectors. Will save out a valid spaCy model that you can load via
|
||
| #[+api("spacy#load") #[code spacy.load]] or package using the
|
||
| #[+api("cli#package") #[code package]] command.
|
||
|
||
+code(false, "bash", "$").
|
||
python -m spacy vocab [lang] [output_dir] [lexemes_loc] [vectors_loc]
|
||
|
||
+table(["Argument", "Type", "Description"])
|
||
+row
|
||
+cell #[code lang]
|
||
+cell positional
|
||
+cell
|
||
| Model language
|
||
| #[+a("https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes") ISO code],
|
||
| e.g. #[code en].
|
||
|
||
+row
|
||
+cell #[code output_dir]
|
||
+cell positional
|
||
+cell Model output directory. Will be created if it doesn't exist.
|
||
|
||
+row
|
||
+cell #[code lexemes_loc]
|
||
+cell positional
|
||
+cell
|
||
| Location of lexical data in spaCy's
|
||
| #[+a("/api/annotation#vocab-jsonl") JSONL format].
|
||
|
||
+row
|
||
+cell #[code vectors_loc]
|
||
+cell positional
|
||
+cell Optional location of vectors data as numpy #[code .npz] file.
|
||
|
||
+row("foot")
|
||
+cell creates
|
||
+cell model
|
||
+cell A spaCy model containing the vocab and vectors.
|
||
|
||
+h(3, "init-model") Init Model
|
||
+tag-new(2)
|
||
|
||
p
|
||
| Create a new model directory from raw data, like word frequencies, Brown
|
||
| clusters and word vectors. This command is similar to the
|
||
| #[code spacy model] command in v1.x.
|
||
|
||
+code(false, "bash", "$", false, false, true).
|
||
python -m spacy init-model [lang] [output_dir] [freqs_loc] [--clusters-loc] [--vectors-loc] [--prune-vectors]
|
||
|
||
+table(["Argument", "Type", "Description"])
|
||
+row
|
||
+cell #[code lang]
|
||
+cell positional
|
||
+cell
|
||
| Model language
|
||
| #[+a("https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes") ISO code],
|
||
| e.g. #[code en].
|
||
|
||
+row
|
||
+cell #[code output_dir]
|
||
+cell positional
|
||
+cell Model output directory. Will be created if it doesn't exist.
|
||
|
||
+row
|
||
+cell #[code freqs_loc]
|
||
+cell positional
|
||
+cell
|
||
| Location of word frequencies file. Should be a tab-separated
|
||
| file with three columns: frequency, document frequency and
|
||
| frequency count.
|
||
|
||
+row
|
||
+cell #[code --clusters-loc], #[code -c]
|
||
+cell option
|
||
+cell
|
||
| Optional location of clusters file. Should be a tab-separated
|
||
| file with three columns: cluster, word and frequency.
|
||
|
||
+row
|
||
+cell #[code --vectors-loc], #[code -v]
|
||
+cell option
|
||
+cell
|
||
| Optional location of vectors file. Should be a tab-separated
|
||
| file in Word2Vec format where the first column contains the word
|
||
| and the remaining columns the values. File can be provided in
|
||
| #[code .txt] format or as a zipped text file in #[code .zip] or
|
||
| #[code .tar.gz] format.
|
||
|
||
+row
|
||
+cell #[code --prune-vectors], #[code -V]
|
||
+cell flag
|
||
+cell
|
||
| Number of vectors to prune the vocabulary to. Defaults to
|
||
| #[code -1] for no pruning.
|
||
|
||
+row("foot")
|
||
+cell creates
|
||
+cell model
|
||
+cell A spaCy model containing the vocab and vectors.
|
||
|
||
+h(3, "evaluate") Evaluate
|
||
+tag-new(2)
|
||
|
||
p
|
||
| Evaluate a model's accuracy and speed on JSON-formatted annotated data.
|
||
| Will print the results and optionally export
|
||
| #[+a("/usage/visualizers") displaCy visualizations] of a sample set of
|
||
| parses to #[code .html] files. Visualizations for the dependency parse
|
||
| and NER will be exported as separate files if the respective component
|
||
| is present in the model's pipeline.
|
||
|
||
+code(false, "bash", "$", false, false, true).
|
||
python -m spacy evaluate [model] [data_path] [--displacy-path] [--displacy-limit] [--gpu-id] [--gold-preproc]
|
||
|
||
+table(["Argument", "Type", "Description"])
|
||
+row
|
||
+cell #[code model]
|
||
+cell positional
|
||
+cell
|
||
| Model to evaluate. Can be a package or shortcut link name, or a
|
||
| path to a model data directory.
|
||
|
||
+row
|
||
+cell #[code data_path]
|
||
+cell positional
|
||
+cell Location of JSON-formatted evaluation data.
|
||
|
||
+row
|
||
+cell #[code --displacy-path], #[code -dp]
|
||
+cell option
|
||
+cell
|
||
| Directory to output rendered parses as HTML. If not set, no
|
||
| visualizations will be generated.
|
||
|
||
+row
|
||
+cell #[code --displacy-limit], #[code -dl]
|
||
+cell option
|
||
+cell
|
||
| Number of parses to generate per file. Defaults to #[code 25].
|
||
| Keep in mind that a significantly higher number might cause the
|
||
| #[code .html] files to render slowly.
|
||
|
||
+row
|
||
+cell #[code --gpu-id], #[code -g]
|
||
+cell option
|
||
+cell GPU to use, if any. Defaults to #[code -1] for CPU.
|
||
|
||
+row
|
||
+cell #[code --gold-preproc], #[code -G]
|
||
+cell flag
|
||
+cell Use gold preprocessing.
|
||
|
||
+row("foot")
|
||
+cell prints / creates
|
||
+cell #[code stdout], HTML
|
||
+cell Training results and optional displaCy visualizations.
|
||
|
||
|
||
+h(3, "package") Package
|
||
|
||
p
|
||
| Generate a #[+a("/usage/training#models-generating") model Python package]
|
||
| from an existing model data directory. All data files are copied over.
|
||
| If the path to a #[code meta.json] is supplied, or a #[code meta.json] is
|
||
| found in the input directory, this file is used. Otherwise, the data can
|
||
| be entered directly from the command line. After packaging, you can run
|
||
| #[code python setup.py sdist] from the newly created directory to turn
|
||
| your model into an installable archive file.
|
||
|
||
+code(false, "bash", "$", false, false, true).
|
||
python -m spacy package [input_dir] [output_dir] [--meta-path] [--create-meta] [--force]
|
||
|
||
+aside-code("Example", "bash").
|
||
python -m spacy package /input /output
|
||
cd /output/en_model-0.0.0
|
||
python setup.py sdist
|
||
pip install dist/en_model-0.0.0.tar.gz
|
||
|
||
+table(["Argument", "Type", "Description"])
|
||
+row
|
||
+cell #[code input_dir]
|
||
+cell positional
|
||
+cell Path to directory containing model data.
|
||
|
||
+row
|
||
+cell #[code output_dir]
|
||
+cell positional
|
||
+cell Directory to create package folder in.
|
||
|
||
+row
|
||
+cell #[code --meta-path], #[code -m]
|
||
+cell option
|
||
+cell #[+tag-new(2)] Path to #[code meta.json] file (optional).
|
||
|
||
+row
|
||
+cell #[code --create-meta], #[code -c]
|
||
+cell flag
|
||
+cell
|
||
| #[+tag-new(2)] Create a #[code meta.json] file on the command
|
||
| line, even if one already exists in the directory. If an
|
||
| existing file is found, its entries will be shown as the defaults
|
||
| in the command line prompt.
|
||
+row
|
||
+cell #[code --force], #[code -f]
|
||
+cell flag
|
||
+cell Force overwriting of existing folder in output directory.
|
||
|
||
+row
|
||
+cell #[code --help], #[code -h]
|
||
+cell flag
|
||
+cell Show help message and available arguments.
|
||
|
||
+row("foot")
|
||
+cell creates
|
||
+cell directory
|
||
+cell A Python package containing the spaCy model.
|