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

Get LoRA script to work for single gpus #35

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

k8tems
Copy link

@k8tems k8tems commented Feb 15, 2024

This is my first pull request in 7 yrs or something so apologies in advance if I do anything wrong.
Currently, train_c_lora.py does not support training with single GPUs as doing so will fail with missing environment variables or calls to torch.distributed.barrier() which (I think) is supposed to only work in multi-gpu environments.
(e.g.) #28 #17
This pull request will will make some modifications to add single gpu support.

@k8tems
Copy link
Author

k8tems commented Feb 15, 2024

I added an additional boolean parameter to the script that represents whether to use a single gpu or not.
Not sure if this is the best way to go.

train/base.py Outdated
def save_checkpoints(self, models: Models, optimizers: Optimizers, suffix=None):
barrier()
def save_checkpoints(self, models: Models, optimizers: Optimizers, suffix=None, single_gpu=False):
if single_gpu:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be 'if not single_gpu:'?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's fixed in this commit.
c00a449

Copy link

@rlucatoor rlucatoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great for me, good job

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

Successfully merging this pull request may close these issues.

3 participants