Downloads · 30 days
0
kirubel1738/Llama-3.2-3B-Python-Finetuned-00
Llama-3.2-3B-Python-Finetuned-00 is a machine learning model from kirubel1738. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
This model is a fine-tuned version of LLaMA-3.2-3B-Instruct, optimized specifically for high-precision Python code generation. By training on structured instruction-code pairs, the model has been transformed from a ge…
Downloads · 30 days
0
Access
Public
Updated Feb 4, 2026
Repo size
53.9 MB
Likes
0
Public
Click a slice to open those files.
.safetensors36.7 MB · 68%
From the Hugging Face model README
This model is a fine-tuned version of LLaMA-3.2-3B-Instruct, optimized specifically for high-precision Python code generation. By training on structured instruction-code pairs, the model has been transformed from a general-purpose conversational assistant into a specialized tool that generates clean, concise Python code while minimizing conversational "chatter" and filler.
The model is intended for developers who need a lightweight, efficient Python code generator. It follows the Alpaca instruction format and is optimized to provide functional code directly without extensive tutorials or bulky docstrings.
camelCase due to dataset bias, rather than strictly following PEP 8 (snake_case)."n cannot be negative") instead of raising robust Python exceptions.Use the code below to run the model in 4-bit precision for maximum efficiency:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "kirubel1738/Llama-3.2-3B-Python-Finetuned-00"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
load_in_4bit=True
)
alpaca_prompt = """Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
{}
### Response:
"""
instruction = "Write a Python function to check if a number is prime."
prompt = alpaca_prompt.format(instruction)
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=150, temperature=0.7, do_sample=True)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))