I am trying to set up hugging face locally and im running into this issue.
NameError: name 'init_empty_weights' is not defined
Here is the code I have tested my installation with
from transformers import pipeline
classifier = pipeline("sentiment-analysis")
text = "I love using Hugging Face Transformers!"
result = classifier(text)
print(result)
transformers: 4.51.0
tokenizers: 0.21.1
accelerate: 1.6.0
sentence-transformers: 4.0.2
huggingface_hub: 0.30.1
I am currently using pytorch-metal mac M3 pro.
What causes this, and how can I fix it?
I have the same issue. The issue is related to https://github.com/huggingface/transformers/pull/37337
In my case, installing accelerate fix the issue, as the workaround.
pip install accelerate
Try using this version, it should resolve the issue.
transformers==4.50.3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With