在安装transformers 4.27时编译tokenizers包时出现错误

  • 使用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 tokenizersFailed to build tokenizersERROR: 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.

回答:

ChatGPT建议

你可以尝试使用Python 3.10或3.11,看看问题是否解决

由于我的Python版本是3.12.5,我降级到了3.11.9并重新运行了pip install。这成功解决了问题。

我注意到Gemini 1.5 Flash只建议我更新Rust和Cargo,而GPT-4o mini还提到了Python版本的问题。我之前一直在使用Gemini,看来我应该在未来更多地比较这两个模型。

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注