Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While finetuning xlsr_53_56k.pt I got this error #5289

Closed
Naramkeshav59 opened this issue Aug 19, 2023 · 5 comments
Closed

While finetuning xlsr_53_56k.pt I got this error #5289

Naramkeshav59 opened this issue Aug 19, 2023 · 5 comments

Comments

@Naramkeshav59
Copy link

Naramkeshav59 commented Aug 19, 2023

🐛 Bug

AttributeError: module 'importlib_resources' has no attribute 'is_resource'

To Reproduce

I ran this script which I have written:

#!/bin/bash

DISTRIBUTED_WORLD_SIZE=2

# Calculate optimization update frequency
OPTIMIZATION_UPDATE_FREQ=$((24 / DISTRIBUTED_WORLD_SIZE))

# Set your data and model paths
DATA_PATH="../vakyansh-wav2vec2-experimentation/data/finetuning"
W2V_MODEL_PATH="../vakyansh-wav2vec2-experimentation/checkpoints/pretraining/xlsr_53_56k.pt"

# Set the configuration directory and name
CONFIG_DIR="../vakyansh-wav2vec2-experimentation/config/finetuning/"
CONFIG_NAME="base_10h"

# Run the Fairseq training command
CUDA_VISIBLE_DEVICES=3 fairseq-hydra-train \
    distributed_training.distributed_world_size=$DISTRIBUTED_WORLD_SIZE \
    task.data=$DATA_PATH \
    +optimization.update_freq=[$OPTIMIZATION_UPDATE_FREQ] \
    model.w2v_path=$W2V_MODEL_PATH \
    --config-dir $CONFIG_DIR \
    --config-name $CONFIG_NAME

Error which I encountered

(xlsr53Keshav) iitdh-ms@iitd:/data/Sougata/Btech_intern$ ./finetune.sh
Traceback (most recent call last):
  File "/home/iitdh-ms/.local/bin/fairseq-hydra-train", line 8, in <module>
    sys.exit(cli_main())
  File "/home/iitdh-ms/.local/lib/python3.8/site-packages/fairseq_cli/hydra_train.py", line 87, in cli_main
    hydra_main()
  File "/home/iitdh-ms/.local/lib/python3.8/site-packages/hydra/main.py", line 32, in decorated_main
    _run_hydra(
  File "/home/iitdh-ms/.local/lib/python3.8/site-packages/hydra/_internal/utils.py", line 346, in _run_hydra
    run_and_report(
  File "/home/iitdh-ms/.local/lib/python3.8/site-packages/hydra/_internal/utils.py", line 201, in run_and_report
    raise ex
  File "/home/iitdh-ms/.local/lib/python3.8/site-packages/hydra/_internal/utils.py", line 198, in run_and_report
    return func()
  File "/home/iitdh-ms/.local/lib/python3.8/site-packages/hydra/_internal/utils.py", line 347, in <lambda>
    lambda: hydra.run(
  File "/home/iitdh-ms/.local/lib/python3.8/site-packages/hydra/_internal/hydra.py", line 100, in run
    cfg = self.compose_config(
  File "/home/iitdh-ms/.local/lib/python3.8/site-packages/hydra/_internal/hydra.py", line 505, in compose_config
    self.config_loader.ensure_main_config_source_available()
  File "/home/iitdh-ms/.local/lib/python3.8/site-packages/hydra/_internal/config_loader_impl.py", line 120, in ensure_main_config_source_available
    if not source.available():
  File "/home/iitdh-ms/.local/lib/python3.8/site-packages/hydra/_internal/core_plugins/importlib_resources_config_source.py", line 72, in available
    ret = resources.is_resource(self.path, "__init__.py")  # type:ignore
AttributeError: module 'importlib_resources' has no attribute 'is_resource'

list of modules with versions inside my envirionment:

Package                       Version
----------------------------- --------------------
absl-py                       1.4.0
alabaster                     0.7.13
antlr4-python3-runtime        4.8
appdirs                       1.4.4
apturl                        0.5.2
astunparse                    1.6.3
audeer                        1.18.0
audformat                     0.15.2
audinterface                  0.9.1
audiofile                     1.1.0
audobject                     0.7.5
audresample                   1.1.0
Babel                         2.12.1
bcrypt                        3.1.7
bitarray                      2.8.1
blinker                       1.4
Brlapi                        0.7.0
cachetools                    4.2.4
certifi                       2019.11.28
cffi                          1.15.1
chardet                       5.2.0
charset-normalizer            3.2.0
click                         8.1.6
cloudpickle                   2.2.1
cmake                         3.27.2
colorama                      0.4.3
command-not-found             0.3
cryptography                  2.8
cupshelpers                   1.0
cycler                        0.11.0
Cython                        3.0.0
dask                          2023.5.0
dbus-python                   1.2.16
defer                         1.0.6
distro                        1.4.0
distro-info                   1.0
docker-pycreds                0.4.0
docutils                      0.18.1
duplicity                     0.8.12.0
editdistance                  0.3.1
entrypoints                   0.3
fairseq                       0.12.2
fasteners                     0.14.1
filelock                      3.12.2
flatbuffers                   23.5.26
fonttools                     4.28.5
fsspec                        2023.6.0
future                        0.18.2
gast                          0.4.0
GDAL                          3.0.4
gitdb                         4.0.10
GitPython                     3.1.32
google-auth                   1.35.0
google-auth-oauthlib          0.4.6
google-pasta                  0.2.0
grpcio                        1.57.0
h5py                          3.9.0
httplib2                      0.14.0
Hydra                         2.5
hydra-core                    1.0.7
idna                          2.8
imagesize                     1.4.1
importlib                     1.0.4
importlib-metadata            6.8.0
importlib-resources           6.0.1
indic-nlp-library             0.92
iotop                         0.6
iso-639                       0.4.5
iso3166                       2.1.1
Jinja2                        3.1.2
jiwer                         3.0.2
joblib                        1.0.0
keras                         2.13.1
keyring                       18.0.1
kiwisolver                    1.3.2
language-selector             0.1
launchpadlib                  1.10.13
lazr.restfulclient            0.14.2
lazr.uri                      1.0.3
libclang                      16.0.6
lit                           16.0.6
locket                        1.0.0
lockfile                      0.12.2
louis                         3.12.0
lxml                          4.9.3
macaroonbakery                1.3.1
Mako                          1.1.0
Markdown                      3.4.4
MarkupSafe                    2.1.3
matplotlib                    3.5.1
monotonic                     1.5
Morfessor                     2.0.6
mpmath                        1.3.0
netifaces                     0.10.4
networkx                      3.1
numpy                         1.20.0
nvidia-cublas-cu11            11.10.3.66
nvidia-cuda-cupti-cu11        11.7.101
nvidia-cuda-nvrtc-cu11        11.7.99
nvidia-cuda-runtime-cu11      11.7.99
nvidia-cudnn-cu11             8.5.0.96
nvidia-cufft-cu11             10.9.0.58
nvidia-curand-cu11            10.2.10.91
nvidia-cusolver-cu11          11.4.0.1
nvidia-cusparse-cu11          11.7.4.91
nvidia-nccl-cu11              2.14.3
nvidia-nvtx-cu11              11.7.91
oauthlib                      3.1.0
olefile                       0.46
omegaconf                     2.0.6
opensmile                     2.4.1
oyaml                         1.0
packaging                     21.3
pandas                        1.2.2
paramiko                      2.6.0
partd                         1.4.0
pathtools                     0.1.2
pexpect                       4.6.0
Pillow                        7.0.0
pip                           23.2.1
portalocker                   2.7.0
progressbar2                  3.53.1
protobuf                      4.24.0
psutil                        5.9.5
pyasn1                        0.5.0
pyasn1-modules                0.3.0
pycairo                       1.16.2
pycparser                     2.21
pycups                        1.9.73
Pygments                      2.16.1
PyGObject                     3.36.0
PyJWT                         1.7.1
pymacaroons                   0.13.0
PyNaCl                        1.3.0
pyparsing                     3.0.6
pyRFC3339                     1.1
python-apt                    2.0.0+ubuntu0.20.4.6
python-dateutil               2.8.2
python-debian                 0.1.49
python-Levenshtein            0.12.2
python-utils                  3.7.0
pytz                          2022.2.1
pyxdg                         0.26
PyYAML                        6.0
rapidfuzz                     2.13.7
regex                         2023.8.8
reportlab                     3.5.34
requests                      2.31.0
requests-oauthlib             1.3.1
requests-unixsocket           0.2.0
rsa                           4.9
sacrebleu                     2.3.1
scikit-learn                  1.1.2
scipy                         1.9.1
screen-resolution-extra       0.0.0
SecretStorage                 2.3.1
sentry-sdk                    1.29.2
setproctitle                  1.3.2
setuptools                    45.2.0
simplejson                    3.16.0
six                           1.14.0
sklearn                       0.0
smmap                         5.0.0
snowballstemmer               2.2.0
soundfile                     0.12.1
sox                           1.4.1
Sphinx                        6.2.1
sphinx-argparse               0.4.0
sphinx-rtd-theme              1.2.2
sphinxcontrib-applehelp       1.0.4
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.1
sphinxcontrib-jquery          4.1
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
ssh-import-id                 5.10
swifter                       1.4.0
sympy                         1.12
systemd-python                234
tabulate                      0.9.0
tensorboard                   2.4.1
tensorboard-data-server       0.7.1
tensorboard-plugin-wit        1.8.1
tensorboardX                  2.1
tensorflow-io-gcs-filesystem  0.33.0
threadpoolctl                 3.1.0
toolz                         0.12.0
torch                         2.0.1
torchaudio                    2.0.2
torchvision                   0.15.2
tqdm                          4.56.0
triton                        2.0.0
typing_extensions             4.5.0
tzdata                        2023.3
ubuntu-advantage-tools        27.5
ubuntu-drivers-common         0.0.0
ufw                           0.36
unattended-upgrades           0.1
urllib3                       1.26.16
usb-creator                   0.3.7
wadllib                       1.3.3
wandb                         0.15.8
Werkzeug                      2.3.7
wheel                         0.34.2
wrapt                         1.15.0
xkit                          0.0.0
zipp                          3.8.1

Also while installing fairseq I encountered this:

DEPRECATION: omegaconf 2.0.6 has a non-standard dependency specifier PyYAML>=5.1.*. pip 23.3 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of omegaconf or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063

Hardware/Software info:

  • fairseq Version : 0.12.2
  • PyTorch Version : 2.0.1
  • OS : Linux
  • How you installed fairseq : using pip inside conda environment
  • Build command you used (if compiling from source): None
  • Python version: 3.10.12
  • CUDA/cuDNN version: NVIDIA-SMI 510.39.01 Driver Version: 510.39.01 CUDA Version: 11.6
  • GPU models and configuration: NVIDIA GeForce RTX 2080 Ti

Please help me resolve this.

@Naramkeshav59
Copy link
Author

updated hydra and omegaconf libraries and it is resolved. Because hydra had deprecated version on importlib-resources
It might say that fairseq requires some version of omegaconf and hydra. Ignore that because the fairseq is working fine.

closing this for now. If any issues related to this please feel free to reopen this issue.

@ShesterG
Copy link

ShesterG commented Nov 4, 2023

ran into this SAME exact issue and I updated hydra and omegaconf .
pip install --upgrade hydra omegaconf
But now the issue transfered to omegaconf. How exactly did you update and what was the new version of your hydra, emgaconf and importlib-resources

@Naramkeshav59
Copy link
Author

@ShesterG it is " hydra-core" not hydra. Try pip install --upgrade hydra-core omegaconf

@Sameep-c
Copy link

Hey, what were the final versions of your hydra, omegaconf and importlib-resources ? Fairseq isn't working with omegaconf>2.0.6

@Naramkeshav59
Copy link
Author

@Sameep-c

Try these steps, which I have documented for myself:

Steps to install fairseq:

CAUTION: always use "python -m pip" instead of "pip" otherwise it will install globally instead of just installing inside the environment.

  1. create and activate a conda environment with python version 3.9

    for example:
    conda create --name myEnv python=3.9 conda activate myEnv

CAUTION: always use "python -m pip" instead of "pip" inside the environment otherwise it will install globally instead of just installing inside the environment.

  1. install Pytorch with GPU support:

    python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cuXXX
    where 'XXX' is your CUDA version. for example, CUDA 11.6 has 'XXX' as 116. For checking which version you require based on your gpu, use-

    nvidia-smi

  2. clone fairseq repository and install editable:

    git clone https://github.com/pytorch/fairseq cd fairseq python -m pip install --editable ./

  3. upgrade hydra-core and numpy and tensorboard:

    python -m pip install --upgrade hydra-core numpy tensorboard

    Ignore any errors and warnings on dependencies after running this. ( warnings related to omegaconf will show up, but fairseq will work fine)

  4. install flashlight python bindings:
    python -m pip install flashlight-text flashlight-sequence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants