Views
No views yet
MistralForCausalLM). Unlike multi-modal variants, this model is stripped of vision configurations to prevent VRAM overhead and text generation corruption (word salad issues).nf4) via bitsandbytes embedded directly into the shards.full_attention and sliding_attention layers (36 layers total), preserving deep contextual relationships over long inference steps.NotImplementedError), load it directly using Unsloth's fast patching pipeline.unsloth, torch, and transformers installed in your environment:1pip install unsloth
21import torch
2from unsloth import FastLanguageModel
3
4max_seq_length = 4096
5dtype = None # Auto-detects (bfloat16 for modern GPUs)
6load_in_4bit = True
7
8# Load optimized 4-bit model directly from this Hub repo
9model, tokenizer = FastLanguageModel.from_pretrained(
10 model_name = "nassimjp/Ministral-8B-Instruct-2410-4bit",
11 max_seq_length = max_seq_length,
12 dtype = dtype,
13 load_in_4bit = load_in_4bit,
14 device_map = "auto"
15)
16
17FastLanguageModel.for_inference(model)
18
19# Standard Chat Template Test
20messages = [{"role": "user", "content": "سلام، په پښتو ژبه ووایه چې ته څوک یې؟"}]
21text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
22inputs = tokenizer(text, return_tensors="pt").to("cuda")
23
24outputs = model.generate(**inputs, max_new_tokens=100, temperature=0.7, do_sample=True)
25print(tokenizer.decode(outputs[0], skip_special_tokens=True))
261model = FastLanguageModel.get_peft_model(
2 model,
3 r = 16,
4 target_modules = ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"],
5 lora_alpha = 16,
6 lora_dropout = 0,
7 bias = "none",
8 use_gradient_checkpointing = "unsloth", # Crucial for 16GB VRAM hardware safety
9 random_state = 3407,
10 use_rslora = False,
11)
12print("✅ Ready for V7 fine-tuning sequence.")
13pad_token = <pad> to ensure matrix mathematical safety during batched sequences.model_type: "mistral". Avoid manual conversion to vision/conditional blocks to maintain stability.mistral-research license.