Downloads · 30 days
0
Abdul1102/llama32-1b-python-docstrings-qlora
llama32-1b-python-docstrings-qlora is a machine learning model from Abdul1102. 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.
A parameter-efficiently fine-tuned adapter on top of meta-llama/Llama-3.2-1B-Instruct for generating concise one-line Python docstrings from function bodies.
Downloads · 30 days
0
Access
Public
Updated Nov 17, 2025
Repo size
62.3 MB
Likes
1
Public
Click a slice to open those files.
.safetensors45.1 MB · 72%
From the Hugging Face model README
A parameter-efficiently fine-tuned adapter on top of meta-llama/Llama-3.2-1B-Instruct for generating concise one-line Python docstrings from function bodies.
meta-llama/Llama-3.2-1B-Instruct (Meta Llama 3.2 Community License)meta-llama/Llama-3.2-1B-InstructThe model is trained to take a Python function definition and generate a concise, one-line docstring describing what the function does.
Typical usage pattern:
Example with 🤗 Transformers and PEFT (LoRA adapter):
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
base_model_id = "meta-llama/Llama-3.2-1B-Instruct"
adapter_id = "Abdul1102/llama32-1b-python-docstrings-qlora"
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model = AutoModelForCausalLM.from_pretrained(base_model_id, device_map="auto")
model = PeftModel.from_pretrained(model, adapter_id)
def make_prompt(code: str) -> str:
return
f'Write a one-line Python docstring for this function:\n\n{code}\n\n"""'
code = "def add(a, b):\n return a + b"
inputs = tokenizer(make_prompt(code), return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=32, do_sample=False)
text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(text)
Nan-Do/code-search-net-python)code column (full Python function body)docstringTrainerHeld-out test split from the same CodeSearchNet Python dataset, using identical code → one-line docstring mapping.
Approximate performance on ~50 held-out samples:
The model frequently reproduces or closely paraphrases the correct docstring. Occasional failures include echoing part of the prompt or returning an empty string. Strong performance for a 1B model trained briefly on a small dataset.
Not applicable.
Single Google Colab GPU (T4 or L4)
Not applicable.
Not applicable.
See the Hugging Face model page for updates or usage examples.
Abdullah Al-Housni
Available through the Hugging Face model repository.