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

AutoModel.from_pretrained without accelerate raises a NameError because init_empty_weights is not available #37311

Closed
LoicGrobol opened this issue Apr 5, 2025 · 8 comments

Comments

@LoicGrobol
Copy link

LoicGrobol commented Apr 5, 2025

d1b92369ca193 introduced a call to init_empty_weights that leads to an error if accelerate is not installed. This should be guarded by a condition that accelerate is available (one already guards the import, but not the actual call).

@LoicGrobol LoicGrobol changed the title AutoModel.from_pretrained without accelerate leads to error AutoModel.from_pretrained without accelerate raises a NameError becuase init_empty_weights is not available Apr 5, 2025
@chn-lee-yumi
Copy link

same, this problem is introduced in 4.50.3->4.51.0

@samuelan
Copy link

samuelan commented Apr 6, 2025

downgrade to transformers=4.49.0 solved my problem

@LoicGrobol LoicGrobol changed the title AutoModel.from_pretrained without accelerate raises a NameError becuase init_empty_weights is not available AutoModel.from_pretrained without accelerate raises a NameError because init_empty_weights is not available Apr 6, 2025
@LoicGrobol
Copy link
Author

@samuelan installing accelerate is a better solution imo but still, that's a bug.

@ArthurZucker
Copy link
Collaborator

Yep accelerate should be installed, we will fix that ASAP sorry all !

@vladiliescu
Copy link

vladiliescu commented Apr 7, 2025

This hurts especially in inference-only cases. I'm using sentence-transformers (pinned version) to compute embeddings, and this morning my builds started failing for no good reason. We have no need to install accelerate, and I'm not referencing transformers directly.

But, simply instantiating a SentenceTransformer calls the magic line, and everything fails.

Velascat added a commit to Velascat/Zonos-API that referenced this issue Apr 7, 2025
PeterD1524 added a commit to PeterD1524/WasmEdge that referenced this issue Apr 7, 2025
…nsorType change in WasmEdge#4069

install transformers==4.50.3 for chattts as a workaround for huggingface/transformers#37311

Signed-off-by: PeterD1524 <[email protected]>
@jarandaf
Copy link

jarandaf commented Apr 7, 2025

same here @vladiliescu

PeterD1524 added a commit to PeterD1524/WasmEdge that referenced this issue Apr 7, 2025
…or TensorType change in WasmEdge#4069

install transformers==4.50.3 for chattts as a workaround for huggingface/transformers#37311

Signed-off-by: PeterD1524 <[email protected]>
PeterD1524 added a commit to PeterD1524/WasmEdge that referenced this issue Apr 7, 2025
…r TensorType change in WasmEdge#4069

install transformers==4.50.3 for chattts as a workaround for huggingface/transformers#37311

Signed-off-by: PeterD1524 <[email protected]>
@ArthurZucker
Copy link
Collaborator

Closing as this was fixed on main #37337

@ArthurZucker
Copy link
Collaborator

Sorry everyone this was not planned

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

6 participants