Downloads · 30 days
33
15% of all-time downloads
likithyadavv/codementor-7b
codementor-7b is a question answering model from likithyadavv. Use it when the input is a question plus a passage. It is set up for transformers.
A fine-tuned Qwen2.5-Coder-7B-Instruct model trained to guide students through programming problems — never giving away answers, always teaching.
Downloads · 30 days
33
15% of all-time downloads
All-time downloads
222
Public
Parameters
7.6B
15.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors15.3 GB · 100%
From the Hugging Face model README
A fine-tuned Qwen2.5-Coder-7B-Instruct model trained to guide students through programming problems — never giving away answers, always teaching.
| Field | Value |
|---|---|
| Base Model | Qwen/Qwen2.5-Coder-7B-Instruct |
| Fine-tuning Method | LoRA (r=16, alpha=32) |
| Training | 3 epochs, 1585 examples |
| Languages Supported | Python, Java, C, C++ |
| Task | Socratic code mentoring / tutoring |
| License | MIT |
CodeMentor is not a code generator. It's a programming tutor that:
Built as the core AI engine for BuildEx — an educational IDE and VS Code-style browser extension developed by BuildForU. CodeMentor powers the in-editor tutoring experience, guiding students through code in real time without giving away solutions.
Primary integrations:
Suitable for any educational setting where Socratic mentoring is preferred over direct answer generation.
Python >= 3.9
RAM >= 8GB
Storage >= 5GB (model download, cached after first run)
GPU: Optional (runs on CPU too, slower)
pip install transformers bitsandbytes accelerate torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
import torch
HF_MODEL = "likithyadavv/codementor-7b"
HF_TOKEN = "your_hf_read_token" # from huggingface.co/settings/tokens
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.float16,
)
print("Loading CodeMentor... (first run downloads ~4GB, cached after)")
tokenizer = AutoTokenizer.from_pretrained(HF_MODEL, token=HF_TOKEN)
model = AutoModelForCausalLM.from_pretrained(
HF_MODEL,
quantization_config=bnb_config,
device_map="auto",
token=HF_TOKEN
)
print("Ready!\n")
def ask(instruction, code, language="Python"):
prompt = f"""### System:
You are CodeMentor — a sharp, patient programming tutor for Python, Java, C, and C++.
You NEVER give away full solutions. Guide step by step.
### Instruction:
{instruction}
### Input:
[Language: {language}]
{code}
### Response:
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=300,
do_sample=True,
temperature=0.7,
top_p=0.9,
repetition_penalty=1.2,
)
full = tokenizer.decode(outputs[0], skip_special_tokens=True)
return full.split("### Response:")[-1].strip()
while True:
print("\n" + "="*40)
lang = input("Language (Python/Java/C/C++): ").strip() or "Python"
question = input("Your question: ").strip()
code = input("Your code (press Enter to skip): ").strip()
print(f"\n🤖 CodeMentor:\n{ask(question, code or 'None', lang)}")
G N Likith Yadav — AIML Undergraduate, MVJCE Bangalore | Tensor Club Technical Lead