This notebook guides through fine-tuning a pre-trained language model from the Hugging Face model hub on the "Alpaca" dataset using the Transformer library. Originally trained on "Llama" data, the goal is to make the model generate suitable responses for the Alpaca dataset.
- Installed necessary packages (
transformers
,accelerate
,peft
,bitsandbytes
,trl
). - Loads the "Alpaca" dataset using
load_dataset
. - Defines a base language model (
NousResearch/Llama-2-7b-chat-hf
) and sets training parameters. - Fine-tunes the model on the "Alpaca" dataset using
SFTTrainer
. - Shows the model's text generation capability by providing prompts and generating responses.
- Saves the fine-tuned model and tokenizer locally for later use.
- Pushes the saved model to the Hugging face model hub for wider access.