Downloads · 30 days
10
40% of all-time downloads
shettynavisha25/tinyllama-alpaca-finetuned
tinyllama-alpaca-finetuned is a text generation model from shettynavisha25. Use it when you need the model to write or continue text. It is set up for peft.
This is a fine-tuned version of TinyLlama/TinyLlama-1.1B-Chat-v1.0 trained on the Alpaca dataset for improved instruction-following capabilities.
Downloads · 30 days
10
40% of all-time downloads
All-time downloads
25
Public
Repo size
82.3 MB
Likes
0
Public
Click a slice to open those files.
.safetensors18 MB · 83%
From the Hugging Face model README
This is a fine-tuned version of TinyLlama/TinyLlama-1.1B-Chat-v1.0 trained on the Alpaca dataset for improved instruction-following capabilities.
This model is designed for instruction-following tasks and can:
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"TinyLlama/TinyLlama-1.1B-Chat-v1.0",
device_map="auto"
)
# Load fine-tuned adapter
model = PeftModel.from_pretrained(
base_model,
"shettynavisha25/tinyllama-alpaca-finetuned"
)
tokenizer = AutoTokenizer.from_pretrained("TinyLlama/TinyLlama-1.1B-Chat-v1.0")
# Format your prompt
prompt = """### Instruction:
Write a haiku about artificial intelligence
### Response:
"""
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_length=150, temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
### Instruction:
Explain quantum computing in simple terms
### Response:
### Instruction:
Write a Python function to calculate fibonacci numbers
### Response:
The model was fine-tuned on the Stanford Alpaca dataset, which contains 52,002 instruction-response pairs generated using OpenAI's text-davinci-003 model. The dataset covers diverse tasks including:
| Hyperparameter | Value |
|---|---|
| Learning rate | 2e-4 |
| Batch size | 4 |
| Gradient accumulation steps | 4 |
| Effective batch size | 16 |
| Number of epochs | 3 |
| Max sequence length | 512 |
| Optimizer | paged_adamw_8bit |
| Learning rate schedule | Linear warmup (100 steps) |
| Weight decay | 0 |
| Warmup steps | 100 |
The model achieved a final training loss of 1.14 after 3 epochs, showing consistent improvement throughout training:
Compared to the base TinyLlama model, this fine-tuned version demonstrates:
This model should not be used for:
If you use this model, please cite:
@misc{tinyllama-alpaca-finetuned,
author = {Navisha Shetty},
title = {TinyLlama-1.1B Alpaca Fine-tuned},
year = {2025},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/shettynavisha25/tinyllama-alpaca-finetuned}}
}
@article{zhang2024tinyllama,
title={TinyLlama: An Open-Source Small Language Model},
author={Zhang, Peiyuan and Guangtao, Zeng and Wang, Tianduo and Lu, Wei},
journal={arXiv preprint arXiv:2401.02385},
year={2024}
}
@misc{alpaca,
author = {Rohan Taori and Ishaan Gulrajani and Tianyi Zhang and Yann Dubois and Xuechen Li and Carlos Guestrin and Percy Liang and Tatsunori B. Hashimoto},
title = {Stanford Alpaca: An Instruction-following LLaMA model},
year = {2023},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/tatsu-lab/stanford_alpaca}},
}
For questions or issues, please open an issue on the model repository or contact [[email protected]].
Note: This model is released for research and educational purposes. Please use responsibly and be aware of its limitations.