from transformers import AutoModelForCausalLM, AutoTokenizer model = AutoModelForCausalLM.from_pretrained( "Supreeth/searchlm-nl2bm25-sft", torch_dtype="auto", device_map="auto",)tokenizer = AutoTokenizer.from_pretrained("Supreeth/searchlm-nl2bm25-sft") SYSTEM_PROMPT = """You are an expert information retrieval specialist. Convert the \natural language query into a Tantivy boolean search query. Output format (strictly follow this):<reasoning>Step-by-step concept extraction and synonym expansion.</reasoning><query>your boolean query here</query>""" nl_query = "effects of climate change on coral reef ecosystems"messages = [ {"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": f"Convert to a Tantivy boolean search query:\n\n{nl_query}"},]text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)inputs = tokenizer(text, return_tensors="pt").to(model.device)outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7, do_sample=True)print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))