import json, torchfrom transformers import AutoModelForCausalLM, AutoTokenizerfrom peft import PeftModel BASE = "Qwen/Qwen2.5-Coder-14B-Instruct"ADAPTER = "naitik12kumar/qwen-kalkulio-lora-14b-v4" tok = AutoTokenizer.from_pretrained(BASE)base = AutoModelForCausalLM.from_pretrained(BASE, dtype=torch.bfloat16, device_map="auto")model = PeftModel.from_pretrained(base, ADAPTER).eval() messages = [ {"role": "system", "content": "You are an expert architectural AI. Generate a valid JSON floor plan for a single-family house."}, {"role": "user", "content": "Generate a floor plan for a house with an approximate area of 90m2."},]prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)inputs = tok(prompt, return_tensors="pt").to(model.device)out = model.generate(**inputs, max_new_tokens=3072, do_sample=True, temperature=0.3, top_p=0.9)raw = tok.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)plan = json.loads(raw) # Recommended: clean with the project's post-processor for a watertight result# from post_process import post_process# plan = post_process(plan, target_area=90)