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 #249

Closed
huangjy-pku opened this issue Sep 25, 2022 · 5 comments
Closed

ImportError #249

huangjy-pku opened this issue Sep 25, 2022 · 5 comments

Comments

@huangjy-pku
Copy link

Hello, I followed the instructions in huggingface to use OFA model, but it turned out to be an surprising error saying:
ImportError: cannot import name 'OFAModel' from 'transformers'.

I guess it is because I didn't install the customized version of transformers right, which should have incorporated OFAModel and OFATokenizer. But I have not done anything apart from your instructions:

git clone --single-branch --branch feature/add_transformers https://github.com/OFA-Sys/OFA.git
pip install OFA/transformers/

Could you please help me figure it out why this happens? Is there something I miss in the preparation steps?

@JustinLin610
Copy link
Member

Maybe you should uninstall the transformers and follow our instructions to install the customized one? Or you can try with the colab notebook for comparison

@huangjy-pku
Copy link
Author

I did uninstall and re-install transformers. But it kept the same failure. I would check your colab notebook. Could you tell me where it is?

@sarath-mutnuru
Copy link

@huangjy-pku
Copy link
Author

Sorry, I mean, the huggingface version, rather than fairseq version. And as said in instructions, it is about the add_transformers branch of the repo.

@huangjy-pku
Copy link
Author

I just figured it out. It is because the dependency on DL framework (e.g., PyTorch) when using transformers. Thanks anyway :) Closing.

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