From 2e3d067a7bd06449974721c49365e4d92f92bc33 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Sun, 13 Sep 2020 19:29:06 +0200 Subject: [PATCH] Update docs [ci skip] --- website/docs/api/cli.md | 43 ++++++++++++++++++++++++++++++++++ website/docs/usage/projects.md | 12 +++++----- website/src/components/code.js | 4 ++-- 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/website/docs/api/cli.md b/website/docs/api/cli.md index 55e552e72..38574785c 100644 --- a/website/docs/api/cli.md +++ b/website/docs/api/cli.md @@ -14,6 +14,7 @@ menu: - ['evaluate', 'evaluate'] - ['package', 'package'] - ['project', 'project'] + - ['ray', 'ray'] --- spaCy's CLI provides a range of helpful commands for downloading and training @@ -1134,3 +1135,45 @@ $ python -m spacy project dvc [project_dir] [workflow] [--force] [--verbose] | `--verbose`, `-V` |  Print more output generated by DVC. ~~bool (flag)~~ | | `--help`, `-h` | Show help message and available arguments. ~~bool (flag)~~ | | **CREATES** | A `dvc.yaml` file in the project directory, based on the steps defined in the given workflow. | + +## ray {#ray new="3"} + +The `spacy ray` CLI includes commands for parallel and distributed computing via +[Ray](https://ray.io). + + + + + +To use this command, you need the +[`spacy-ray`](https://github.com/explosion/spacy-ray) package installed. +Installing the package will automatically add the `ray` command to the spaCy +CLI. + + + +### ray train {#ray-train tag="command"} + +Train a spaCy pipeline using [Ray](https://ray.io) for parallel training. The +command works just like [`spacy train`](/api/cli#train). + +```cli +$ python -m spacy ray train [config_path] [--code-path] [--strategy] [--n-workers] [--address] [--gpu-id] [--verbose] [overrides] +``` + +> #### Example +> +> ```cli +> $ python -m spacy ray train config.cfg --n-workers 2 +> ``` + +| Name | Description | +| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `config_path` | Path to [training config](/api/data-formats#config) file containing all settings and hyperparameters. ~~Path (positional)~~ | +| `--code`, `-c` | Path to Python file with additional code to be imported. Allows [registering custom functions](/usage/training#custom-functions) for new architectures. ~~Optional[Path] \(option)~~ | +| `--n-workers`, `-n` | The number of workers. Defaults to `1`. ~~int (option)~~ | +| `--address`, `-a` | Optional address of the Ray cluster. Defaults to `None`. ~~Optional[str] \(option)~~ | +| `--gpu-id`, `-g` | GPU ID or `-1` for CPU. Defaults to `-1`. ~~int (option)~~ | +| `--verbose`, `-V` | Display more information for debugging purposes. ~~bool (flag)~~ | +| `--help`, `-h` | Show help message and available arguments. ~~bool (flag)~~ | +| overrides | Config parameters to override. Should be options starting with `--` that correspond to the config section and value to override, e.g. `--paths.train ./train.spacy`. ~~Any (option/flag)~~ | diff --git a/website/docs/usage/projects.md b/website/docs/usage/projects.md index 81ddf40fb..e1bc247c8 100644 --- a/website/docs/usage/projects.md +++ b/website/docs/usage/projects.md @@ -796,11 +796,9 @@ workflows, including evaluation workflow that lets you compare two different models and their results. - + - - + --> --- @@ -943,12 +941,14 @@ your results. ![Screenshot: Parameter importance using config values](../images/wandb2.jpg 'Parameter importance using config values') + - + +--> diff --git a/website/src/components/code.js b/website/src/components/code.js index 5a7828a33..dd1eeb6d0 100644 --- a/website/src/components/code.js +++ b/website/src/components/code.js @@ -14,6 +14,7 @@ import GitHubCode from './github' import classes from '../styles/code.module.sass' const WRAP_THRESHOLD = 30 +const CLI_GROUPS = ['init', 'debug', 'project', 'ray'] export default props => (
@@ -99,7 +100,6 @@ function replacePrompt(line, prompt, isFirst = false) {
 }
 
 function parseArgs(raw) {
-    const commandGroups = ['init', 'debug', 'project']
     let args = raw.split(' ').filter(arg => arg)
     const result = {}
     while (args.length) {
@@ -108,7 +108,7 @@ function parseArgs(raw) {
             const isFlag = !args.length || (args[0].length > 1 && args[0].startsWith('-'))
             result[opt] = isFlag ? true : args.shift()
         } else {
-            const key = commandGroups.includes(opt) ? `${opt} ${args.shift()}` : opt
+            const key = CLI_GROUPS.includes(opt) ? `${opt} ${args.shift()}` : opt
             result[key] = null
         }
     }