<commit_before>//- 💫 DOCS > API > TOP-LEVEL > COMMAND LINE INTERFACE

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-1.2.0]).

+code(false, "bash", "$").
    spacy download [model] [--direct]

+table(["Argument", "Type", "Description"])
    +row
        +cell #[code model]
        +cell positional
        +cell Model name or shortcut (#[code en], #[code de], #[code vectors]).

    +row
        +cell #[code --direct], #[code -d]
        +cell flag
        +cell Force direct download of exact model version.

    +row
        +cell #[code --help], #[code -h]
        +cell flag
        +cell Show help message and available arguments.

+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.

+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", "$").
    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.

+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").
    spacy info [--markdown]
    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 --help], #[code -h]
        +cell flag
        +cell Show help message and available arguments.

+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. Prints a list of models, the installed versions, the latest
    |  compatible version (if out of date) and the commands for updating.

+code(false, "bash", "$").
    spacy validate

+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 right converter is chosen based on the file extension of
    |  the input file. Currently only supports #[code .conllu].

+code(false, "bash", "$", false, false, true).
    spacy convert [input_file] [output_dir] [--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 --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.

+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).
    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
        +cell #[code lang]
        +cell positional
        +cell Model language.

    +row
        +cell #[code output_dir]<commit_msg>Update spacy convert CLI docs<commit_after>//- 💫 DOCS > API > TOP-LEVEL > COMMAND LINE INTERFACE

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-1.2.0]).

+code(false, "bash", "$").
    spacy download [model] [--direct]

+table(["Argument", "Type", "Description"])
    +row
        +cell #[code model]
        +cell positional
        +cell Model name or shortcut (#[code en], #[code de], #[code vectors]).

    +row
        +cell #[code --direct], #[code -d]
        +cell flag
        +cell Force direct download of exact model version.

    +row
        +cell #[code --help], #[code -h]
        +cell flag
        +cell Show help message and available arguments.

+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.

+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", "$").
    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.

+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").
    spacy info [--markdown]
    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 --help], #[code -h]
        +cell flag
        +cell Show help message and available arguments.

+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. Prints a list of models, the installed versions, the latest
    |  compatible version (if out of date) and the commands for updating.

+code(false, "bash", "$").
    spacy validate

+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).
    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.

p The following 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).
    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
        +cell #[code lang]
        +cell positional
        +cell Model language.

    +row
        +cell #[code output_dir]
{'fraction_non_alphanumeric': 0.12207499295179025, 'fraction_numerical': 0.0023259092190583593, 'mean_word_length': 2.693128578865174, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6866444', 'n_tokens_mistral': 4282, 'n_tokens_neox': 4247, 'n_words': 1698}