Docker 容器不下载 Spacy 非英文模型

Docker container not downloading Spacy non-english models

我已经使用 spacy 构建了一个 docker 图像并安装了其他依赖项。我正在尝试使用 docker build 构建另一个图像,从现有图像中提取,它将包含非英语 spacy 模块。我正在使用 Docker 桌面来执行此操作。这是我的 docker 文件:

FROM docker/image:14jul2020
ENV http_proxy="http://internet.com:83"
ENV https_proxy="http://internet.com:83"

# spacy
RUN pip install spacy
RUN python -m spacy de_dep_news_trf
RUN python -m spacy pt_core_news_sm

但是,这段代码只有在开始下载非英文模块时才会出现错误。

Step 6/10 : RUN python -m spacy de_dep_news_trf
 ---> Running in b6de3cbe0490

    Unknown command: de_dep_news_trf
    Available: download, link, info, train, evaluate, convert, package,
    vocab, init-model, profile, validate

The command '/bin/sh -c python -m spacy de_dep_news_trf' returned a non-zero code: 1

我应该使用其他命令来下载这些依赖项吗?我需要任何特定版本支持吗?我只是无法弄清楚我在这里做错了什么。非常感谢任何指点。

Unknown command: de_dep_news_trf
Available: download, link, info, train, evaluate, convert, package,
vocab, init-model, profile, validate

错误已经告诉哪里错了,你的命令应该是:

python -m spacy download de_dep_news_trf

查看帮助:

# python -m spacy --help
Usage: python -m spacy [OPTIONS] COMMAND [ARGS]...

  spaCy Command-line Interface

  DOCS: https://spacy.io/api/cli

Options:
  --install-completion [bash|zsh|fish|powershell|pwsh]
                                  Install completion for the specified shell.
  --show-completion [bash|zsh|fish|powershell|pwsh]
                                  Show completion for the specified shell, to
                                  copy it or customize the installation.

  --help                          Show this message and exit.

Commands:
  convert   Convert files into json or DocBin format for training.
  debug     Suite of helpful commands for debugging and profiling.
  download  Download compatible trained pipeline from the default download...
  evaluate  Evaluate a trained pipeline.
  info      Print info about spaCy installation.
  init      Commands for initializing configs and pipeline packages.
  package   Generate an installable Python package for a pipeline.
  pretrain  Pre-train the 'token-to-vector' (tok2vec) layer of pipeline...
  project   Command-line interface for spaCy projects and templates.
  train     Train or update a spaCy pipeline.
  validate  Validate the currently installed pipeline packages and spaCy...