from transformers import AutoModelForImageTextToText, AutoProcessorimport torch MODEL = "tcmofashi/mai_replier_9b_v3" processor = AutoProcessor.from_pretrained(MODEL)model = AutoModelForImageTextToText.from_pretrained(MODEL, dtype=torch.bfloat16, device_map="auto") messages = [ {"role": "system", "content": "你的名字是小千。是一个大二在读女大学生…"}, {"role": "user", "content": "你正在qq群里聊天…\n现在,你说:"},] text = processor.apply_chat_template( messages, tokenize=False, add_generation_prompt=True, chat_template_kwargs={"enable_thinking": False},)inputs = processor(text=text, return_tensors="pt").to(model.device)out = model.generate(**inputs, max_new_tokens=256, temperature=0.7, top_p=0.95, repetition_penalty=1.15, do_sample=True, eos_token_id=[248046, 248044])print(processor.tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))