Views
No views yet
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
4
5BASE = "Qwen/Qwen2.5-Coder-32B-Instruct"
6ADAPTER = "rwmasood/Qwen2.5-Coder-32B-Palace-LoRA"
7
8tok = AutoTokenizer.from_pretrained(ADAPTER)
9model = AutoModelForCausalLM.from_pretrained(BASE, torch_dtype=torch.bfloat16, device_map="auto")
10model = PeftModel.from_pretrained(model, ADAPTER)
11
12messages = [
13 {"role": "system", "content": "You write and repair Palace configuration files."},
14 {"role": "user", "content": "Write a Palace electrostatic configuration that computes the "
15 "capacitance of a parallel-plate capacitor. Mesh: mesh/plate.msh, "
16 "one terminal on attribute 3, ground on attribute 4, vacuum domain "
17 "on attribute 1."},
18]
19inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
20out = model.generate(inputs, max_new_tokens=1024, do_sample=False)
21print(tok.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))1vllm serve Qwen/Qwen2.5-Coder-32B-Instruct \
2 --enable-lora \
3 --lora-modules palace=rwmasood/Qwen2.5-Coder-32B-Palace-LoRA \
4 --max-lora-rank 64palace.q,k,v,o,gate,up,down)palace --dry-run, which catches structural and parser-level problems. Note that a
config can pass both of these and still be physically wrong — for example a mis-scaled length
unit (L0) produces a config that is schema-valid and runs to completion yet computes a very
different physical system. Where a reference or an analytic answer exists, check the numerical
output against it. The adapter targets Palace v0.14.0; other versions may differ in schema.Qwen/Qwen2.5-Coder-32B-Instruct.