Image-Text-to-Text
Transformers
gemma3_text
medical
radiology
clinical-reasoning
dermatology
pathology
ophthalmology
chest-x-ray
conversational
Instructions to use FastFlowLM/medgemma-4b-it-NPU2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FastFlowLM/medgemma-4b-it-NPU2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="FastFlowLM/medgemma-4b-it-NPU2") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("FastFlowLM/medgemma-4b-it-NPU2", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use FastFlowLM/medgemma-4b-it-NPU2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "FastFlowLM/medgemma-4b-it-NPU2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FastFlowLM/medgemma-4b-it-NPU2", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/FastFlowLM/medgemma-4b-it-NPU2
- SGLang
How to use FastFlowLM/medgemma-4b-it-NPU2 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 "FastFlowLM/medgemma-4b-it-NPU2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FastFlowLM/medgemma-4b-it-NPU2", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "FastFlowLM/medgemma-4b-it-NPU2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FastFlowLM/medgemma-4b-it-NPU2", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use FastFlowLM/medgemma-4b-it-NPU2 with Docker Model Runner:
docker model run hf.co/FastFlowLM/medgemma-4b-it-NPU2
ngdxzy commited on
Commit ·
809e25d
1
Parent(s): 3834d00
feat: optimize vision
Browse files- config.json +1 -1
- dequant.xclbin +1 -1
- mm.xclbin +2 -2
- vision_mm.xclbin +2 -2
- vision_weight.q4nx +2 -2
config.json
CHANGED
|
@@ -32,7 +32,7 @@
|
|
| 32 |
"addr_l_begin_mha": 53760,
|
| 33 |
"addr_l_end_mha": 25088,
|
| 34 |
"addr_kk": 45056,
|
| 35 |
-
"flm_version": "0.9.
|
| 36 |
"vision_model_weight": "vision_weight.q4nx",
|
| 37 |
"vision_mm_engine_xclbin_name": "vision_mm.xclbin",
|
| 38 |
"vision_mha_engine_xclbin_name":"vision_attn.xclbin",
|
|
|
|
| 32 |
"addr_l_begin_mha": 53760,
|
| 33 |
"addr_l_end_mha": 25088,
|
| 34 |
"addr_kk": 45056,
|
| 35 |
+
"flm_version": "0.9.23",
|
| 36 |
"vision_model_weight": "vision_weight.q4nx",
|
| 37 |
"vision_mm_engine_xclbin_name": "vision_mm.xclbin",
|
| 38 |
"vision_mha_engine_xclbin_name":"vision_attn.xclbin",
|
dequant.xclbin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 114059
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c7a392a444613b0d281f4f2d05f1f7d1d34eb26a6824ac44dbe1f871209b505f
|
| 3 |
size 114059
|
mm.xclbin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aba4dbcb8b033dac2abe9a16ebf173296a7cc365c5bca6a09dee5c344ab82efe
|
| 3 |
+
size 507419
|
vision_mm.xclbin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e0b511bc64cbc43955ef78056593a1fa9848b7adcf7af43b6e6a259733de9c42
|
| 3 |
+
size 516123
|
vision_weight.q4nx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:415579eff318b7113d568d43d5e921d9d74141eeacd0704dad0c66a8ecd911df
|
| 3 |
+
size 973721768
|