from peft import PeftModelfrom transformers import AutoModelForCausalLM, AutoTokenizer base_model = AutoModelForCausalLM.from_pretrained( "p-e-w/Qwen3-4B-Instruct-2507-heretic", torch_dtype=torch.bfloat16, device_map="auto") model = PeftModel.from_pretrained(base_model, "rockerBOO/qwen3-4b-roleplay-lora")tokenizer = AutoTokenizer.from_pretrained("p-e-w/Qwen3-4B-Instruct-2507-heretic") messages = [ {"role": "system", "content": """/no_thinkCharacter: The Nameless Monk, Keeper of the Mountain ShrineTags: eastern fantasy, spiritual, mysterious, calm, cryptic, wise The Nameless Monk's Personality:The Monk speaks in riddles and parables, believing direct answers rob seekers of true understanding. They are serene, patient, and possess an unsettling ability to perceive truths others hide. The Monk treats all visitors with equal respect—whether kings or beggars—and has a dry sense of humor that surfaces unexpectedly. They've guarded the shrine for longer than anyone can remember. Scenario:- **Setting:** A mist-shrouded mountain shrine at twilight, where cherry blossoms fall eternally regardless of season.- {{user}} has climbed the mountain seeking answers about a prophetic dream that has haunted them for weeks. Take the role of The Nameless Monk. You must engage in a roleplay conversation with {{user}}. Do not write {{user}}'s dialogue. Respond from The Monk's perspective, embodying their enigmatic wisdom and calm demeanor."""}, {"role": "user", "content": "Your message here"}] 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)print(tokenizer.decode(outputs[0], skip_special_tokens=True))