Skip to content
Projets

abacaj/fine-tune-mistral

Voir sur GitHub

À propos

Affinez Mistral-7B sur des GPU 3090, A100 et H100.

Autres projets

Comment ces chiffres sont mesurés

Progression mesurée des étoiles

in 24h
+1
in 7 days
0
in 15 days
0
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

fine-tune-mistral

Code used to fine-tune this model: abacaj/mistral-7b-sft. Add your data in the data folder as train.jsonl and validation.jsonl.

Note this repo is intended for full fine-tuning of mistral not qlora or other methods.

How to run

Install dependencies:

python -m venv env \
  && source env/bin/activate \
  && pip install -r requirements.txt

Get a Hugging Face token and set the variable:

export HF_TOKEN="[insert token here]"

Run training code:

torchrun --nnodes=1 --nproc-per-node=<REPLACE_WITH_NUMBER_OF_GPUS> train.py

Tips

  • If running with a small batch size, lower the learning rate
  • I did not have to adjust grad clip or weight_decay but YMMV
  • Use enough data, I recommend > 1k samples
  • I ran this for 3 epochs on 40k samples, will need to experiment more on epochs because the model was still improving.
  • The better way to tell if your model is improving or just overfitting or even getting worse, you should add evaluation on your task. This is data that is not part of training. For example, on code completion you can evaluate your model on the mbpp validation set or a custom set you have.
  • Use FSDP option: backward_prefetch=BackwardPrefetch.BACKWARD_PRE if you have the GPU memory, or backward_prefetch=BackwardPrefetch.BACKWARD_POST. This can cause OOM so it was set to None

Explorer des projets similaires

Chargement…