Instructions to use yloa/medgemma-4b-it-sft-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use yloa/medgemma-4b-it-sft-lora 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, "yloa/medgemma-4b-it-sft-lora") - Transformers
How to use yloa/medgemma-4b-it-sft-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yloa/medgemma-4b-it-sft-lora")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("yloa/medgemma-4b-it-sft-lora", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use yloa/medgemma-4b-it-sft-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yloa/medgemma-4b-it-sft-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yloa/medgemma-4b-it-sft-lora", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/yloa/medgemma-4b-it-sft-lora
- SGLang
How to use yloa/medgemma-4b-it-sft-lora 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 "yloa/medgemma-4b-it-sft-lora" \ --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": "yloa/medgemma-4b-it-sft-lora", "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 "yloa/medgemma-4b-it-sft-lora" \ --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": "yloa/medgemma-4b-it-sft-lora", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Unsloth Studio new
How to use yloa/medgemma-4b-it-sft-lora with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for yloa/medgemma-4b-it-sft-lora to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for yloa/medgemma-4b-it-sft-lora to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for yloa/medgemma-4b-it-sft-lora to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="yloa/medgemma-4b-it-sft-lora", max_seq_length=2048, ) - Docker Model Runner
How to use yloa/medgemma-4b-it-sft-lora with Docker Model Runner:
docker model run hf.co/yloa/medgemma-4b-it-sft-lora
medgemma-4b-it-sft-lora
This model is a fine-tuned version of unsloth/medgemma-4b-it-unsloth-bnb-4bit on the imagefolder dataset. It achieves the following results on the evaluation set:
- Loss: 1.9301
Model description
More information needed
Intended uses & limitations
More information needed
Training and evaluation data
More information needed
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 0.0002
- train_batch_size: 4
- eval_batch_size: 4
- seed: 42
- gradient_accumulation_steps: 4
- total_train_batch_size: 16
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: linear
- lr_scheduler_warmup_ratio: 0.03
- num_epochs: 1
- mixed_precision_training: Native AMP
Training results
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 1.6808 | 0.08 | 2 | 5.7399 |
| 1.3744 | 0.16 | 4 | 4.9466 |
| 1.1947 | 0.24 | 6 | 4.3908 |
| 1.0718 | 0.32 | 8 | 3.9348 |
| 0.9593 | 0.4 | 10 | 3.5351 |
| 0.8604 | 0.48 | 12 | 3.1574 |
| 0.7709 | 0.56 | 14 | 2.7945 |
| 0.686 | 0.64 | 16 | 2.4974 |
| 0.6152 | 0.72 | 18 | 2.2769 |
| 0.5609 | 0.8 | 20 | 2.1125 |
| 0.5274 | 0.88 | 22 | 1.9960 |
| 0.4886 | 0.96 | 24 | 1.9301 |
Framework versions
- PEFT 0.17.1
- Transformers 4.57.1
- Pytorch 2.6.0+cu124
- Datasets 4.4.1
- Tokenizers 0.22.1
- Downloads last month
- -
Model tree for yloa/medgemma-4b-it-sft-lora
Base model
google/gemma-3-4b-pt Finetuned
google/medgemma-4b-pt Finetuned
google/medgemma-4b-it Quantized
unsloth/medgemma-4b-it-unsloth-bnb-4bit