ubaid0405/tinyllama-1.1b-docstring-gen
018
Model Description
This model is a LoRA fine-tuned version of TinyLlama-1.1B-Chat-v1.0, trained to generate Python docstrings for given function code.
- Base model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
- Dataset: codesearchnet (Python subset)
- Method: Supervised Fine-Tuning (SFT) with LoRA
- Developed by: Ubaid
Training Results
How to Use
\\\`python from peft import AutoPeftModelForCausalLM from transformers import AutoTokenizer
repo = "ubaid0405/tinyllama-1.1b-docstring-gen" model = AutoPeftModelForCausalLM.frompretrained(repo, devicemap="auto") tok = AutoTokenizer.from_pretrained(repo)
code = "def add(a, b):\n return a + b" prompt = f"[INST] Write a docstring:\n{code} [/INST]"
ids = tok(prompt, returntensors="pt").inputids.to(model.device) out = model.generate(ids, maxnewtokens=100) print(tok.decode(out[0][ids.shape[1]:], skipspecialtokens=True)) \\\`
