Update README.md
Browse files
README.md
CHANGED
|
@@ -6,7 +6,50 @@ tags:
|
|
| 6 |
|
| 7 |
# Model Card for Model ID
|
| 8 |
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
|
|
@@ -40,6 +83,8 @@ This is the model card of a 🤗 transformers model that has been pushed on the
|
|
| 40 |
|
| 41 |
### Direct Use
|
| 42 |
|
|
|
|
|
|
|
| 43 |
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 44 |
|
| 45 |
[More Information Needed]
|
|
|
|
| 6 |
|
| 7 |
# Model Card for Model ID
|
| 8 |
|
| 9 |
+
model_name = "unsloth/llama-3-8b-Instruct-bnb-4bit",
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
model = FastLanguageModel.get_peft_model(
|
| 13 |
+
model,
|
| 14 |
+
r = 64,
|
| 15 |
+
target_modules = ["q_proj", "k_proj", "v_proj", "o_proj",
|
| 16 |
+
"gate_proj", "up_proj", "down_proj",],
|
| 17 |
+
lora_alpha = 16,
|
| 18 |
+
lora_dropout = 0.2, # Supports any, but = 0 is optimized
|
| 19 |
+
bias = "none", # Supports any, but = "none" is optimized
|
| 20 |
+
# [NEW] "unsloth" uses 30% less VRAM, fits 2x larger batch sizes!
|
| 21 |
+
use_gradient_checkpointing = "unsloth", # True or "unsloth" for very long context
|
| 22 |
+
random_state = 3407,
|
| 23 |
+
use_rslora = False, # We support rank stabilized LoRA
|
| 24 |
+
loftq_config = None, # And LoftQ
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
trainer = SFTTrainer(
|
| 28 |
+
model=model,
|
| 29 |
+
tokenizer=tokenizer,
|
| 30 |
+
train_dataset=dataset_transformed,
|
| 31 |
+
dataset_text_field="text",
|
| 32 |
+
max_seq_length=max_seq_length,
|
| 33 |
+
dataset_num_proc=2,
|
| 34 |
+
packing=False,
|
| 35 |
+
args=TrainingArguments(
|
| 36 |
+
per_device_train_batch_size=2,
|
| 37 |
+
gradient_accumulation_steps=4,
|
| 38 |
+
warmup_steps=5,
|
| 39 |
+
num_train_epochs=2,
|
| 40 |
+
learning_rate=2e-4,
|
| 41 |
+
fp16=not is_bfloat16_supported(),
|
| 42 |
+
bf16=is_bfloat16_supported(),
|
| 43 |
+
logging_steps=1,
|
| 44 |
+
optim="adamw_8bit",
|
| 45 |
+
weight_decay=0.01,
|
| 46 |
+
lr_scheduler_type="linear",
|
| 47 |
+
seed=3407,
|
| 48 |
+
output_dir="outputs",
|
| 49 |
+
max_grad_norm=1.0, # Added for gradient clipping
|
| 50 |
+
),
|
| 51 |
+
)
|
| 52 |
+
trainer_stats = trainer.train()
|
| 53 |
|
| 54 |
|
| 55 |
|
|
|
|
| 83 |
|
| 84 |
### Direct Use
|
| 85 |
|
| 86 |
+
|
| 87 |
+
|
| 88 |
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 89 |
|
| 90 |
[More Information Needed]
|