Views
No views yet
google/medgemma-1.5-4b-it using NVFP4 via llmcompressor.1from vllm import LLM, SamplingParams
2from vllm.assets.image import ImageAsset
3from transformers import AutoProcessor
4
5model_name = "MedGemmaImpact/medgemma-1.5-4b-it-nvfp4"
6
7# Load image and processor
8image = ImageAsset("cherry_blossom").pil_image.convert("RGB")
9processor = AutoProcessor.from_pretrained(model_name, trust_remote_code=True)
10
11# Build multimodal prompt
12chat = [
13 {"role": "user", "content": [{"type": "image"}, {"type": "text", "text": "What is in this image?"}]},
14 {"role": "assistant", "content": []}
15]
16prompt = processor.apply_chat_template(chat, add_generation_prompt=True)
17
18# Initialize model
19llm = LLM(model=model_name, trust_remote_code=True)
20
21# Run inference
22inputs = {"prompt": prompt, "multi_modal_data": {"image": [image]}}
23outputs = llm.generate(inputs, SamplingParams(temperature=0.2, max_tokens=64))
24
25print("RESPONSE:", outputs[0].outputs[0].text)flickr30k2561024