bugfix
This commit is contained in:
parent
05fa9e411c
commit
1e068f1bcd
@ -37,7 +37,7 @@ class Qwen2VLClass:
|
||||
# max_pixels = 1280*28*28
|
||||
# processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct", min_pixels=min_pixels, max_pixels=max_pixels)
|
||||
|
||||
def inference(self, prompt, image=None, videofile=None):
|
||||
def inference(self, prompt, image, videofile):
|
||||
content = [
|
||||
{
|
||||
"type":"text",
|
||||
@ -88,10 +88,10 @@ class Qwen2VLClass:
|
||||
generated_ids_trimmed = [
|
||||
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
||||
]
|
||||
output_text = processor.batch_decode(
|
||||
output_text = self.processor.batch_decode(
|
||||
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
||||
)
|
||||
return output_text
|
||||
return output_text[0]
|
||||
|
||||
def main():
|
||||
config = getConfig()
|
||||
|
@ -1,3 +1,4 @@
|
||||
import time
|
||||
import requests
|
||||
import base64
|
||||
|
||||
@ -21,9 +22,11 @@ while True:
|
||||
i = input()
|
||||
if p == '' or i == '':
|
||||
continue
|
||||
t1 = time.time()
|
||||
ret = requests.get('http://pd4e.com:10090/api',
|
||||
params={
|
||||
'prompt':p,
|
||||
'image':file2b64(i)
|
||||
})
|
||||
print(ret.text)
|
||||
t2 = time.time()
|
||||
print(ret.text, t2 - t1, 'seconds')
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"password_key":"!@#$%^&*(*&^%$QWERTYUIqwertyui234567",
|
||||
"modelname":"Qwen/Qwen2-VL-7B-Instruct",
|
||||
"modelname":"Qwen/Qwen2-VL-2B-Instruct",
|
||||
"modelname":"Qwen/Qwen2-VL-7B-Instruct",
|
||||
"logger":{
|
||||
"name":"qwenvl",
|
||||
"levelname":"info",
|
||||
|
@ -1,3 +1,3 @@
|
||||
info(f'{params_kw=}')
|
||||
return inference(params_kw.prompt, image=params_kw.image, video=params_kw.video)
|
||||
return await inference(params_kw.prompt, params_kw.image, params_kw.video)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user