Instructions to use berkamphoon/medgemma-27b-it-dr5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use berkamphoon/medgemma-27b-it-dr5 with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("berkamphoon/medgemma-27b-it-dr5", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Training in progress, epoch 1
Browse files
README.md
CHANGED
|
@@ -4,8 +4,8 @@ library_name: transformers
|
|
| 4 |
model_name: medgemma-27b-it-dr5
|
| 5 |
tags:
|
| 6 |
- generated_from_trainer
|
| 7 |
-
- sft
|
| 8 |
- trl
|
|
|
|
| 9 |
licence: license
|
| 10 |
---
|
| 11 |
|
|
@@ -27,7 +27,7 @@ print(output["generated_text"])
|
|
| 27 |
|
| 28 |
## Training procedure
|
| 29 |
|
| 30 |
-
[<img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="150" height="24"/>](https://wandb.ai/yoon307-kaist/medgemma-27b-it-dr5-Project/runs/
|
| 31 |
|
| 32 |
|
| 33 |
This model was trained with SFT.
|
|
|
|
| 4 |
model_name: medgemma-27b-it-dr5
|
| 5 |
tags:
|
| 6 |
- generated_from_trainer
|
|
|
|
| 7 |
- trl
|
| 8 |
+
- sft
|
| 9 |
licence: license
|
| 10 |
---
|
| 11 |
|
|
|
|
| 27 |
|
| 28 |
## Training procedure
|
| 29 |
|
| 30 |
+
[<img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="150" height="24"/>](https://wandb.ai/yoon307-kaist/medgemma-27b-it-dr5-Project/runs/eb2grjqj)
|
| 31 |
|
| 32 |
|
| 33 |
This model was trained with SFT.
|
adapter_config.json
CHANGED
|
@@ -28,16 +28,16 @@
|
|
| 28 |
"rank_pattern": {},
|
| 29 |
"revision": null,
|
| 30 |
"target_modules": [
|
| 31 |
-
"k_proj",
|
| 32 |
-
"fc1",
|
| 33 |
"out_proj",
|
| 34 |
"o_proj",
|
| 35 |
-
"up_proj",
|
| 36 |
"gate_proj",
|
| 37 |
-
"
|
|
|
|
| 38 |
"q_proj",
|
| 39 |
"down_proj",
|
| 40 |
-
"
|
|
|
|
|
|
|
| 41 |
],
|
| 42 |
"task_type": "CAUSAL_LM",
|
| 43 |
"trainable_token_indices": null,
|
|
|
|
| 28 |
"rank_pattern": {},
|
| 29 |
"revision": null,
|
| 30 |
"target_modules": [
|
|
|
|
|
|
|
| 31 |
"out_proj",
|
| 32 |
"o_proj",
|
|
|
|
| 33 |
"gate_proj",
|
| 34 |
+
"k_proj",
|
| 35 |
+
"fc2",
|
| 36 |
"q_proj",
|
| 37 |
"down_proj",
|
| 38 |
+
"up_proj",
|
| 39 |
+
"fc1",
|
| 40 |
+
"v_proj"
|
| 41 |
],
|
| 42 |
"task_type": "CAUSAL_LM",
|
| 43 |
"trainable_token_indices": null,
|
adapter_model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 6127553104
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b15af7989d94f018dd4560c050b7eb2a69036f0dbb9e1e89903c0ac0caddb5ae
|
| 3 |
size 6127553104
|
runs/Jul23_20-18-53_meedgxh100a/events.out.tfevents.1753316335.meedgxh100a.2435526.0
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9000b28f681fceeb94c214c9682f5a82141a0859a1f631fa8a58b7622effecac
|
| 3 |
+
size 11214
|
train_medgemma_ft_copy.py
CHANGED
|
@@ -215,7 +215,7 @@ if __name__ == '__main__':
|
|
| 215 |
pos = [s for s in data if s[task_idx] != '0.0']
|
| 216 |
num_sample = len(pos)
|
| 217 |
if train:
|
| 218 |
-
return random.sample(neg,
|
| 219 |
else:
|
| 220 |
return random.sample(neg, num_sample), pos
|
| 221 |
# return random.sample(neg, 15), random.sample(pos, 15)
|
|
@@ -267,7 +267,7 @@ if __name__ == '__main__':
|
|
| 267 |
NEG_ID = processor.tokenizer.convert_tokens_to_ids(processor.tokenizer.tokenize("negative")) #27851
|
| 268 |
ASST_ID = processor.tokenizer.convert_tokens_to_ids(processor.tokenizer.tokenize("model\n"))
|
| 269 |
|
| 270 |
-
IM_SIZE =
|
| 271 |
|
| 272 |
peft_config = LoraConfig(
|
| 273 |
lora_alpha=16,
|
|
@@ -290,7 +290,7 @@ if __name__ == '__main__':
|
|
| 290 |
from peft import PeftModel
|
| 291 |
print("🔁 Loading trained PEFT weights...")
|
| 292 |
# model = PeftModel.from_pretrained(model, exp_name)
|
| 293 |
-
model = PeftModel.from_pretrained(model, exp_name+"/checkpoint-
|
| 294 |
# model = PeftModel.from_pretrained(model, "llava-1.5-7b-hf-dr-all/checkpoint-80")
|
| 295 |
phase= "val"
|
| 296 |
else:
|
|
@@ -303,7 +303,7 @@ if __name__ == '__main__':
|
|
| 303 |
|
| 304 |
training_args = SFTConfig(
|
| 305 |
output_dir=exp_name,
|
| 306 |
-
num_train_epochs=
|
| 307 |
per_device_train_batch_size=2, # Batch size per device during training
|
| 308 |
per_device_eval_batch_size=4, # Batch size per device during evaluation
|
| 309 |
gradient_accumulation_steps=8, # Number of steps before performing a backward/update pass
|
|
@@ -313,7 +313,7 @@ if __name__ == '__main__':
|
|
| 313 |
save_strategy="epoch", # Save checkpoint every epoch
|
| 314 |
eval_strategy="steps", # Evaluate every `eval_steps`
|
| 315 |
eval_steps=10000, # Number of steps between evaluations
|
| 316 |
-
learning_rate=
|
| 317 |
bf16=True, # Use bfloat16 precision
|
| 318 |
max_grad_norm=0.3, # Max gradient norm based on QLoRA paper
|
| 319 |
warmup_ratio=0.03, # Warmup ratio based on QLoRA paper
|
|
|
|
| 215 |
pos = [s for s in data if s[task_idx] != '0.0']
|
| 216 |
num_sample = len(pos)
|
| 217 |
if train:
|
| 218 |
+
return random.sample(neg, 10*num_sample), random.sample(pos, num_sample)
|
| 219 |
else:
|
| 220 |
return random.sample(neg, num_sample), pos
|
| 221 |
# return random.sample(neg, 15), random.sample(pos, 15)
|
|
|
|
| 267 |
NEG_ID = processor.tokenizer.convert_tokens_to_ids(processor.tokenizer.tokenize("negative")) #27851
|
| 268 |
ASST_ID = processor.tokenizer.convert_tokens_to_ids(processor.tokenizer.tokenize("model\n"))
|
| 269 |
|
| 270 |
+
IM_SIZE = 512
|
| 271 |
|
| 272 |
peft_config = LoraConfig(
|
| 273 |
lora_alpha=16,
|
|
|
|
| 290 |
from peft import PeftModel
|
| 291 |
print("🔁 Loading trained PEFT weights...")
|
| 292 |
# model = PeftModel.from_pretrained(model, exp_name)
|
| 293 |
+
model = PeftModel.from_pretrained(model, exp_name+"/checkpoint-312")
|
| 294 |
# model = PeftModel.from_pretrained(model, "llava-1.5-7b-hf-dr-all/checkpoint-80")
|
| 295 |
phase= "val"
|
| 296 |
else:
|
|
|
|
| 303 |
|
| 304 |
training_args = SFTConfig(
|
| 305 |
output_dir=exp_name,
|
| 306 |
+
num_train_epochs= 15, # Number of training epochs
|
| 307 |
per_device_train_batch_size=2, # Batch size per device during training
|
| 308 |
per_device_eval_batch_size=4, # Batch size per device during evaluation
|
| 309 |
gradient_accumulation_steps=8, # Number of steps before performing a backward/update pass
|
|
|
|
| 313 |
save_strategy="epoch", # Save checkpoint every epoch
|
| 314 |
eval_strategy="steps", # Evaluate every `eval_steps`
|
| 315 |
eval_steps=10000, # Number of steps between evaluations
|
| 316 |
+
learning_rate=1e-3, # Learning rate based on QLoRA paper
|
| 317 |
bf16=True, # Use bfloat16 precision
|
| 318 |
max_grad_norm=0.3, # Max gradient norm based on QLoRA paper
|
| 319 |
warmup_ratio=0.03, # Warmup ratio based on QLoRA paper
|
training_args.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 5816
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ee9244fe918815ee7fe880544699e1b9adbebd85de9241a0cab5e2752229cc28
|
| 3 |
size 5816
|