python - 在 google colab 中安装并运行 fairseq(ModuleNotFo

到昨天为止,我们正常安装fairseq并执行。

今天突然出现一个名为“ModuleNotFoundError: No module named 'fairseq'”的错误。

有人知道怎么解决吗?

安装fairseq...

!git clone https://private_information.../fairseq.git
%cd /content/fairseq/fairseq-master/
!git reset --hard dafault
!pip install --editable ./
%cd /content

安装日志...

Cloning into 'fairseq'...
remote: Enumerating objects: 669, done.
remote: Counting objects: 100% (669/669), done.
remote: Compressing objects: 100% (520/520), done.
remote: Total 669 (delta 164), reused 635 (delta 130), pack-reused 0
Receiving objects: 100% (669/669), 2.95 MiB | 16.17 MiB/s, done.
Resolving deltas: 100% (164/164), done.
/content/fairseq/fairseq-master
HEAD is now at 16bea6e default
Obtaining file:///content/fairseq/fairseq-master
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... done
Collecting sacrebleu
  Downloading https://files.pythonhosted.org/packages/23/d3/be980ad7cda7c4bbfa97ee3de062fb3014fc1a34d6dd5b82d7b92f8d6522/sacrebleu-1.4.13-py3-none-any.whl (43kB)
     |████████████████████████████████| 51kB 2.0MB/s 
Requirement already satisfied: cffi in /usr/local/lib/python3.6/dist-packages (from fairseq==0.9.0) (1.14.2)
Requirement already satisfied: tqdm in /usr/local/lib/python3.6/dist-packages (from fairseq==0.9.0) (4.41.1)
Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from fairseq==0.9.0) (1.18.5)
Requirement already satisfied: torch in /usr/local/lib/python3.6/dist-packages (from fairseq==0.9.0) (1.6.0+cu101)
Requirement already satisfied: regex in /usr/local/lib/python3.6/dist-packages (from fairseq==0.9.0) (2019.12.20)
Requirement already satisfied: cython in /usr/local/lib/python3.6/dist-packages (from fairseq==0.9.0) (0.29.21)
Collecting portalocker
  Downloading https://files.pythonhosted.org/packages/89/a6/3814b7107e0788040870e8825eebf214d72166adf656ba7d4bf14759a06a/portalocker-2.0.0-py2.py3-none-any.whl
Requirement already satisfied: pycparser in /usr/local/lib/python3.6/dist-packages (from cffi->fairseq==0.9.0) (2.20)
Requirement already satisfied: future in /usr/local/lib/python3.6/dist-packages (from torch->fairseq==0.9.0) (0.16.0)
Installing collected packages: portalocker, sacrebleu, fairseq
  Running setup.py develop for fairseq
Successfully installed fairseq portalocker-2.0.0 sacrebleu-1.4.13
/content

运行...

!python /content/fairseq/fairseq-master/fairseq_cli/train.py \
    /data_dir \
    --arch transformer_align --share-all-embeddings \
    --optimizer adam --adam-betas '(0.9, 0.98)' --clip-norm 0.0 --activation-fn relu\
    --lr 0.0007 --lr-scheduler inverse_sqrt --warmup-updates 4000 --warmup-init-lr 1e-07 \
    --dropout 0.3 --attention-dropout 0.1 --weight-decay 0.0\
    --max-tokens 3500 --label-smoothing 0.1 \
    --save-dir /save_dir/ --log-interval 200 --max-epoch 20 \
    --keep-interval-updates -1 --save-interval-updates 0 --criterion label_smoothed_cross_entropy \
    --update-freq 8 \
   

运行日志...

Traceback (most recent call last):
  File "/content/fairseq/fairseq-master/fairseq_cli/train.py", line 20, in <module>
    from fairseq import (
ModuleNotFoundError: No module named 'fairseq'

最佳答案

使用以下方式安装它: pip 安装 fairseq 不要使用 github。

关于python - 在 google colab 中安装并运行 fairseq(ModuleNotFoundError : No module named 'fairseq' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63664092/

相关文章:

azure-functions - Azure 函数的 ILogger.LogMetric 未

mysql - 如何使用 SQLAlchemy 为 RDS 代理设置 TLS

react-native - 如何使选项卡栏图标的溢出在 React Native 中可点击?

python - 改变 pytorch 中的优化器势头

react-native - 在 React Native 中访问 DOM 元素

reactjs - 如何阻止 useEffect 每次都重新加载我的页面?

java - CMAKE-COMPILE 在 hadoop-hdfs-native 客户端中失败

firebase - 在哪里可以找到 Firebase 部署错误日志?

post - ESP32 异步 Web 服务器 POST 方法不起作用

python - 为什么在 Python 3.x 中的循环中使用 list() 会返回内存错误?