Model Card for gemma_function_calling_and_thinking
This model is a fine-tuned version of meta-llama/Llama-3.2-3B-Instruct. It has been trained using TRL.
Quick start
from peft import PeftModel
from transformers import AutoModelForCausalLM
from peft import AutoPeftModelForCausalLM
from transformers import AutoTokenizer
import torch
peft_model_id = "Abdulvajid/Llama_Qlora_Reasoning_ToolCalling_Finetuned_4Bit"
model = AutoPeftModelForCausalLM.from_pretrained(peft_model_id,
torch_dtype=torch.float16,
device_map='cuda',
load_in_4bit=True)
tokenizer = AutoTokenizer.from_pretrained(peft_model_id)
tools = [
{
"type": "function",
"function": {
"name": "search_restaurants",
"description": "Search for restaurants in a specific location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The location to search for restaurants"
},
"cuisine": {
"type": "string",
"description": "The cuisine type to filter the restaurants"
},
"price_range": {
"type": "integer",
"description": "The price range of the restaurants (1 = cheap to 4 = very expensive)"
}
},
"required": ["location"]
}
}
}
]
messages=[
{"role": "user", "content": "I'm in Malappuram, can you find a restaurant for me?"}
]
prompt = tokenizer.apply_chat_template(
messages,
tools=tools,
add_generation_prompt=True,
tokenize=True,
return_tensors="pt"
).to('cuda')
output = model.generate(prompt, max_new_tokens=500)
print(''.join(tokenizer.batch_decode(output[0][len(prompt[0]):])))
Training procedure
This model was trained with SFT.
Framework versions
- TRL: 0.19.1
- Transformers: 4.53.1
- Pytorch: 2.6.0+cu124
- Datasets: 4.0.0
- Tokenizers: 0.21.2
Citations
Cite TRL as:
@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}}
}
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
๐
Ask for provider support
Model tree for Abdulvajid/Llama_Qlora_Reasoning_ToolCalling_Finetuned_4Bit
Base model
meta-llama/Llama-3.2-3B-Instruct