Update README.md
Browse files
README.md
CHANGED
@@ -23,6 +23,7 @@ from tkinter import filedialog, ttk, messagebox
|
|
23 |
import logging
|
24 |
import json
|
25 |
import os
|
|
|
26 |
|
27 |
# Configure logging
|
28 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
@@ -31,11 +32,22 @@ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(
|
|
31 |
date_string: str = date.today().strftime("%d %b %Y")
|
32 |
model_id = "oe2015/llama-3.2-finetuned-tikzcode"
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
# Load the model and processor
|
35 |
model = MllamaForConditionalGeneration.from_pretrained(
|
36 |
model_id,
|
37 |
torch_dtype=torch.bfloat16,
|
38 |
device_map="auto",
|
39 |
)
|
|
|
|
|
|
|
40 |
processor = AutoProcessor.from_pretrained(model_id)
|
41 |
```
|
|
|
23 |
import logging
|
24 |
import json
|
25 |
import os
|
26 |
+
from peft import LoraConfig, get_peft_model
|
27 |
|
28 |
# Configure logging
|
29 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
|
32 |
date_string: str = date.today().strftime("%d %b %Y")
|
33 |
model_id = "oe2015/llama-3.2-finetuned-tikzcode"
|
34 |
|
35 |
+
lora_config = LoraConfig(
|
36 |
+
r=16, # Rank of the decomposition, typically a small number (e.g., 8, 16)
|
37 |
+
lora_alpha=32, # Scaling factor for LoRA parameters
|
38 |
+
target_modules=["q_proj", "v_proj"], # Apply LoRA to specific model layers (e.g., Q, V projections in attention layers)
|
39 |
+
lora_dropout=0.1, # Dropout for LoRA layers
|
40 |
+
bias="none" # LoRA doesn’t update biases by default; change to "all" if needed
|
41 |
+
)
|
42 |
+
|
43 |
# Load the model and processor
|
44 |
model = MllamaForConditionalGeneration.from_pretrained(
|
45 |
model_id,
|
46 |
torch_dtype=torch.bfloat16,
|
47 |
device_map="auto",
|
48 |
)
|
49 |
+
|
50 |
+
model = get_peft_model(model, lora_config)
|
51 |
+
|
52 |
processor = AutoProcessor.from_pretrained(model_id)
|
53 |
```
|