尝试安装 Transformer 4.27 时编译 tokenizers 包时出错

问题描述 投票:0回答:1
  • 使用

    chatglm-6b
    需要安装
    transformers==4.27.1

  • 我正在尝试安装

    transformers==4.27.1
    ,但在编译
    tokenizers
    包期间遇到错误,这导致无法成功构建 Wheel 文件。错误消息表明
    cargo rustc
    命令失败并返回代码 101。 这是完整的错误消息:

pip install -v transformers==4.27.1

....

error: `cargo rustc --lib --message-format=json-render-diagnostics --manifest-path Cargo.toml --release -v --features pyo3/extension-module --crate-type cdylib -- -C 'link-args=-undefined dynamic_lookup -Wl,-install_name,@rpath/tokenizers.cpython-312-darwin.so'` failed with code 101
  error: subprocess-exited-with-error
  
  × Building wheel for tokenizers (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /Users/dragonfang/****/venv_agi/bin/python3.12 /Users/dragonfang/****/venv_agi/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /var/folders/ll/9dtz3vg150vfv8t75ppq_nr00000gn/T/tmpymy6ke0d
  cwd: /private/var/folders/ll/9dtz3vg150vfv8t75ppq_nr00000gn/T/pip-install-tz2dgt67/tokenizers_11ac58d2069c4ec1985eae0d4528f0ec
  Building wheel for tokenizers (pyproject.toml) ... error
  ERROR: Failed building wheel for tokenizers
Failed to build tokenizers
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (tokenizers)

如何解决这个问题?


补充:

我尝试了上面两个链接中的一些方法,但都没有解决我的问题。

  • rustc 1.72.1
    版本太低,无法构建clap_lex v0.7.2包,因为它需要rustc 1.74或更高版本。
  • transformers==4.34.0
    不再需要安装Rust编译器,但是出现错误:
    AttributeError: 'ChatGLMTokenizer' object has no attribute 'sp_tokenizer'
  • transformers==4.33.2
    需要安装Rust编译器,错误为:
    cargo rustc --lib --message-format=json-render-diagnostics --manifest-path Cargo.toml --release -v --features pyo3/extension-module --crate-type cdylib -- -C 'link-args=-undefined dynamic_lookup -Wl,-install_name,@rpath/tokenizers.cpython-312-darwin.so' failed with code 101.
artificial-intelligence huggingface-transformers large-language-model
1个回答
0
投票

ChatGPT
建议
You can try using Python 3.10 or 3.11 to see if the issue is resolved
。由于我的Python版本是3.12.5,所以我降级到3.11.9并重新运行
pip install
。这样就成功解决了问题。

© www.soinside.com 2019 - 2024. All rights reserved.