Unverified Commit 98a3e8ef authored by Lianmin Zheng's avatar Lianmin Zheng Committed by GitHub
Browse files

Add a llava example (#47)

parent 2b079f89
import sglang as sgl
@sgl.function
def image_qa(s, image_path, question):
s += sgl.user(sgl.image(image_path) + question)
s += sgl.assistant(sgl.gen("answer"))
runtime = sgl.Runtime(model_path="liuhaotian/llava-v1.5-7b",
tokenizer_path="llava-hf/llava-1.5-7b-hf")
sgl.set_default_backend(runtime)
state = image_qa.run(image_path="images/cat.jpeg", question="What is this?")
print(state["answer"])
runtime.shutdown()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment