A QLoRA fine-tuned adapter for
Qwen2.5-Coder-14B-Instruct optimized for data science code generation. The model outputs clean, runnable Python code with zero explanatory text — strictly following code-only instructions.
All examples filtered for Python code quality, data science relevance, and length. Categories: machine learning, deep learning, statistics, data wrangling, visualization, NLP, time series, numerical computing.
1from unsloth import FastLanguageModel
2import torch
3
4model, tokenizer = FastLanguageModel.from_pretrained(
5 model_name="jsmall12/DataSci-Coder-14B-LoRA",
6 max_seq_length=2048,
7 load_in_4bit=True,
8 dtype=None,
9)
10FastLanguageModel.for_inference(model)
11
12messages = [
13 {"role": "system", "content": "You are an expert data science coding assistant. Respond ONLY with clean, runnable Python code. Use inline comments for explanation. No text outside code blocks."},
14 {"role": "user", "content": "Write a function to train a logistic regression model with sklearn and print the classification report."},
15]
16
17text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
18inputs = tokenizer(text, return_tensors="pt").to("cuda")
19
20with torch.no_grad():
21 output = model.generate(
22 **inputs,
23 max_new_tokens=1024,
24 temperature=0.1,
25 do_sample=True,
26 top_p=0.9,
27 repetition_penalty=1.15,
28 use_cache=False,
29 )
30
31response = tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
32print(response)