|
|
--- |
|
|
license: mit |
|
|
tags: |
|
|
- llm |
|
|
- tinyllama |
|
|
- function-calling |
|
|
- question-answering |
|
|
- finetuned |
|
|
--- |
|
|
|
|
|
# TinyLlama Fine-tuned for Function Calling |
|
|
|
|
|
This is a fine-tuned version of the [TinyLlama](https://huggingface.co/jzhang38/TinyLlama) model optimized for function calling tasks. |
|
|
|
|
|
## Model Details |
|
|
|
|
|
- **Base Model**: [Successmove/tinyllama-function-calling-cpu-optimized](https://huggingface.co/Successmove/tinyllama-function-calling-cpu-optimized) |
|
|
- **Fine-tuning Data**: [Successmove/combined-function-calling-context-dataset](https://huggingface.co/datasets/Successmove/combined-function-calling-context-dataset) |
|
|
- **Training Method**: LoRA (Low-Rank Adaptation) |
|
|
- **Training Epochs**: 3 |
|
|
- **Final Training Loss**: ~0.05 |
|
|
|
|
|
## Usage |
|
|
|
|
|
```python |
|
|
from transformers import AutoTokenizer, AutoModelForCausalLM |
|
|
from peft import PeftModel |
|
|
|
|
|
# Load base model |
|
|
base_model_name = "Successmove/tinyllama-function-calling-cpu-optimized" |
|
|
model = AutoModelForCausalLM.from_pretrained(base_model_name) |
|
|
|
|
|
# Load the LoRA adapters |
|
|
model = PeftModel.from_pretrained(model, "path/to/this/model") |
|
|
|
|
|
# Load tokenizer |
|
|
tokenizer = AutoTokenizer.from_pretrained("path/to/this/model") |
|
|
|
|
|
# Generate text |
|
|
input_text = "Set a reminder for tomorrow at 9 AM" |
|
|
inputs = tokenizer(input_text, return_tensors="pt") |
|
|
outputs = model.generate(**inputs, max_new_tokens=100) |
|
|
response = tokenizer.decode(outputs[0], skip_special_tokens=True) |
|
|
``` |
|
|
|
|
|
## Training Details |
|
|
|
|
|
This model was fine-tuned using: |
|
|
- LoRA with r=8 |
|
|
- Learning rate: 2e-4 |
|
|
- Batch size: 4 |
|
|
- Gradient accumulation steps: 2 |
|
|
- 3 training epochs |
|
|
|
|
|
## Limitations |
|
|
|
|
|
This is a research prototype and may not be suitable for production use without further evaluation and testing. |
|
|
|
|
|
## License |
|
|
|
|
|
This model is licensed under the MIT License. |