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

Fine tuning LLM #70

Open
manisnesan opened this issue Mar 10, 2024 · 14 comments
Open

Fine tuning LLM #70

manisnesan opened this issue Mar 10, 2024 · 14 comments

Comments

@manisnesan
Copy link
Owner

https://lightning.ai/pages/community/finetuning-falcon-efficiently/

@manisnesan
Copy link
Owner Author

@manisnesan
Copy link
Owner Author

@manisnesan
Copy link
Owner Author

manisnesan commented Mar 10, 2024

Answer.ai post - You can train 70B param model using FSDP and QLora

  • scale resource-efficient QLoRA training across inexpensive gaming GPUs
    • will help bring more attention to the problem of bringing down the cost of model training.
  • It’s in everyone’s interest to make AI more accessible – and to enable more people to not only consume, but also build, valuable models.

@manisnesan
Copy link
Owner Author

manisnesan commented Mar 10, 2024

LoRA - Low rank adapters.
They are basically small matrices. Keeping the rest of the model as constant, only train these small matrices

Intent is everybody need to contribute to the creation of models

LoRA doesn’t train the whole large language model at all, but instead adds “adaptors”, which are very small matrices (generally smaller than 1% of the full model) that are trained, whilst keeping the rest of the model constant

Keeping the base model as quantized ( frozen during training) keep the adapters unquantized

Tim realized that LoRA can be combined with quantization: use a quantized base model, which is not changed at all by the training, and add trainable LoRA adaptors that are not quantized. This combination is QLoRA

@manisnesan
Copy link
Owner Author

PEFT

Parameter Efficient Fine Tuning- PEFT approaches enable you to get performance comparable to full fine-tuning while only having a small number of trainable parameters.

@manisnesan
Copy link
Owner Author

manisnesan commented Mar 29, 2024

Fine tune minimal expample using QLORA - Colab

@manisnesan
Copy link
Owner Author

manisnesan commented Apr 2, 2024

Fine tune using Unsloth with Colab
Examples

Very few lines of code + GPU poor friendly + Good performance

X post

image

@manisnesan
Copy link
Owner Author

manisnesan commented Apr 19, 2024

Fine tune your first LLM using torch tune

torch tune

Reference: https://github.com/pytorch/torchtune

Source : Andrej tweet

@manisnesan
Copy link
Owner Author

manisnesan commented Apr 21, 2024

Fine-tune Llama 3 with ORPO

image

  • introduced the ORPO algorithm and explained how it unifies the SFT and preference alignment stages into a single process.
  • used TRL to fine-tune a Llama 3 8B model on a custom preference dataset
  • final model shows encouraging results and highlights ORPO's potential as a new fine-tuning paradigm.

Source : Maxime labonne post & another post

image

image

@manisnesan
Copy link
Owner Author

ORPO slides

@manisnesan
Copy link
Owner Author

Fine tune a gpt2 model for spam classification

https://github.com/rasbt/LLMs-from-scratch/blob/main/ch06/01_main-chapter-code/ch06.ipynb

@manisnesan
Copy link
Owner Author

fine tune with axolotl

  • Fine tune with smaller sample
  • Fine tune with full dataset

@manisnesan
Copy link
Owner Author

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

1 participant