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

Refactor of models and trainers with base class for common methods #306

Open
wants to merge 42 commits into
base: main
Choose a base branch
from

Conversation

PierpaoloSorbellini
Copy link
Collaborator

@PierpaoloSorbellini PierpaoloSorbellini commented Mar 27, 2023

  • Refactor models and trainers to avoid code replication.
  • Added logs with loguru package.
  • Fix logs with MultiGPU trainers.
  • Added support for LoRA with PEFT library.
  • Added support for load_8bit option with HF models.
  • Added self-instruct dataset of HF.
  • Added CerebrasGPT and Decapoda LLaMA models from HF.
  • Added mixed-precision training to reduce GPU memory requirements.
  • Fixed RLHF KL divergence equation.
  • Added support to keep only the last n checkpoints for all training.
  • Added generation of negative examples when creating the reward dataset to improve the quality of the reward model.
  • Improved stability of MultiGPU training with both Accelerate form HF and DeepSpeed.

Copy link
Collaborator

@diegofiori diegofiori left a comment

Choose a reason for hiding this comment

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

LGTM!

apps/accelerate/chatllama/artifacts/config/config.yaml Outdated Show resolved Hide resolved
apps/accelerate/chatllama/artifacts/config/config.yaml Outdated Show resolved Hide resolved
apps/accelerate/chatllama/artifacts/config/config.yaml Outdated Show resolved Hide resolved
apps/accelerate/chatllama/artifacts/download_dataset.py Outdated Show resolved Hide resolved
apps/accelerate/chatllama/artifacts/download_dataset.py Outdated Show resolved Hide resolved
apps/accelerate/chatllama/chatllama/rlhf/actor.py Outdated Show resolved Hide resolved
# pytorch mixed precison
with torch.autocast(
device_type=self.config.device_type,
dtype=torch.float16,
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need to auto-cast to fp16 all the tensors? Shouldn't this be a config param?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

just following documentation...
https://pytorch.org/docs/stable/notes/amp_examples.html
wrt to casting manually the tensors, this is better with less problem with types in the embedding.
It is not a config param because if you do not use fp16 you would use fp32 and is probably worse.
not seen the point of adding the option for fp32.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But what if I want to train the model in fp32 precision? (DeepSpeed for instance allows the user to select the precision)

@diegofiori
Copy link
Collaborator

@PierpaoloSorbellini please add a description of what this PR is adding in terms of features and which bugs it is fixing.

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.

2 participants