python 安装变压器笔记本的基本要求时出错

fjnneemd  于 2023-05-27  发布在  Python
关注(0)|答案(2)|浏览(151)

我在一个项目上工作,需要从变压器笔记本一些安装,这是我运行谷歌可乐的代码

!git clone https://github.com/nlp-with-transformers/notebooks.git

import os
os.chdir("/content/notebooks")

from install import *
install_requirements()

下面是错误:

remote: Enumerating objects: 515, done.
remote: Counting objects: 100% (161/161), done.
remote: Compressing objects: 100% (39/39), done.
remote: Total 515 (delta 139), reused 126 (delta 122), pack-reused 354
Receiving objects: 100% (515/515), 28.61 MiB | 16.21 MiB/s, done.
Resolving deltas: 100% (246/246), done.
⏳ Installing base requirements ...
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-1-926abb3f024d> in <cell line: 10>()
      8 
      9 from install import *
---> 10 install_requirements()

/content/notebooks/install.py in install_requirements(is_chapter2, is_chapter6, is_chapter7, is_chapter7_v2, is_chapter10, is_chapter11)
     29     process_install = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     30     if process_install.returncode != 0:
---> 31         raise Exception("😭 Failed to install base requirements")
     32     else:
     33         print("✅ Base requirements installed!")

Exception: 😭 Failed to install base requirements

我试着分开代码行,但无法弄清楚。

k7fdbhmy

k7fdbhmy1#

根据您正在阅读的章节,在Colab中执行以下操作:

! pip install -r https://github.com/nlp-with-transformers/notebooks/blob/main/requirements.txt

当你读到第7章的时候,你还需要这个:

! pip install -r https://github.com/nlp-with-transformers/notebooks/blob/main/requirements-chapter7-v2.txt
deyfvvtc

deyfvvtc2#

更新提示:

!pip install --upgrade pip

然后,再次运行安装代码。
在install.py文件中,您可以在变量requirements下找到所需软件包的列表。您可以通过运行!pip install <package-name>单独安装这些软件包。

相关问题