mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 02:06:31 +03:00
Re-add python -m to commands, too brittle :( (see #1536)
This commit is contained in:
parent
ee5697a1cd
commit
4c5d2c80d5
|
@ -159,7 +159,7 @@ them:
|
|||
.. code:: bash
|
||||
|
||||
pip install -U spacy
|
||||
spacy validate
|
||||
python -m spacy validate
|
||||
|
||||
If you've trained your own models, keep in mind that your training and runtime
|
||||
inputs must match. After updating spaCy, we recommend **retraining your models**
|
||||
|
|
|
@ -58,8 +58,8 @@ def validate(cmd):
|
|||
|
||||
if incompat_links:
|
||||
prints("You may also want to overwrite the incompatible links using "
|
||||
"the `spacy link` command with `--force`, or remove them from "
|
||||
"the data directory. Data path: {}"
|
||||
"the `python -m spacy link` command with `--force`, or remove "
|
||||
"them from the data directory. Data path: {}"
|
||||
.format(path2str(get_data_path())))
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ for id in CURRENT_MODELS
|
|||
.u-padding-small Latest: #[code(data-tpl=id data-tpl-key="version") n/a]
|
||||
|
||||
+aside-code("Installation", "bash", "$").
|
||||
spacy download #{id}
|
||||
python -m spacy download #{id}
|
||||
|
||||
- var comps = getModelComponents(id)
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ p
|
|||
| model name to be specified with its version (e.g., #[code en_core_web_sm-1.2.0]).
|
||||
|
||||
+code(false, "bash", "$").
|
||||
spacy download [model] [--direct]
|
||||
python -m spacy download [model] [--direct]
|
||||
|
||||
+table(["Argument", "Type", "Description"])
|
||||
+row
|
||||
|
@ -72,7 +72,7 @@ p
|
|||
| model package.
|
||||
|
||||
+code(false, "bash", "$").
|
||||
spacy link [origin] [link_name] [--force]
|
||||
python -m spacy link [origin] [link_name] [--force]
|
||||
|
||||
+table(["Argument", "Type", "Description"])
|
||||
+row
|
||||
|
@ -110,8 +110,8 @@ p
|
|||
| markup to copy-paste into #[+a(gh("spacy") + "/issues") GitHub issues].
|
||||
|
||||
+code(false, "bash").
|
||||
spacy info [--markdown]
|
||||
spacy info [model] [--markdown]
|
||||
python -m spacy info [--markdown]
|
||||
python -m spacy info [model] [--markdown]
|
||||
|
||||
+table(["Argument", "Type", "Description"])
|
||||
+row
|
||||
|
@ -148,7 +148,7 @@ p
|
|||
| compatible version (if out of date) and the commands for updating.
|
||||
|
||||
+code(false, "bash", "$").
|
||||
spacy validate
|
||||
python -m spacy validate
|
||||
|
||||
+table(["Argument", "Type", "Description"])
|
||||
+row("foot")
|
||||
|
@ -165,7 +165,7 @@ p
|
|||
| chosen based on the file extension of the input file.
|
||||
|
||||
+code(false, "bash", "$", false, false, true).
|
||||
spacy convert [input_file] [output_dir] [--converter] [--n-sents]
|
||||
python -m spacy convert [input_file] [output_dir] [--converter] [--n-sents]
|
||||
[--morphology]
|
||||
|
||||
+table(["Argument", "Type", "Description"])
|
||||
|
@ -234,7 +234,9 @@ p
|
|||
| #[+api("cli#package") #[code package]] command.
|
||||
|
||||
+code(false, "bash", "$", false, false, true).
|
||||
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]
|
||||
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]
|
||||
|
||||
+table(["Argument", "Type", "Description"])
|
||||
+row
|
||||
|
@ -443,7 +445,7 @@ p
|
|||
| #[+api("cli#package") #[code package]] command.
|
||||
|
||||
+code(false, "bash", "$").
|
||||
spacy vocab [lang] [output_dir] [lexemes_loc] [vectors_loc]
|
||||
python -m spacy vocab [lang] [output_dir] [lexemes_loc] [vectors_loc]
|
||||
|
||||
+table(["Argument", "Type", "Description"])
|
||||
+row
|
||||
|
@ -488,7 +490,7 @@ p
|
|||
| is present in the model's pipeline.
|
||||
|
||||
+code(false, "bash", "$", false, false, true).
|
||||
spacy evaluate [model] [data_path] [--displacy-path] [--displacy-limit] [--gpu-id] [--gold-preproc]
|
||||
python -m spacy evaluate [model] [data_path] [--displacy-path] [--displacy-limit] [--gpu-id] [--gold-preproc]
|
||||
|
||||
+table(["Argument", "Type", "Description"])
|
||||
+row
|
||||
|
@ -546,10 +548,10 @@ p
|
|||
| your model into an installable archive file.
|
||||
|
||||
+code(false, "bash", "$", false, false, true).
|
||||
spacy package [input_dir] [output_dir] [--meta-path] [--create-meta] [--force]
|
||||
python -m spacy package [input_dir] [output_dir] [--meta-path] [--create-meta] [--force]
|
||||
|
||||
+aside-code("Example", "bash").
|
||||
spacy package /input /output
|
||||
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
|
||||
|
|
|
@ -310,7 +310,7 @@ export class ModelComparer {
|
|||
const genre = name.split('_')[1]; // extract genre from model name
|
||||
this.tpl.fill(`table-head${i}`, `${lang}_${name}`);
|
||||
this.tpl.get(`link${i}`).setAttribute('href', `/models/${lang}#${lang}_${name}`);
|
||||
this.tpl.fill(`download${i}`, `spacy download ${lang}_${name}\n`);
|
||||
this.tpl.fill(`download${i}`, `python -m spacy download ${lang}_${name}\n`);
|
||||
this.tpl.fill(`lang${i}`, this.languages[lang] || lang);
|
||||
this.tpl.fill(`type${i}`, this.labels[type] || type);
|
||||
this.tpl.fill(`genre${i}`, this.labels[genre] || genre);
|
||||
|
|
|
@ -54,7 +54,7 @@ include _includes/_mixins
|
|||
+grid
|
||||
+grid-col("two-thirds")
|
||||
+terminal("lightning_tour.py", "More examples", "/usage/spacy-101#lightning-tour").
|
||||
# Install: pip install spacy && spacy download en
|
||||
# Install: pip install spacy && python -m spacy download en
|
||||
import spacy
|
||||
|
||||
# Load English tokenizer, tagger, parser, NER and word vectors
|
||||
|
|
|
@ -13,7 +13,7 @@ p Using pip, spaCy releases are currently only available as source packages.
|
|||
| and available models, see the #[+a("/usage/models") docs on models].
|
||||
|
||||
+code.o-no-block.
|
||||
spacy download en
|
||||
python -m spacy download en
|
||||
|
||||
>>> import spacy
|
||||
>>> nlp = spacy.load('en')
|
||||
|
|
|
@ -27,4 +27,4 @@
|
|||
+qs({package: 'source'}) python setup.py build_ext --inplace
|
||||
|
||||
for _, model in MODELS
|
||||
+qs({model: model}) spacy download #{model}
|
||||
+qs({model: model}) python -m spacy download #{model}
|
||||
|
|
|
@ -5,16 +5,16 @@ p
|
|||
| #[+api("cli#download") #[code download]] command. It takes care of
|
||||
| finding the best-matching model compatible with your spaCy installation.
|
||||
|
||||
- var models = Object.keys(MODELS).map(function(lang) { return "spacy download " + lang })
|
||||
- var models = Object.keys(MODELS).map(function(lang) { return "python -m spacy download " + lang })
|
||||
+code(false, "bash").
|
||||
# out-of-the-box: download best-matching default model
|
||||
#{Object.keys(MODELS).map(function(l) {return "spacy download " + l}).join('\n')}
|
||||
#{Object.keys(MODELS).map(function(l) {return "python -m spacy download " + l}).join('\n')}
|
||||
|
||||
# download best-matching version of specific model for your spaCy installation
|
||||
spacy download en_core_web_sm
|
||||
python -m spacy download en_core_web_sm
|
||||
|
||||
# download exact model version (doesn't create shortcut link)
|
||||
spacy download en_core_web_sm-2.0.0 --direct
|
||||
python -m spacy download en_core_web_sm-2.0.0 --direct
|
||||
|
||||
p
|
||||
| The download command will #[+a("/usage/models#download-pip") install the model] via
|
||||
|
@ -25,7 +25,7 @@ p
|
|||
|
||||
+code(false, "bash").
|
||||
pip install spacy
|
||||
spacy download en
|
||||
python -m spacy download en
|
||||
|
||||
+code.
|
||||
import spacy
|
||||
|
|
|
@ -117,7 +117,7 @@ p
|
|||
| to mapping unicode aliases to file paths: symbolic links.
|
||||
|
||||
+code(false, "bash", "$").
|
||||
spacy link [package name or path] [shortcut] [--force]
|
||||
python -m spacy link [package name or path] [shortcut] [--force]
|
||||
|
||||
p
|
||||
| The first argument is the #[strong package name] (if the model was
|
||||
|
@ -127,10 +127,10 @@ p
|
|||
|
||||
+code("Examples", "bash").
|
||||
# set up shortcut link to load installed package as "en_default"
|
||||
spacy link en_core_web_md en_default
|
||||
python -m spacy link en_core_web_md en_default
|
||||
|
||||
# set up shortcut link to load local model as "my_amazing_model"
|
||||
spacy link /Users/you/model my_amazing_model
|
||||
python -m spacy link /Users/you/model my_amazing_model
|
||||
|
||||
+infobox("Important note")
|
||||
| In order to create a symlink, your user needs the #[strong required permissions].
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
+quickstart(QUICKSTART_MODELS, "Quickstart", "Install a default model, get the code to load it from within spaCy and an example to test it. For more options, see the section on available models below.")
|
||||
for models, lang in MODELS
|
||||
- var package = models[0]
|
||||
+qs({lang: lang}) spacy download #{lang}
|
||||
+qs({lang: lang}) python -m spacy download #{lang}
|
||||
+qs({lang: lang}, "divider")
|
||||
+qs({lang: lang, load: "module"}, "python") import #{package}
|
||||
+qs({lang: lang, load: "module"}, "python") nlp = #{package}.load()
|
||||
|
|
|
@ -7,8 +7,8 @@ p
|
|||
+h(3, "lightning-tour-models") Install models and process text
|
||||
|
||||
+code(false, "bash").
|
||||
spacy download en
|
||||
spacy download de
|
||||
python -m spacy download en
|
||||
python -m spacy download de
|
||||
|
||||
+code.
|
||||
import spacy
|
||||
|
|
|
@ -119,7 +119,7 @@ p
|
|||
| you need to download a larger model:
|
||||
|
||||
+code-wrapper
|
||||
+code-new(false, "bash", "$") spacy download en_core_web_lg
|
||||
+code-new(false, "bash", "$") python -m spacy download en_core_web_lg
|
||||
|
||||
p
|
||||
| Models that come with built-in word vectors make them available as the
|
||||
|
|
|
@ -209,8 +209,8 @@ p
|
|||
| installable Python package from your model.
|
||||
|
||||
+code(false, "bash").
|
||||
spacy convert /tmp/train.conllu /tmp/data
|
||||
spacy train en /tmp/model /tmp/data/train.json -n 5
|
||||
python -m spacy convert /tmp/train.conllu /tmp/data
|
||||
python -m spacy train en /tmp/model /tmp/data/train.json -n 5
|
||||
|
||||
+h(3, "training-simple-style") Simple training style
|
||||
+tag-new(2)
|
||||
|
|
|
@ -44,7 +44,7 @@ p
|
|||
}
|
||||
|
||||
+code(false, "bash").
|
||||
spacy package /home/me/data/en_example_model /home/me/my_models
|
||||
python -m spacy package /home/me/data/en_example_model /home/me/my_models
|
||||
|
||||
p This command will create a model package directory that should look like this:
|
||||
|
||||
|
@ -166,7 +166,7 @@ p
|
|||
| looks like this:
|
||||
|
||||
+code(false, "bash", "$", false, false, true).
|
||||
spacy train {lang} {models_dir}/{name} {train_data} {dev_data} -m meta/{name}.json -V {version} -g {gpu_id} -n {n_epoch} -ns {n_sents}
|
||||
python -m spacy train {lang} {models_dir}/{name} {train_data} {dev_data} -m meta/{name}.json -V {version} -g {gpu_id} -n {n_epoch} -ns {n_sents}
|
||||
|
||||
+aside-code("meta.json template", "json").
|
||||
{
|
||||
|
@ -185,7 +185,7 @@ p In a directory #[code meta], we keep #[code meta.json] templates for the indiv
|
|||
p On each epoch, the model is saved out with a #[code meta.json] using our template and added properties, like the #[code pipeline], #[code accuracy] scores and the #[code spacy_version] used to train the model. After training completion, the best model is selected automatically and packaged using the #[+api("cli#package") #[code package]] command. Since a full meta file is already present on the trained model, no further setup is required to build a valid model package.
|
||||
|
||||
+code(false, "bash").
|
||||
spacy package -f {best_model} dist/
|
||||
python -m spacy package -f {best_model} dist/
|
||||
cd dist/{model_name}
|
||||
python setup.py sdist
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ p
|
|||
+aside-code("Example", "bash")
|
||||
for _, lang in MODELS
|
||||
if lang != "xx"
|
||||
| spacy download #{lang} # default #{LANGUAGES[lang]} model!{'\n'}
|
||||
| spacy download xx_ent_wiki_sm # multi-language NER
|
||||
| python -m spacy download #{lang} # default #{LANGUAGES[lang]} model!{'\n'}
|
||||
| python -m spacy download xx_ent_wiki_sm # multi-language NER
|
||||
|
||||
p
|
||||
| spaCy v2.0 features new neural models for tagging,
|
||||
|
|
|
@ -7,7 +7,7 @@ p
|
|||
| notebook, the visualizations will be included as HTML.
|
||||
|
||||
+code("Jupyter Example").
|
||||
# don't forget to install a model, e.g.: spacy download en
|
||||
# don't forget to install a model, e.g.: python -m spacy download en
|
||||
import spacy
|
||||
from spacy import displacy
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ p
|
|||
| the website or company in a specific context.
|
||||
|
||||
+aside-code("Loading models", "bash", "$").
|
||||
spacy download en
|
||||
python -m spacy download en
|
||||
>>> import spacy
|
||||
>>> nlp = spacy.load('en')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user