|
|
--- |
|
|
base_model: INSAIT-Institute/MamayLM-Gemma-3-4B-IT-v1.0 |
|
|
library_name: transformers |
|
|
model_name: MamayLM-function-calling |
|
|
tags: |
|
|
- generated_from_trainer |
|
|
- trl |
|
|
- sft |
|
|
licence: license |
|
|
license: gemma |
|
|
datasets: |
|
|
- NousResearch/hermes-function-calling-v1 |
|
|
language: |
|
|
- en |
|
|
- uk |
|
|
--- |
|
|
|
|
|
# Model Card for MamayLM-function-calling |
|
|
|
|
|
This model is a fine-tuned version of [INSAIT-Institute/MamayLM-Gemma-3-4B-IT-v1.0](https://huggingface.co/INSAIT-Institute/MamayLM-Gemma-3-4B-IT-v1.0). |
|
|
It has been trained using [TRL](https://github.com/huggingface/trl). |
|
|
|
|
|
## Evaluation |
|
|
This is the first iteration of fine-tuning MamayLM for function calling. In the future, we plan to add metrics and improve training. <br> |
|
|
During this phase new tokens (including tool_call) were introduced to the model and we evaluated how well it uses and understands the purpose of tool_call. <br> |
|
|
|
|
|
### Metrics |
|
|
- Accuracy in function calling (if response contains tool_call token) - ```find_longest_common_sequence_length(ground_truth_tokens, generated_tokens) / len(ground_truth_tokens)``` |
|
|
- Match in helpful exchange (if response does not contain tool_call token) - Computes the percentage of matching elements between generated tokens and ground truth tokens |
|
|
|
|
|
### Performance before fine-tuning: |
|
|
Accuracy in function calling: 0.38107 <br> |
|
|
Match in helpful exchange: 0.07440 <br> |
|
|
|
|
|
### Performance after fine-tuning: |
|
|
Accuracy in function calling: 0.95415 <br> |
|
|
Match in helpful exchange: 0.09937 <br> |
|
|
|
|
|
## Quick start |
|
|
|
|
|
```python |
|
|
from peft import PeftModel, PeftConfig |
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
|
|
|
|
peft_model_id = "TymofiiNasobko/MamayLM-function-calling" |
|
|
peftconfig = PeftConfig.from_pretrained(peft_model_id) |
|
|
model = AutoModelForCausalLM.from_pretrained( |
|
|
peftconfig.base_model_name_or_path, |
|
|
attn_implementation="eager", |
|
|
device_map=device, |
|
|
) |
|
|
tokenizer = AutoTokenizer.from_pretrained(peft_model_id) |
|
|
model.resize_token_embeddings(len(tokenizer)) |
|
|
model = PeftModel.from_pretrained(model, peft_model_id) |
|
|
model = model.to(compute_dtype) |
|
|
model = model.eval() |
|
|
``` |
|
|
|
|
|
## Training procedure |
|
|
This model was trained with SFT. |
|
|
|
|
|
### Framework versions |
|
|
|
|
|
- TRL: 0.25.0 |
|
|
- Transformers: 4.57.1 |
|
|
- Pytorch: 2.8.0+cu128 |
|
|
- Datasets: 4.4.1 |
|
|
- Tokenizers: 0.22.1 |
|
|
|
|
|
## Citations |
|
|
|
|
|
|
|
|
|
|
|
Cite TRL as: |
|
|
|
|
|
```bibtex |
|
|
@misc{vonwerra2022trl, |
|
|
title = {{TRL: Transformer Reinforcement Learning}}, |
|
|
author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec}, |
|
|
year = 2020, |
|
|
journal = {GitHub repository}, |
|
|
publisher = {GitHub}, |
|
|
howpublished = {\url{https://github.com/huggingface/trl}} |
|
|
} |
|
|
``` |