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

ImportError: cannot import name 'metrics' from 'fairseq' (unknown location) #5

Closed
ouwen18 opened this issue Nov 29, 2023 · 6 comments
Closed

Comments

@ouwen18
Copy link

ouwen18 commented Nov 29, 2023

When I am training the decoder with audio, I encounter the following issue:

[2023-11-29 22:38:41,125][opensr.hubert_dataset][INFO] - pad_audio=True, random_crop=False, normalize=True, max_sample_size=500, seqs2seq data=True,
[2023-11-29 22:38:41,125][opensr.hubert_dataset][INFO] - Noise wav: /usr/zzs/data/mvlrs_v1/noise/babble/train.tsv->1 wav, Prob: 0.25, SNR: 0, Number of mixture: 1
[2023-11-29 22:38:42,169][fairseq.logging.progress_bar][WARNING] - tensorboard not found, please install with: pip install tensorboard
[2023-11-29 22:38:42,170][fairseq.trainer][INFO] - begin training epoch 1
[2023-11-29 22:38:42,171][fairseq_cli.train][INFO] - Start iterating over samples
0%| | 0/201 [00:00<?, ?it/s]Traceback (most recent call last):
File "", line 1, in
File "/home/aa/anaconda3/envs/openSR/lib/python3.8/multiprocessing/spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "/home/aa/anaconda3/envs/openSR/lib/python3.8/multiprocessing/spawn.py", line 125, in _main
prepare(preparation_data)
File "/home/aa/anaconda3/envs/openSR/lib/python3.8/multiprocessing/spawn.py", line 236, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "/home/aa/anaconda3/envs/openSR/lib/python3.8/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
File "/home/aa/anaconda3/envs/openSR/lib/python3.8/runpy.py", line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File "/home/aa/anaconda3/envs/openSR/lib/python3.8/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/home/aa/anaconda3/envs/openSR/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/aa/anaconda3/envs/openSR/bin/fairseq-hydra-train", line 5, in
from fairseq_cli.hydra_train import cli_main
File "/home/aa/OpenSR/fairseq/fairseq_cli/hydra_train.py", line 11, in
from fairseq_cli.train import main as pre_main
File "/home/aa/OpenSR/fairseq/fairseq_cli/train.py", line 30, in
from fairseq import (
File "/home/aa/OpenSR/fairseq/fairseq/checkpoint_utils.py", line 26, in
from fairseq.models import FairseqDecoder, FairseqEncoder
File "/home/aa/OpenSR/fairseq/fairseq/models/init.py", line 225, in
import_models(models_dir, "fairseq.models")
File "/home/aa/OpenSR/fairseq/fairseq/models/init.py", line 207, in import_models
importlib.import_module(namespace + "." + model_name)
File "/home/aa/anaconda3/envs/openSR/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/aa/OpenSR/fairseq/fairseq/models/wav2vec/init.py", line 6, in
from .wav2vec import * # noqa
File "/home/aa/OpenSR/fairseq/fairseq/models/wav2vec/wav2vec.py", line 25, in
from fairseq.tasks import FairseqTask
File "/home/aa/OpenSR/fairseq/fairseq/tasks/init.py", line 15, in
from .fairseq_task import FairseqTask, LegacyFairseqTask # noqa
File "/home/aa/OpenSR/fairseq/fairseq/tasks/fairseq_task.py", line 13, in
from fairseq import metrics, search, tokenizer, utils
ImportError: cannot import name 'metrics' from 'fairseq' (unknown location)
Traceback (most recent call last):
File "", line 1, in
File "/home/aa/anaconda3/envs/openSR/lib/python3.8/multiprocessing/spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "/home/aa/anaconda3/envs/openSR/lib/python3.8/multiprocessing/spawn.py", line 125, in _main
prepare(preparation_data)
File "/home/aa/anaconda3/envs/openSR/lib/python3.8/multiprocessing/spawn.py", line 236, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "/home/aa/anaconda3/envs/openSR/lib/python3.8/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
File "/home/aa/anaconda3/envs/openSR/lib/python3.8/runpy.py", line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File "/home/aa/anaconda3/envs/openSR/lib/python3.8/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/home/aa/anaconda3/envs/openSR/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/aa/anaconda3/envs/openSR/bin/fairseq-hydra-train", line 5, in
from fairseq_cli.hydra_train import cli_main
File "/home/aa/OpenSR/fairseq/fairseq_cli/hydra_train.py", line 11, in
from fairseq_cli.train import main as pre_main
File "/home/aa/OpenSR/fairseq/fairseq_cli/train.py", line 30, in
from fairseq import (
File "/home/aa/OpenSR/fairseq/fairseq/checkpoint_utils.py", line 26, in
from fairseq.models import FairseqDecoder, FairseqEncoder
File "/home/aa/OpenSR/fairseq/fairseq/models/init.py", line 225, in
import_models(models_dir, "fairseq.models")
File "/home/aa/OpenSR/fairseq/fairseq/models/init.py", line 207, in import_models
importlib.import_module(namespace + "." + model_name)
File "/home/aa/anaconda3/envs/openSR/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/aa/OpenSR/fairseq/fairseq/models/wav2vec/init.py", line 6, in
from .wav2vec import * # noqa
File "/home/aa/OpenSR/fairseq/fairseq/models/wav2vec/wav2vec.py", line 25, in
from fairseq.tasks import FairseqTask
File "/home/aa/OpenSR/fairseq/fairseq/tasks/init.py", line 15, in
from .fairseq_task import FairseqTask, LegacyFairseqTask # noqa
File "/home/aa/OpenSR/fairseq/fairseq/tasks/fairseq_task.py", line 13, in
from fairseq import metrics, search, tokenizer, utils
ImportError: cannot import name 'metrics' from 'fairseq' (unknown location)

@Exgc
Copy link
Owner

Exgc commented Nov 29, 2023

The package fairseq should have been installed with the command:

cd fairseq
pip install --editable ./

@ouwen18
Copy link
Author

ouwen18 commented Nov 29, 2023

I confirm that I have followed your instructions to install, but the issue still persists.

@ouwen18
Copy link
Author

ouwen18 commented Nov 29, 2023

Meanwhile, I noticed that in opensr/opensr_large_vox_audio.yaml, it indicates the need to input noise_wav, and it seems that this is not mentioned in the command line.

@Exgc
Copy link
Owner

Exgc commented Nov 29, 2023

@Exgc
Copy link
Owner

Exgc commented Nov 29, 2023

The problem with fairseq is supposed to be an issue when reproducing AV-Hubert, and I suggest you refer to its repository.

@ouwen18
Copy link
Author

ouwen18 commented Nov 30, 2023

Thank you for ur suggestion. I will try to solve these problems

@ouwen18 ouwen18 closed this as completed Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants