This repository contains code for fine-tuning the LLama3 8b model using Alpaca prompts to generate Java codes. The code is based on a Google Colab notebook.
The provided notebook demonstrates how to fine-tune the LLama3 8b model for generating Java codes using Alpaca prompts. It utilizes the unsloth
library for language model operations and the Hugging Face Transformers library for training and inference tasks.
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
!pip install --no-deps "xformers<0.0.26" trl peft accelerate bitsandbytes
- Load the LLama3 8b model with pre-defined settings.
- Format prompts using Alpaca prompt template and load the dataset.
- Train the model using the provided dataset and Huggingface TRL's
SFTTrainer
.
- Run inference on the trained model by providing an instruction and input. Leave the output blank for generation.
- Optionally, use a
TextStreamer
for continuous inference to see the generation token by token.
- Save the final model with LoRA adapters for inference.
- Load the saved LoRA adapters for inference if needed.
- Adjust parameters and settings as per your requirements.
- Ensure to replace placeholder file paths with actual paths in the notebook.
Contributions are always welcome! Please create a PR to add Github Profile. Feel free to explore and modify the provided notebook as needed for your Java code generation tasks!
This project is licensed under MIT license.
Give a ⭐️ if this project helped you!