|
|
|
--- |
|
license: llama3.2 |
|
base_model: meta-llama/Llama-3.2-3B-Instruct |
|
tags: |
|
- function-calling |
|
- llama3.2 |
|
- fine-tuned |
|
- lora |
|
language: |
|
- en |
|
--- |
|
|
|
# Llama 3.2 3B Function Calling Model |
|
|
|
This model is a fine-tuned version of [meta-llama/Llama-3.2-3B-Instruct](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct) for function calling tasks. |
|
|
|
## Model Details |
|
|
|
- **Base Model**: Llama 3.2 3B Instruct |
|
- **Fine-tuning Method**: LoRA (Low-Rank Adaptation) |
|
- **Dataset**: Salesforce/xlam-function-calling-60k (1000 samples) |
|
- **Training**: 2 epochs with learning rate 2e-5 |
|
|
|
## Usage |
|
|
|
```python |
|
from transformers import AutoTokenizer, AutoModelForCausalLM |
|
import torch |
|
|
|
model = AutoModelForCausalLM.from_pretrained("TurkishCodeMan/llama3.2-3b-intruct-function-calling") |
|
tokenizer = AutoTokenizer.from_pretrained("TurkishCodeMan/llama3.2-3b-intruct-function-calling") |
|
|
|
prompt = '''<|system|> |
|
Available functions: |
|
- get_weather: Gets current weather for a location |
|
|
|
GPT 4 Correct user: |
|
<|user|> |
|
What's the weather in Tokyo? |
|
GPT 4 correct assistant:''' |
|
|
|
inputs = tokenizer(prompt, return_tensors="pt") |
|
outputs = model.generate(**inputs, max_new_tokens=64, do_sample=False) |
|
print(tokenizer.decode(outputs[0], skip_special_tokens=True)) |
|
``` |
|
|
|
## Training Details |
|
|
|
- **Learning Rate**: 2e-5 |
|
- **Batch Size**: 2 (per device) |
|
- **Gradient Accumulation**: 8 steps |
|
- **LoRA Rank**: 8 |
|
- **LoRA Alpha**: 16 |
|
- **Target Modules**: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
|
|
|
## Performance |
|
|
|
The model demonstrates excellent function calling capabilities: |
|
- Correct function selection |
|
- Proper argument formatting |
|
- Professional response structure |
|
|