-
Notifications
You must be signed in to change notification settings - Fork 1k
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
ValueError: PegasusXForConditionalGeneration does not support device_map='auto'. To implement support, the modelclass needs to implement the _no_split_modules attribute. #1900
Comments
cc @SunMarc |
Hi @andreeahedes , there are two ways to load a model with
with accelerate.init_empty_weights():
config = PegasusXConfig.from_pretrained(model_checkpoint)
model = PegasusXForConditionalGeneration.from_config(config)
model.tie_weights()
model = accelerate.load_checkpoint_and_dispatch(model, model_checkpoint, no_split_module_classes=["PegasusXDecoderLayer"]) However, you should better use the transformers integration of this feature because you might encounter some issues with the first method. This is because when we call
model = PegasusXForConditionalGeneration.from_pretrained(model_checkpoint, device_map="auto") If the |
Thank you for your quick response. Which accelerate tests should I run to check whether the _no_split_modules are functional? |
That's awesome that you are interested on implementing this =) . You need to make sure that 3 tests are functional. The tests are |
Hi, I found a combination that works and passes all 3 tests on a machine with 2 GPUs. I created a PR, it should be linked to this thread. |
Hi, I am using
Accelerate
version: 0.21.0. I am trying to implement disk/CPU offload with accelerate for a pretrained PegasusX-large model. Below is my implementation, using an "auto" device map to see if the accelerate would load the model with a map for which each layer has a device associated.On the second to last line, I get the following error: ValueError: PegasusXForConditionalGeneration does not support device_map='auto'. To implement support, the modelclass needs to implement the _no_split_modules attribute. This issue seems related to the implementation of the PegasusX model. How would one go about fixing it?
The text was updated successfully, but these errors were encountered: