import torchfrom transformers import Mistral3ForConditionalGeneration, MistralCommonBackend model_id = "ValiantLabs/Ministral-3-14B-Reasoning-2512-ShiningValiant3" tokenizer = MistralCommonBackend.from_pretrained(model_id) model = Mistral3ForConditionalGeneration.from_pretrained( model_id, torch_dtype=torch.bfloat16, device_map="auto") user_prompt = "Propose a novel cognitive architecture where the primary memory component is a Graph Neural Network (GNN). How would this GNN represent working, declarative, and procedural memory? How would the \"cognitive cycle\" be implemented as operations on this graph?" system_prompt = ( "# HOW YOU SHOULD THINK AND ANSWER\n\n" "First draft your thinking process (inner monologue) until you arrive at a response. " "Format your response using Markdown, and use LaTeX for any mathematical equations. " "Write both your thoughts and the response in the same language as the input.\n\n" "Your thinking process must follow the template below:" "[THINK]Your thoughts or/and draft, like working through an exercise on scratch paper. " "Be as casual and as long as you want until you are confident to generate the response to the user.[/THINK]" "Here, provide a self-contained response.") messages = [ { "role": "system", "content": system_prompt }, { "role": "user", "content": [ { "type": "text", "text": user_prompt, }, ], },] tokenized = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True)tokenized = {k: v.to("cuda") for k, v in tokenized.items() if hasattr(v, "to")} output = model.generate( **tokenized, max_new_tokens=20000,)[0] decoded_output = tokenizer.decode(output[len(tokenized["input_ids"][0]):])print(decoded_output)