Pirate-Language LLM โš“๏ธ

Quantization & Fine-Tuning TinyLlama on a 50k+ Instruction Dataset

๐Ÿ“– Project Overview

This project demonstrates fine-tuning and quantization of the TinyLlama model on a custom dataset of 50k+ instruction-response pairs. The objective was to train a model capable of converting standard English queries into pirate-style responses.

The project highlights how resource-constrained environments (like 4GB GPUs) can still be used effectively to fine-tune large language models using parameter-efficient fine-tuning (LoRA) and quantization (BitsAndBytes).

โœจ Key Features

Dataset: 50k+ instruction-response pairs formatted into JSONL for supervised fine-tuning.

Model: TinyLlama fine-tuned with LoRA adapters.

Quantization: 4-bit quantization using BitsAndBytes for reduced memory usage.

Training:

Locally on NVIDIA GTX 1650 (4GB VRAM).

Scaled up to Google Colab T4 (16GB VRAM) for large dataset training.

Optimizations:

Gradient checkpointing

Cosine learning rate scheduler

Mixed precision (bfloat16)

Checkpoint Management: Saved models on Google Drive and Hugging Face Hub to mitigate Colabโ€™s 12-hour GPU session limits.

๐Ÿš€ Tech Stack

Languages/Frameworks: Python, PyTorch

Libraries: Hugging Face Transformers, TRL, PEFT, LoRA, BitsAndBytes

Compute: CUDA, cuDNN, Google Colab, Local GPU (GTX 1650)

๐Ÿ“‚ Repository Structure Pirate-Language-LLM/ โ”‚โ”€โ”€ data/ # Dataset files (JSONL format) โ”‚โ”€โ”€ notebooks/ # Jupyter notebooks for experiments โ”‚โ”€โ”€ scripts/ # Training and evaluation scripts โ”‚โ”€โ”€ checkpoints/ # Saved model checkpoints โ”‚โ”€โ”€ README.md # Project documentation โ”‚โ”€โ”€ requirements.txt # Dependencies

๐Ÿ”ง Setup & Installation

Clone the repository:

git clone https://github.com/yourusername/Pirate-Language-LLM.git cd Pirate-Language-LLM

Install dependencies:

pip install -r requirements.txt

Download dataset (or use your own):

from datasets import load_dataset dataset = load_dataset("json", data_files="pirate_data_large.jsonl")

Fine-tune the model:

python scripts/train.py

๐Ÿ“Š Results

Successfully fine-tuned TinyLlama to translate English into pirate-style text.

Achieved stable training on both local GPU (4GB) and Colab T4 (16GB).

Demonstrated practical quantization + LoRA fine-tuning workflow on limited compute.

๐Ÿ”ฎ Future Work

Extend the approach to Indian languages, building a voice-to-text and text-to-voice model with Indian accent support.

Pre-quantize larger multilingual models and fine-tune on diverse datasets.

Enable real-time conversational systems with efficient deployment on constrained hardware.

๐Ÿ“Ž Model & Resources

Hugging Face Model Link (replace with your link)

๐Ÿค Contribution

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.

๐Ÿ“œ License

This project is licensed under the MIT License.

Downloads last month
5
Safetensors
Model size
1B params
Tensor type
F32
ยท
F16
ยท
U8
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for ydvdhrj/Pirate-LLM

Quantized
(121)
this model