import sys from PIL import Image from vllm import LLM, SamplingParams def main(): llm = LLM(model="/vl", dtype="bfloat16", max_model_len=8192, gpu_memory_utilization=0.4, limit_mm_per_prompt={"image": 4}, enforce_eager=True) msgs = [{"role": "user", "content": [{"type": "image_pil", "image_pil": Image.open("/tests/vl/images/photo.jpeg").convert("RGB")}, {"type": "text", "text": "What newspaper is this?"}]}] o = llm.chat(msgs, SamplingParams(max_tokens=80, temperature=0.0))[0] print("PROMPT_LEN", len(o.prompt_token_ids), "IMG_TOK", o.prompt_token_ids.count(125030)) print("OUT", repr(o.outputs[0].text)) if __name__ == "__main__": main()