|
|
|
from transformers import AutoTokenizer, AutoModelForCausalLM |
|
from transformers.generation import GenerationConfig |
|
|
|
|
|
tokenizer = AutoTokenizer.from_pretrained("qwen/Qwen-VL-Chat",trust_remote_code=True) |
|
|
|
model = AutoModelForCausalLM.from_pretrained( |
|
"AgoraX/Qwen-VL-FNCall", |
|
device_map="cuda", |
|
trust_remote_code=True |
|
).eval() |
|
|
|
|
|
|
|
|
|
|
|
|
|
query = tokenizer.from_list_format([ |
|
{'image': 'https://images.rawpixel.com/image_800/cHJpdmF0ZS9sci9pbWFnZXMvd2Vic2l0ZS8yMDIzLTA4L3Jhd3BpeGVsX29mZmljZV8xNV9waG90b19vZl9hX2RvZ19ydW5uaW5nX3dpdGhfb3duZXJfYXRfcGFya19lcF9mM2I3MDQyZC0zNWJlLTRlMTQtOGZhNy1kY2Q2OWQ1YzQzZjlfMi5qcGc.jpg'}, |
|
{'text': "What are the objects in the image? What animals are present? Are there any people in the image?"}, |
|
]) |
|
print("sending model to chat") |
|
response, history = model.chat(tokenizer, query=query, history=None) |
|
print(response) |
|
|
|
|
|
|