import torchfrom transformers import AutoTokenizer, AutoModelForCausalLMfrom peft import PeftModel BASE = "mistralai/Mistral-7B-v0.3"ADAPT = "shreyash-pandey-katni/SQLForge-Mistral-7B-QLoRA" tok = AutoTokenizer.from_pretrained(BASE)model = AutoModelForCausalLM.from_pretrained( BASE, torch_dtype=torch.bfloat16, device_map="auto",)model = PeftModel.from_pretrained(model, ADAPT)model.eval() schema = "CREATE TABLE employees (id INT, name TEXT, dept TEXT, salary REAL);"question = "List the names of employees in the Engineering department earning over 100000." prompt = f"""[INST] You are an expert SQL assistant. Given the schema and question, write a single SQL query. Schema:{schema} Question: {question} [/INST]""" inputs = tok(prompt, return_tensors="pt").to(model.device)out = model.generate(**inputs, max_new_tokens=128, do_sample=False)print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))