Skip to content

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

Open
PierpaoloSorbellini wants to merge 42 commits into
mainfrom
refactor
Open

Refactor of models and trainers with base class for common methods#306
PierpaoloSorbellini wants to merge 42 commits into
mainfrom
refactor

Conversation

@PierpaoloSorbellini

@PierpaoloSorbellini PierpaoloSorbellini commented Mar 27, 2023

Copy link
Copy Markdown
Collaborator
  • 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.

@diegofiori diegofiori left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

Comment thread apps/accelerate/chatllama/artifacts/config/config.yaml Outdated
Comment thread apps/accelerate/chatllama/artifacts/config/config.yaml Outdated
Comment thread apps/accelerate/chatllama/artifacts/config/config.yaml Outdated
Comment thread apps/accelerate/chatllama/artifacts/download_dataset.py Outdated
Comment thread apps/accelerate/chatllama/artifacts/download_dataset.py Outdated
Comment thread apps/accelerate/chatllama/chatllama/rlhf/actor.py Outdated
# pytorch mixed precison
with torch.autocast(
device_type=self.config.device_type,
dtype=torch.float16,

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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)

Comment thread apps/accelerate/chatllama/chatllama/rlhf/actor.py
Comment thread apps/accelerate/chatllama/chatllama/rlhf/config.py
Comment thread apps/accelerate/chatllama/chatllama/rlhf/config.py
@diegofiori

Copy link
Copy Markdown
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