Image-Text-to-Text
Transformers
Safetensors
gemma3
Generated from Trainer
sft
trl
conversational
text-generation-inference
Instructions to use wangyichen25/medgemma-4b-it-sft-full-hyperkvasir with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use wangyichen25/medgemma-4b-it-sft-full-hyperkvasir with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="wangyichen25/medgemma-4b-it-sft-full-hyperkvasir") 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 AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("wangyichen25/medgemma-4b-it-sft-full-hyperkvasir") model = AutoModelForImageTextToText.from_pretrained("wangyichen25/medgemma-4b-it-sft-full-hyperkvasir") 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?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use wangyichen25/medgemma-4b-it-sft-full-hyperkvasir with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "wangyichen25/medgemma-4b-it-sft-full-hyperkvasir" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "wangyichen25/medgemma-4b-it-sft-full-hyperkvasir", "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/wangyichen25/medgemma-4b-it-sft-full-hyperkvasir
- SGLang
How to use wangyichen25/medgemma-4b-it-sft-full-hyperkvasir 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 "wangyichen25/medgemma-4b-it-sft-full-hyperkvasir" \ --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": "wangyichen25/medgemma-4b-it-sft-full-hyperkvasir", "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 "wangyichen25/medgemma-4b-it-sft-full-hyperkvasir" \ --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": "wangyichen25/medgemma-4b-it-sft-full-hyperkvasir", "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 wangyichen25/medgemma-4b-it-sft-full-hyperkvasir with Docker Model Runner:
docker model run hf.co/wangyichen25/medgemma-4b-it-sft-full-hyperkvasir
Ctrl+K
- checkpoint-1000
- checkpoint-1040
- checkpoint-1080
- checkpoint-1120
- checkpoint-1160
- checkpoint-120
- checkpoint-1200
- checkpoint-1240
- checkpoint-1280
- checkpoint-1320
- checkpoint-1360
- checkpoint-1400
- checkpoint-1440
- checkpoint-1462
- checkpoint-160
- checkpoint-200
- checkpoint-240
- checkpoint-280
- checkpoint-320
- checkpoint-360
- checkpoint-40
- checkpoint-400
- checkpoint-440
- checkpoint-480
- checkpoint-520
- checkpoint-560
- checkpoint-600
- checkpoint-640
- checkpoint-680
- checkpoint-720
- checkpoint-760
- checkpoint-80
- checkpoint-800
- checkpoint-840
- checkpoint-880
- checkpoint-920
- checkpoint-960
- 4.02 kB
- 1.76 kB
- 1.53 kB
- 2.57 kB
- 158 Bytes
- 4.96 GB xet
- 3.64 GB xet
- 90.6 kB
- 570 Bytes
- 70 Bytes
- 662 Bytes
- 33.4 MB xet
- 1.16 MB