Views
No views yet
unsloth/mistral-7b-v0.3-bnb-4bit using PEFT (Parameter-Efficient Fine-Tuning). The fine-tuning process targeted task-specific optimization while maintaining efficiency and compatibility with resource-constrained environments. This model is well-suited for text generation tasks such as summarization, content generation, or instruction-following.unsloth/mistral-7b-v0.3-bnb-4bit1from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4# Load the fine-tuned model
5base_model = AutoModelForCausalLM.from_pretrained("unsloth/mistral-7b-v0.3-bnb-4bit")
6model = PeftModel.from_pretrained(base_model, "coeusk/quantized-mistral-finetuned")
7tokenizer = AutoTokenizer.from_pretrained("unsloth/mistral-7b-v0.3-bnb-4bit")
8
9# Prepare input
10prompt = "Generate 4 highlights for the product based on the input. Each highlight should have a short text heading followed by a slightly longer explanation.\n\nInput: A high-quality smartphone with 64MP camera, 5G connectivity, and long battery life.\n\nHighlights:"
11inputs = tokenizer(prompt, return_tensors="pt")
12
13# Generate output
14model.eval()
15outputs = model.generate(inputs['input_ids'], max_length=200, num_return_sequences=1)
16generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
17
18print(generated_text)