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

Import stt is not working! #46

Open
gauravgund opened this issue Mar 31, 2021 · 7 comments
Open

Import stt is not working! #46

gauravgund opened this issue Mar 31, 2021 · 7 comments

Comments

@gauravgund
Copy link

gauravgund commented Mar 31, 2021

Hi @mailong25 @SenriYoshikawa ,

I am able to train acoustic model and Kenlm but when i am trying to import stt for transcribing, I am getting the following error in the self-supervised-speech-recognition directory.

Error


ImportError Traceback (most recent call last)
in ()
1 get_ipython().magic('cd /content/self-supervised-speech-recognition')
----> 2 import stt

/content/self-supervised-speech-recognition/stt.py in ()
7 import numpy as np
8 import torch
----> 9 from fairseq import checkpoint_utils, options, progress_bar, tasks, utils
10 from fairseq.data.data_utils import post_process
11 from fairseq.logging.meters import StopwatchMeter, TimeMeter

ImportError: cannot import name 'checkpoint_utils' from 'fairseq' (unknown location)

I tried importing fairseq in the directory i.e. /content/self-supervised-speech-recognition/libs/fairseq and it is working fine. Kindly help me with the work-around for this conflict in the directories. Regards

@mailong25
Copy link
Owner

Are you using the right fairseq git checkpoint?

git clone https://github.com/pytorch/fairseq.git
cd fairseq
git checkout c8a0659be5cdc15caa102d5bbf72b872567c4859
pip install --editable ./
cd ..

@gauravgund
Copy link
Author

Yes

@gauravgund
Copy link
Author

gauravgund commented Mar 31, 2021 via email

@mailong25
Copy link
Owner

mailong25 commented Mar 31, 2021

Make sure the followings are correct:

  • you install the fairseq correctly, which means you can import the lib from any directory.
  • the fairseq dir is not located in the same directory with stt.py
  • You calling the "from stt import Transcriber" under "self-supervised-speech-recognition" directory.

@gauravgund
Copy link
Author

gauravgund commented Mar 31, 2021

hi,

I have installed Fairseq successfully!
2) I can't import Fairseq from any directory but only when i am inside fairseq directory
3) I am calling "from stt import Transcriber" under "self-supervised-speech-recognition" directory but i am getting the error """" ImportError: cannot import name 'Transcriber' from 'stt' (/content/self-supervised-speech-recognition/stt.py)""""
4) Note that i have to make changes to the stt.py files which are as follows:

from fairseq.fairseq import checkpoint_utils, options, progress_bar, tasks, utils
from fairseq.fairseq.data.data_utils import post_process
from fairseq.fairseq.logging.meters import StopwatchMeter, TimeMeter

This is because when i am following your instructions, the folder structure is fairseq>fairseq>checkpoint_utils and so on.

image

Could you please check my script:

https://github.com/gauravgund/gauravgund/blob/master/wav2vec_fairseq__finetuning.ipynb

@luiyen
Copy link

luiyen commented Jul 3, 2021

@mailong25 @gauravgund got the same issue, but it works fine after restarted. We can close it now.

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

3 participants