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

Model Parallelism with SFTTrainer #1094

Closed
pharringtonp19 opened this issue Dec 14, 2023 · 4 comments
Closed

Model Parallelism with SFTTrainer #1094

pharringtonp19 opened this issue Dec 14, 2023 · 4 comments

Comments

@pharringtonp19
Copy link

Perhaps this isn't the right place to ask this question, but what's the easiest way to setup model parallelism using SFTTrainer?

My understanding is that if we have access to a multi-gpu workstation, the default is data parallelism. However, I would be interested in comparing run times to model parallelism.

Thanks!

@younesbelkada
Copy link
Contributor

hi @pharringtonp19
You can do model sequential parallelism with accelerate, simply load your model by passing device_map="auto" in from_pretrained. Note this is different from pipeline parallelism or model parallelism in the sense that the operations are going to be sequential, i.e. the layer n-1 will be kept idle while the layer n will be performing computation

@pharringtonp19
Copy link
Author

@younesbelkada Thanks! Is this the most efficient way to train across a cluster of small & old gpus (2080Ti)? I usually run out of memory.

@lvwerra
Copy link
Member

lvwerra commented Dec 21, 2023

In addition to using PEFT (quantization + LoRA) I would consider looking into DeepSpeed. It's fully supported with accelerate and allows you to shard the model over many GPUs and even offload to CPUs if you still run out of memory.

@pharringtonp19
Copy link
Author

@lvwerra Thanks for the suggestion!

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

3 participants