Text Generation
Transformers
TensorBoard
Safetensors
English
gemma3
image-text-to-text
medical
ecg
cardiology
report-generation
unsloth
gemma
fine-tuned
text-generation-inference
Instructions to use OussamaEL/MedGemma-4B-ECG with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OussamaEL/MedGemma-4B-ECG with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OussamaEL/MedGemma-4B-ECG")# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("OussamaEL/MedGemma-4B-ECG") model = AutoModelForMultimodalLM.from_pretrained("OussamaEL/MedGemma-4B-ECG", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OussamaEL/MedGemma-4B-ECG with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OussamaEL/MedGemma-4B-ECG" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OussamaEL/MedGemma-4B-ECG", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/OussamaEL/MedGemma-4B-ECG
- SGLang
How to use OussamaEL/MedGemma-4B-ECG 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 "OussamaEL/MedGemma-4B-ECG" \ --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": "OussamaEL/MedGemma-4B-ECG", "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 "OussamaEL/MedGemma-4B-ECG" \ --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": "OussamaEL/MedGemma-4B-ECG", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Unsloth Studio
How to use OussamaEL/MedGemma-4B-ECG 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 OussamaEL/MedGemma-4B-ECG 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 OussamaEL/MedGemma-4B-ECG to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for OussamaEL/MedGemma-4B-ECG to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="OussamaEL/MedGemma-4B-ECG", max_seq_length=2048, ) - Docker Model Runner
How to use OussamaEL/MedGemma-4B-ECG with Docker Model Runner:
docker model run hf.co/OussamaEL/MedGemma-4B-ECG
| { | |
| "architectures": [ | |
| "Gemma3ForConditionalGeneration" | |
| ], | |
| "boi_token_index": 255999, | |
| "bos_token_id": 2, | |
| "eoi_token_index": 256000, | |
| "eos_token_id": 1, | |
| "image_token_index": 262144, | |
| "initializer_range": 0.02, | |
| "mm_tokens_per_image": 256, | |
| "model_type": "gemma3", | |
| "pad_token_id": 0, | |
| "text_config": { | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "attn_logit_softcapping": null, | |
| "cache_implementation": "hybrid", | |
| "final_logit_softcapping": null, | |
| "head_dim": 256, | |
| "hidden_activation": "gelu_pytorch_tanh", | |
| "hidden_size": 2560, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 10240, | |
| "max_position_embeddings": 131072, | |
| "model_type": "gemma3_text", | |
| "num_attention_heads": 8, | |
| "num_hidden_layers": 34, | |
| "num_key_value_heads": 4, | |
| "query_pre_attn_scalar": 256, | |
| "rms_norm_eps": 1e-06, | |
| "rope_local_base_freq": 10000, | |
| "rope_scaling": { | |
| "factor": 8.0, | |
| "rope_type": "linear" | |
| }, | |
| "rope_theta": 1000000, | |
| "sliding_window": 1024, | |
| "sliding_window_pattern": 6, | |
| "torch_dtype": "bfloat16", | |
| "use_cache": true, | |
| "vocab_size": 262208 | |
| }, | |
| "torch_dtype": "bfloat16", | |
| "transformers_version": "4.52.4", | |
| "unsloth_fixed": true, | |
| "unsloth_version": "2025.6.5", | |
| "vision_config": { | |
| "attention_dropout": 0.0, | |
| "hidden_act": "gelu_pytorch_tanh", | |
| "hidden_size": 1152, | |
| "image_size": 896, | |
| "intermediate_size": 4304, | |
| "layer_norm_eps": 1e-06, | |
| "model_type": "siglip_vision_model", | |
| "num_attention_heads": 16, | |
| "num_channels": 3, | |
| "num_hidden_layers": 27, | |
| "patch_size": 14, | |
| "torch_dtype": "bfloat16", | |
| "vision_use_head": false | |
| } | |
| } |