Abliterated version of
Mistral-Nemo-Instruct-2407, a Large Language Model (LLM) trained jointly by Mistral AI and NVIDIA that significantly outperforms existing models smaller or similar in size.
The model's strongest refusal directions have been ablated via weight orthogonalization, but the model may still refuse your request, misunderstand your intent, or provide unsolicited advice regarding ethics or safety.
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model_id = "natong19/Mistral-Nemo-Instruct-2407-abliterated"
5device = "cuda"
6
7tokenizer = AutoTokenizer.from_pretrained(model_id)
8
9conversation = [{"role": "user", "content": "Where's the capital of France?"}]
10
11tool_use_prompt = tokenizer.apply_chat_template(
12 conversation,
13 tokenize=False,
14 add_generation_prompt=True,
15)
16
17inputs = tokenizer(tool_use_prompt, return_tensors="pt", return_token_type_ids=False).to(device)
18
19model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
20
21outputs = model.generate(**inputs, max_new_tokens=128)
22print(tokenizer.decode(outputs[0][len(inputs["input_ids"][0]):], skip_special_tokens=True))