from peft import PeftModelfrom transformers import AutoTokenizer, AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct")tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct")model = PeftModel.from_pretrained(base_model, "javeria163/text-to-sql") schema = "CREATE TABLE employees (id INT, name TEXT, department TEXT, salary INT)"question = "What is the average salary in the Engineering department?" prompt = ( "Task: Convert the question to SQL using the table schema.\n\n" "Schema:\n" + schema + "\n\n" "Question:\n" + question + "\n\n" "SQL:\n") inputs = tokenizer(prompt, return_tensors="pt")outputs = model.generate(**inputs, max_new_tokens=150, do_sample=False)print(tokenizer.decode(outputs[0], skip_special_tokens=True).split("SQL:")[-1].strip())