【问题标题】:Using transformers-cli on Windows?在 Windows 上使用 transformers-cli?
【发布时间】:2020-08-18 02:42:53
【问题描述】:

我不知道如何在 Windows 上使用 transformers-cli。我让它在 Google Colab 上运行,同时也在使用它。

[编辑]

这是我正在经历的过程、我的期望以及正在发生的事情:

我使用的是 Windows 系统(括号是我在 CMD 中输入的确切命令)

  1. 我安装了 transformers==2.8.0(pip install tr​​ansformers==2.8.0)
  2. 我尝试按照 Huggingface 的网站 (transformers-cli) https://huggingface.co/transformers/model_sharing.html 中的说明运行 transformers-cli

我明白了:

'transformers-cli' is not recognized as an internal or external command,
operable program or batch file.

我不知道我是否必须在我的 PATH 中添加一些目录,或者 CLI 在 Windows 上不可用?

我在 Google Colab 上重复了完全相同的过程,它按预期工作。我明白了:

usage: transformers-cli <command> [<args>]

positional arguments:
  {convert,download,env,run,serve,login,whoami,logout,s3,upload}
                        transformers-cli command helpers
    convert             CLI tool to run convert model from original author
                        checkpoints to Transformers PyTorch checkpoints.
    run                 Run a pipeline through the CLI
    serve               CLI tool to run inference requests through REST and
                        GraphQL endpoints.
    login               Log in using the same credentials as on huggingface.co
    whoami              Find out which huggingface.co account you are logged
                        in as.
    logout              Log out
    s3                  {ls, rm} Commands to interact with the files you
                        upload on S3.
    upload              Upload a model to S3.

optional arguments:
  -h, --help            show this help message and exit

【问题讨论】:

  • 请提供minimal reproducible example,说明您正在尝试做什么。还包括你的transformers 包的一个版本。
  • @dennlinger 我已经更新了这个问题。希望对您有所帮助?

标签: huggingface-transformers


【解决方案1】:

您所要做的就是找到脚本并启动它。它不会自动添加到 $PATH 中。在我在 Windows 10 上安装的 python 解释器(不是 anaconda 只是 python)中,它安装在我的 python 解释器目录的 Scripts 文件夹中。据我所知,您必须使用 python 解释器作为 windows 启动它,不支持 Shebangs。

cd YOURPYTHONINTERPRETERDIRECTORY\Scripts
python.exe transformers-cli login

您可以将macro 定义为快捷方式transformers-cli。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-11-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-26
    • 2017-02-06
    • 2021-09-17
    相关资源
    最近更新 更多