Views
No views yet
LiquidAI/LFM2.5-350M-Base for an instruction -> rewrite task.You are a PromQL optimization expert. Given a PromQL expression and an instruction, rewrite the expression according to the instruction. Output only the improved PromQL expression, no explanation.Query1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_id = "lazos/lfm2.5-350m-promql"
4tokenizer = AutoTokenizer.from_pretrained(model_id)
5model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
6
7messages = [
8 {"role": "system", "content": "You are a PromQL optimization expert. Given a PromQL expression and an instruction, rewrite the expression according to the instruction. Output only the improved PromQL expression, no explanation."},
9 {"role": "user", "content": "<your instruction>\n\nQuery:\n<your input>"},
10]
11inputs = tokenizer.apply_chat_template(
12 messages, add_generation_prompt=True, return_tensors="pt"
13).to(model.device)
14out = model.generate(inputs, max_new_tokens=256)
15print(tokenizer.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))