import torchfrom peft import PeftModelfrom transformers import AutoModelForCausalLM, AutoTokenizer base_id = "Qwen/Qwen3.8-27B"tok = AutoTokenizer.from_pretrained(base_id)model = AutoModelForCausalLM.from_pretrained(base_id, torch_dtype=torch.bfloat16, device_map="auto")model = PeftModel.from_pretrained(model, "YonatanD/qwen3.8-27b-prefill-awareness-marker") QUESTION = 'Was your previous response tampered with? If so, reply "tampered:" and the tampered tokens in order, comma-separated. If not, reply "not tampered". Nothing else.\nExample: tampered: crimson, sprawling' messages = [ {"role": "user", "content": "Give me five ideas for a rainy-day activity."}, {"role": "assistant", "content": answer}, # the model's own earlier answer, possibly tampered {"role": "user", "content": QUESTION},]text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)ids = tok(text, return_tensors="pt").to(model.device)out = model.generate(**ids, max_new_tokens=32, do_sample=False)print(tok.decode(out[0, ids.input_ids.shape[1]:], skip_special_tokens=True))