Instructions to use BlacqTangent/medgemma-4b-it-sft-lora-diff with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use BlacqTangent/medgemma-4b-it-sft-lora-diff with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/medgemma-4b-it-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "BlacqTangent/medgemma-4b-it-sft-lora-diff") - Transformers
How to use BlacqTangent/medgemma-4b-it-sft-lora-diff with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="BlacqTangent/medgemma-4b-it-sft-lora-diff")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("BlacqTangent/medgemma-4b-it-sft-lora-diff", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use BlacqTangent/medgemma-4b-it-sft-lora-diff with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "BlacqTangent/medgemma-4b-it-sft-lora-diff" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BlacqTangent/medgemma-4b-it-sft-lora-diff", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/BlacqTangent/medgemma-4b-it-sft-lora-diff
- SGLang
How to use BlacqTangent/medgemma-4b-it-sft-lora-diff with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "BlacqTangent/medgemma-4b-it-sft-lora-diff" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BlacqTangent/medgemma-4b-it-sft-lora-diff", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "BlacqTangent/medgemma-4b-it-sft-lora-diff" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BlacqTangent/medgemma-4b-it-sft-lora-diff", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Unsloth Desktop
- Docker Model Runner
How to use BlacqTangent/medgemma-4b-it-sft-lora-diff with Docker Model Runner:
docker model run hf.co/BlacqTangent/medgemma-4b-it-sft-lora-diff
Model save
Browse files
README.md
CHANGED
|
@@ -22,7 +22,7 @@ should probably proofread and complete it, then remove this comment. -->
|
|
| 22 |
|
| 23 |
This model is a fine-tuned version of [unsloth/medgemma-4b-it-unsloth-bnb-4bit](https://huggingface.co/unsloth/medgemma-4b-it-unsloth-bnb-4bit) on the imagefolder dataset.
|
| 24 |
It achieves the following results on the evaluation set:
|
| 25 |
-
- Loss:
|
| 26 |
|
| 27 |
## Model description
|
| 28 |
|
|
@@ -45,24 +45,35 @@ The following hyperparameters were used during training:
|
|
| 45 |
- train_batch_size: 2
|
| 46 |
- eval_batch_size: 2
|
| 47 |
- seed: 42
|
| 48 |
-
- gradient_accumulation_steps:
|
| 49 |
-
- total_train_batch_size:
|
| 50 |
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
|
| 51 |
- lr_scheduler_type: linear
|
| 52 |
- lr_scheduler_warmup_ratio: 0.03
|
| 53 |
-
- num_epochs:
|
| 54 |
- mixed_precision_training: Native AMP
|
| 55 |
|
| 56 |
### Training results
|
| 57 |
|
| 58 |
| Training Loss | Epoch | Step | Validation Loss |
|
| 59 |
|:-------------:|:-----:|:----:|:---------------:|
|
| 60 |
-
| 0.
|
| 61 |
-
| 0.
|
| 62 |
-
| 0.
|
| 63 |
-
| 0.
|
| 64 |
-
| 0.
|
| 65 |
-
| 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
|
| 68 |
### Framework versions
|
|
|
|
| 22 |
|
| 23 |
This model is a fine-tuned version of [unsloth/medgemma-4b-it-unsloth-bnb-4bit](https://huggingface.co/unsloth/medgemma-4b-it-unsloth-bnb-4bit) on the imagefolder dataset.
|
| 24 |
It achieves the following results on the evaluation set:
|
| 25 |
+
- Loss: 1.1324
|
| 26 |
|
| 27 |
## Model description
|
| 28 |
|
|
|
|
| 45 |
- train_batch_size: 2
|
| 46 |
- eval_batch_size: 2
|
| 47 |
- seed: 42
|
| 48 |
+
- gradient_accumulation_steps: 32
|
| 49 |
+
- total_train_batch_size: 64
|
| 50 |
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
|
| 51 |
- lr_scheduler_type: linear
|
| 52 |
- lr_scheduler_warmup_ratio: 0.03
|
| 53 |
+
- num_epochs: 5
|
| 54 |
- mixed_precision_training: Native AMP
|
| 55 |
|
| 56 |
### Training results
|
| 57 |
|
| 58 |
| Training Loss | Epoch | Step | Validation Loss |
|
| 59 |
|:-------------:|:-----:|:----:|:---------------:|
|
| 60 |
+
| 0.2086 | 0.32 | 2 | 6.1580 |
|
| 61 |
+
| 0.1811 | 0.64 | 4 | 5.1228 |
|
| 62 |
+
| 0.1542 | 0.96 | 6 | 4.5230 |
|
| 63 |
+
| 0.3444 | 1.16 | 8 | 4.0204 |
|
| 64 |
+
| 0.1211 | 1.48 | 10 | 3.5760 |
|
| 65 |
+
| 0.1076 | 1.8 | 12 | 3.1542 |
|
| 66 |
+
| 0.2279 | 2.0 | 14 | 2.7274 |
|
| 67 |
+
| 0.0812 | 2.32 | 16 | 2.3581 |
|
| 68 |
+
| 0.0707 | 2.64 | 18 | 2.0595 |
|
| 69 |
+
| 0.0613 | 2.96 | 20 | 1.8119 |
|
| 70 |
+
| 0.1386 | 3.16 | 22 | 1.6140 |
|
| 71 |
+
| 0.0481 | 3.48 | 24 | 1.4556 |
|
| 72 |
+
| 0.0439 | 3.8 | 26 | 1.3301 |
|
| 73 |
+
| 0.1025 | 4.0 | 28 | 1.2408 |
|
| 74 |
+
| 0.0376 | 4.32 | 30 | 1.1838 |
|
| 75 |
+
| 0.036 | 4.64 | 32 | 1.1499 |
|
| 76 |
+
| 0.0354 | 4.96 | 34 | 1.1324 |
|
| 77 |
|
| 78 |
|
| 79 |
### Framework versions
|