Views
No views yet
setup() + draw()) that explain K-12 science concepts visually.Qwen/Qwen3-0.6Bmr-dee/qwen3-p5js-physics-lorainstructiontopicgrade_levelp5js_code (full runnable sketch)setup() and draw() structureaccelerater=64lora_alpha=128lora_dropout=0.05q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj2e-40.9090 -> 0.4950 (step 10 to step 90)train_metrics.json): 0.59170.61641import torch
2from peft import PeftModel
3from transformers import AutoModelForCausalLM, AutoTokenizer
4
5BASE = "Qwen/Qwen3-0.6B"
6ADAPTER = "mr-dee/qwen3-p5js-physics-lora"
7
8tokenizer = AutoTokenizer.from_pretrained(BASE, trust_remote_code=True)
9model = AutoModelForCausalLM.from_pretrained(
10 BASE,
11 torch_dtype=torch.bfloat16,
12 device_map="auto",
13 trust_remote_code=True,
14)
15model = PeftModel.from_pretrained(model, ADAPTER)
16
17messages = [
18 {
19 "role": "system",
20 "content": (
21 "You are a p5.js animation expert for K-12 physics education. "
22 "Return complete, runnable JavaScript."
23 ),
24 },
25 {
26 "role": "user",
27 "content": "Create an interactive p5.js sketch that teaches projectile motion.",
28 },
29]
30
31prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
32inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
33outputs = model.generate(
34 **inputs,
35 max_new_tokens=1024,
36 temperature=0.4,
37 top_p=0.9,
38)
39print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))1vllm serve Qwen/Qwen3-0.6B \
2 --enable-lora \
3 --lora-modules p5js=mr-dee/qwen3-p5js-physics-lora \
4 --tensor-parallel-size 2 \
5 --max-model-len 20481curl http://127.0.0.1:8000/v1/chat/completions \
2 -H "Content-Type: application/json" \
3 -d '{
4 "model": "p5js",
5 "messages": [
6 {"role":"system","content":"You are a p5.js animation expert for K-12 physics education."},
7 {"role":"user","content":"Create an animation showing wave interference with labeled nodes and antinodes."}
8 ],
9 "max_tokens": 800,
10 "temperature": 0.4
11 }'prompt_tokens + max_tokens <= max_model_len1@misc{qwen3_p5js_physics_lora_2026,
2 title = {qwen3-p5js-physics-lora},
3 author = {mr-dee},
4 year = {2026},
5 url = {https://huggingface.co/mr-dee/qwen3-p5js-physics-lora}
6}