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

Circular import in transformers #1336

Closed
kno10 opened this issue Nov 25, 2023 · 2 comments · Fixed by #1337
Closed

Circular import in transformers #1336

kno10 opened this issue Nov 25, 2023 · 2 comments · Fixed by #1337

Comments

@kno10
Copy link
Contributor

kno10 commented Nov 25, 2023

See #1308 (comment)_

The transformers backend tries to import transformers.AutoModel, but shadows transformers with its own name.

@mudler
Copy link
Owner

mudler commented Nov 25, 2023

Correct, this fails locally here:

Running transformers...
bash run.sh
Traceback (most recent call last):
  File "/home/mudler/_git/LocalAI/backend/python/transformers/transformers.py", line 18, in <module>
    from transformers import AutoModel
  File "/home/mudler/_git/LocalAI/backend/python/transformers/transformers.py", line 18, in <module>
    from transformers import AutoModel
ImportError: cannot import name 'AutoModel' from partially initialized module 'transformers' (most likely due to a circular import) (/home/mudler/_git/LocalAI/backend/python/transformers/transformers.py)
make: *** [Makefile:10: run] Error 1

@mudler
Copy link
Owner

mudler commented Nov 25, 2023

good catch @kno10 , thanks!

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

Successfully merging a pull request may close this issue.

2 participants