Views
No views yet
"This adapter, believe me folks, it's tremendous. It's the best adapter, everyone says so. We're going to do things with this model that nobody's ever seen before."
| Feature | Description |
|---|---|
| Base Model | Mistral-7B-Instruct-v0.2 |
| Architecture | LoRA adapter (Low-Rank Adaptation) |
| Training Focus | Communication style, rhetoric, and response patterns |
| Language | English |
1from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
2from peft import PeftModel
3import torch
4
5# Configuration
6base_model_id = "mistralai/Mistral-7B-Instruct-v0.2"
7bnb_config = BitsAndBytesConfig(
8 load_in_4bit=True,
9 bnb_4bit_compute_dtype=torch.float16,
10 bnb_4bit_quant_type="nf4",
11 bnb_4bit_use_double_quant=True,
12)
13
14# Load model and tokenizer
15model = AutoModelForCausalLM.from_pretrained(
16 base_model_id,
17 quantization_config=bnb_config,
18 device_map="auto",
19 torch_dtype=torch.float16
20)
21tokenizer = AutoTokenizer.from_pretrained(base_model_id)
22
23# Apply adapter
24model = PeftModel.from_pretrained(model, "nnat03/trump-mistral-adapter")
25
26# Generate response
27prompt = "What's your plan for border security?"
28input_text = f"<s>[INST] {prompt} [/INST]"
29inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
30outputs = model.generate(**inputs, max_length=512, temperature=0.7, do_sample=True)
31response = tokenizer.decode(outputs[0], skip_special_tokens=True)
32print(response.split("[/INST]")[-1].strip())1# Pull the model
2ollama pull nnat03/trump-mistral
3
4# Run the model
5ollama run nnat03/trump-mistral| Topic | Response |
|---|---|
| Border Security | "First of all, we need the wall. The wall is very important. It's not just a wall, it's steel and concrete and things that are very, very strong. We have 450 miles completed. It's an incredible job." |
| Joe Biden | "Joe Biden, I call him 1% Joe. His numbers are way down. He's a corrupt politician. He's been there for 47 years. Where has he been? What's he done? There's nothing." |
LoRA rank: 16 (tremendous rank, the best rank)
Alpha: 64
Dropout: 0.05
Target modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_projBatch size: 4
Gradient accumulation: 4
Learning rate: 2e-4
Epochs: 3
LR scheduler: cosine
Optimizer: paged_adamw_8bit
Precision: BF16| 🎓 Education Political discourse analysis | 🔬 Research Rhetoric pattern studies | 🎭 Creative Interactive simulations |
1@misc{nnat03-trump-mistral-adapter,
2 author = {nnat03},
3 title = {Trump Mistral Adapter},
4 year = {2023},
5 publisher = {Hugging Face},
6 howpublished = {\url{https://huggingface.co/nnat03/trump-mistral-adapter}}
7}