1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] install and run fairseq in google colab (ModuleNotFoundError: No module named...

Discussão em 'Python' iniciado por Stack, Setembro 15, 2025.

  1. Stack

    Stack Membro Participativo

    Until yesterday, we installed fairseq normally and executed it.

    An error called "ModuleNotFoundError: No module named 'fairseq'" suddenly occurred today.

    Does anyone know how to solve this?

    install fairseq...

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


    install log...

    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


    run...

    !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 \



    run log...

    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'

    Continue reading...

Compartilhe esta Página