bababoi_test / README.md
fkarnagi's picture
LoRA fine-tuned TinyLlama
2854316 verified
|
Raw History Blame Contribute Delete
2.52 kB
---
base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
library_name: peft
pipeline_tag: text-generation
tags:
- base_model:adapter:TinyLlama/TinyLlama-1.1B-Chat-v1.0
- lora
- transformers
license: apache-2.0
language:
- en
---
# bababoi_test
A fine-tuned version of [TinyLlama/TinyLlama-1.1B-Chat-v1.0](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0) using LoRA (Low-Rank Adaptation) on a small instruction-following dataset.
## Model Details
| Property | Value |
|----------|-------|
| **Base Model** | [TinyLlama/TinyLlama-1.1B-Chat-v1.0](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0) |
| **Fine-tuning Method** | LoRA (Low-Rank Adaptation) |
| **LoRA Rank** | 16 |
| **LoRA Alpha** | 16 |
| **Trainable Parameters** | ~12.6M (1.13% of total) |
| **Dataset Size** | 20 instruction-following examples |
| **Training Epochs** | 10 |
| **Learning Rate** | 2e-4 |
| **Hardware** | Apple M4 GPU (MPS) |
## Training Details
This model was trained on a tiny Alpaca-format dataset covering basic factual Q&A, grammar, translation, and simple arithmetic. It is intended as a **tutorial/demo** for learning fine-tuning workflows rather than production use.
### Training Scripts
- `train.py` — Python training script with LoRA + HuggingFace Trainer
- `inference.py` — Interactive inference script
- `train_cli.sh` / `infer_cli.sh` — Shell wrappers
## How to Use
### Load the LoRA Adapter
```python
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
adapter = "fkarnagi/bababoi_test"
model = AutoModelForCausalLM.from_pretrained(base_model, torch_dtype="auto")
model = PeftModel.from_pretrained(model, adapter)
tokenizer = AutoTokenizer.from_pretrained(adapter)
```
### Inference
```python
prompt = "What is the capital of France?"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=64)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
## Limitations
- Trained on only 20 examples — will overfit and memorize answers
- Not suitable for production or real-world tasks
- Designed for educational purposes only
## Acknowledgements
- Base model: [TinyLlama/TinyLlama-1.1B-Chat-v1.0](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0)
- Fine-tuning framework: [HuggingFace PEFT](https://github.com/huggingface/peft)
- Training tutorial: [Unsloth](https://github.com/unslothai/unsloth)
### Framework versions
- PEFT 0.19.1