Fuyu Example
Source vllm-project/vllm.
1import requests2from PIL import Image34from vllm import LLM, SamplingParams567def run_fuyu():8 llm = LLM(model="adept/fuyu-8b", max_model_len=4096)910 # single-image prompt11 prompt = "What is the highest life expectancy at of male?\n"12 url = "https://huggingface.co/adept/fuyu-8b/resolve/main/chart.png"13 image = Image.open(requests.get(url, stream=True).raw)14 sampling_params = SamplingParams(temperature=0, max_tokens=64)1516 outputs = llm.generate(17 {18 "prompt": prompt,19 "multi_modal_data": {20 "image": image21 },22 },23 sampling_params=sampling_params)2425 for o in outputs:26 generated_text = o.outputs[0].text27 print(generated_text)282930if __name__ == "__main__":31 run_fuyu()