|
|
--- |
|
|
license: mit |
|
|
language: |
|
|
- en |
|
|
library_name: transformers |
|
|
tags: |
|
|
- shakespeare |
|
|
- chatbot |
|
|
- tinyllama |
|
|
- fine-tuned |
|
|
- conversational |
|
|
base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0 |
|
|
pipeline_tag: text-generation |
|
|
--- |
|
|
|
|
|
# TinyLlama Shakespeare Chatbot |
|
|
|
|
|
A conversational AI that speaks in authentic Shakespearean English. |
|
|
|
|
|
## Model Description |
|
|
|
|
|
Fine-tuned on Shakespeare's complete works (42,000+ lines) transformed into 8,000+ chat-style training examples. |
|
|
|
|
|
**Capabilities:** |
|
|
- Compose sonnets on any topic |
|
|
- Engage in dramatic dialogue |
|
|
- Respond in Shakespearean style |
|
|
- Generate poetry and monologues |
|
|
|
|
|
**This is a MERGED model** - works directly with transformers, no PEFT needed! |
|
|
|
|
|
## Usage |
|
|
|
|
|
`python |
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
|
import torch |
|
|
|
|
|
model = AutoModelForCausalLM.from_pretrained( |
|
|
"Akash-nath29/tinyllamashakespeare", |
|
|
torch_dtype=torch.float16, |
|
|
device_map="auto" |
|
|
) |
|
|
tokenizer = AutoTokenizer.from_pretrained("Akash-nath29/tinyllamashakespeare") |
|
|
|
|
|
# Generate text |
|
|
inputs = tokenizer("To be or not to be", return_tensors="pt") |
|
|
outputs = model.generate(**inputs, max_length=200) |
|
|
print(tokenizer.decode(outputs[0])) |
|
|
` |
|
|
|
|
|
## Training Details |
|
|
|
|
|
| Parameter | Value | |
|
|
|-----------|-------| |
|
|
| Base Model | TinyLlama-1.1B-Chat-v1.0 | |
|
|
| Method | LoRA + QLoRA (4-bit) | |
|
|
| LoRA Rank | 16 | |
|
|
| LoRA Alpha | 32 | |
|
|
| Target Modules | q_proj, k_proj, v_proj, o_proj | |
|
|
| Training Examples | 8,000+ conversations | |
|
|
| Max Length | 512 tokens | |
|
|
| Epochs | 3 | |
|
|
|
|
|
## Hardware |
|
|
|
|
|
- GPU: NVIDIA GeForce RTX 3050 Laptop GPU |
|
|
- Training Time: ~4 hours |
|
|
|
|
|
## Developed By |
|
|
|
|
|
[Akash Nath](https://github.com/Akash-nath29) |
|
|
|
|
|
## Repository |
|
|
|
|
|
[GitHub - TinyLlamaShakespeare](https://github.com/Akash-nath29/TinyLlamaShakespeare) |
|
|
|
|
|
## License |
|
|
|
|
|
MIT License
|
|
|
|