Downloads · 30 days
9
17% of all-time downloads
farhan98ahzan/jac-coder-7b-lora
jac-coder-7b-lora is a text generation model from farhan98ahzan. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
A LoRA adapter fine-tuned on the Jac programming language for code generation, built on top of Qwen2.5-Coder-7B-Instruct.
Downloads · 30 days
9
17% of all-time downloads
All-time downloads
52
Public
Repo size
334 MB
Likes
0
Public
Click a slice to open those files.
.safetensors323 MB · 97%
From the Hugging Face model README
A LoRA adapter fine-tuned on the Jac programming language for code generation, built on top of Qwen2.5-Coder-7B-Instruct.
Jac is a data-spatial programming language featuring walkers, nodes, edges, and graph-based computation. This adapter teaches the base model to generate idiomatic Jac backend code including node/edge definitions, walker APIs, graph traversals, and ability implementations.
Prompt: "Write a Jac node for a User with name, email, and age fields"
node User {
has name: str;
has email: str;
has age: int = 0;
}
Prompt: "Write a Jac walker for a REST API endpoint that creates a new todo item"
node Todo {
has title: str;
has done: bool = False;
}
walker CreateTodo {
has title: str;
can create with Root entry {
here ++> Todo(title=self.title);
report [-->];
}
}
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
BASE_MODEL = "Qwen/Qwen2.5-Coder-7B-Instruct"
ADAPTER = "farhan98ahzan/jac-coder-7b-lora"
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL, trust_remote_code=True)
# Load base model in 4-bit (for low VRAM)
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
)
model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL,
quantization_config=bnb_config,
device_map="auto",
trust_remote_code=True,
)
# Apply LoRA adapter
model = PeftModel.from_pretrained(model, ADAPTER)
model.eval()
# Generate
messages = [
{"role": "system", "content": "You are an expert Jac programming language assistant."},
{"role": "user", "content": "Write a Jac walker that lists all users"},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7, top_p=0.9, do_sample=True)
generated = outputs[0][inputs["input_ids"].shape[1]:]
print(tokenizer.decode(generated, skip_special_tokens=True))
To merge LoRA weights into the base model, load the base model in bf16 (not 4-bit) to avoid rounding errors:
from transformers import AutoModelForCausalLM
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-Coder-7B-Instruct",
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
)
model = PeftModel.from_pretrained(base, "farhan98ahzan/jac-coder-7b-lora")
merged = model.merge_and_unload()
merged.save_pretrained("jac-coder-7b-merged")
Warning: Do not merge into a 4-bit quantized base model -- this produces corrupted weights and gibberish output.
The adapter was trained on 3,200 curated Jac code samples sourced from:
| Source | Description |
|---|---|
| jaseci/jaseci | Core Jac compiler repo -- examples, tests, reference implementations |
| BeaconLens | Full-stack Jac application (review analysis platform) |
| jac-visual-builder | Visual graph schema builder in Jac |
| Jac documentation | 936 code examples extracted from official docs |
All source files were validated with jac check --parse_only for syntactic correctness. Only backend Jac code was included (frontend/UI files filtered out).
Dataset composition:
| Type | Count | Description |
|---|---|---|
| full_file | 800 | Complete valid Jac source files |
| construct_completion | 800 | Walker/node/ability signature to body completion |
| completion | 800 | Import + partial code to complete the rest |
| doc_example | 800 | Documentation description to Jac code |
Qualitative evaluation on held-out prompts:
| Prompt | Result |
|---|---|
| Node definition with typed fields | Correct node with has fields and defaults |
| Walker with graph traversal | Correct walker with [-->] traversal and report |
| REST API endpoint walker | Correct walker with Root entry, node creation (++>), and response |
The model generates syntactically valid Jac code with proper use of language-specific constructs: node, walker, has, can, with ... entry, ++>, [-->], report, and disengage.
.cl.jac)@misc{jac-coder-7b-lora,
title={Jac Coder 7B LoRA},
author={Farhan Ahzan},
year={2026},
publisher={HuggingFace},
url={https://huggingface.co/farhan98ahzan/jac-coder-7b-lora}
}