Closed nilsjohanbjorck closed 1 month ago
Hey @nilsjohanbjorck, you can just do the following one liner to load your model :
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
It will do the same thing. I think that the error in your snippet is that you need to use AutoModelForCausalLM
instead.
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
System Info
Information
Tasks
no_trainer
script in theexamples
folder of thetransformers
repo (such asrun_no_trainer_glue.py
)Reproduction
I am following the example in https://huggingface.co/docs/accelerate/v0.31.0/en/package_reference/big_modeling#accelerate.load_checkpoint_and_dispatch. The code is
I get this error message
Expected behavior
should not crash