codelion/Llama-3.2-1B-Instruct-tool-calling-lora
5
8 commits
2 linked in READMEs
updated Jul 18, 2025
This LoRA adapter enhances meta-llama/Llama-3.2-1B-Instruct with tool calling capabilities for code exploration and manipulation. Trained using a hybrid Magpie + real execution approach on diverse coding scenarios.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# Load base model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
"meta-llama/Llama-3.2-1B-Instruct",
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B-Instruct")
# Load tool calling LoRA adapter
model = PeftModel.from_pretrained(model, "codelion/Llama-3.2-1B-Instruct-tool-calling-lora")
# Example: Use with tool calling prompt
prompt = '''You have access to the following tools:
- list_directory: List contents of a directory
- search_files: Search for files containing specific content
- read_file: Read a single file's contents
- get_file_info: Get file metadata
User: Help me understand how user authentication works in this Flask application
Response:
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
The model will generate tool calling sequences in OpenAI format:
{
"tool_calls": [
{
"id": "call_1",
"type": "function",
"function": {
"name": "search_files",
"arguments": "{\"query\": \"auth\", \"file_types\": [\".py\"]}"
}
},
{
"id": "call_2",
"type": "function",
"function": {
"name": "read_file",
"arguments": "{\"path\": \"app.py\"}"
}
}
]
}
The model is trained to use these development tools:
list_directory: Browse project structure
path (directory to list)search_files: Find files containing specific content
query, path, file_types, regexread_file: Read complete file contents
path (file to read)read_multiple_files: Read multiple files at once
paths (list of files)get_file_info: Get file metadata
path (file or directory)create_file: Create new files (if safety mode disabled)
path, contentedit_file: Modify existing files (if safety mode disabled)
path, changeslist_directory to understand structuresearch_files to find relevant filesread_multiple_files for related filesThe adapter was evaluated on diverse coding scenarios:
Most frequently used tools during evaluation:
This adapter is part of the Ellora project - standardized recipes for enhancing LLM capabilities.
8 commits
codelion/Llama-3.2-1B-Instruct-tool-calling-lora
5
8 commits
2 linked in READMEs
updated Jul 18, 2025
This LoRA adapter enhances meta-llama/Llama-3.2-1B-Instruct with tool calling capabilities for code exploration and manipulation. Trained using a hybrid Magpie + real execution approach on diverse coding scenarios.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# Load base model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
"meta-llama/Llama-3.2-1B-Instruct",
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B-Instruct")
# Load tool calling LoRA adapter
model = PeftModel.from_pretrained(model, "codelion/Llama-3.2-1B-Instruct-tool-calling-lora")
# Example: Use with tool calling prompt
prompt = '''You have access to the following tools:
- list_directory: List contents of a directory
- search_files: Search for files containing specific content
- read_file: Read a single file's contents
- get_file_info: Get file metadata
User: Help me understand how user authentication works in this Flask application
Response:
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
The model will generate tool calling sequences in OpenAI format:
{
"tool_calls": [
{
"id": "call_1",
"type": "function",
"function": {
"name": "search_files",
"arguments": "{\"query\": \"auth\", \"file_types\": [\".py\"]}"
}
},
{
"id": "call_2",
"type": "function",
"function": {
"name": "read_file",
"arguments": "{\"path\": \"app.py\"}"
}
}
]
}
The model is trained to use these development tools:
list_directory: Browse project structure
path (directory to list)search_files: Find files containing specific content
query, path, file_types, regexread_file: Read complete file contents
path (file to read)read_multiple_files: Read multiple files at once
paths (list of files)get_file_info: Get file metadata
path (file or directory)create_file: Create new files (if safety mode disabled)
path, contentedit_file: Modify existing files (if safety mode disabled)
path, changeslist_directory to understand structuresearch_files to find relevant filesread_multiple_files for related filesThe adapter was evaluated on diverse coding scenarios:
Most frequently used tools during evaluation:
This adapter is part of the Ellora project - standardized recipes for enhancing LLM capabilities.
8 commits