Skip to content

Commit

Permalink
[side-effect] fix gradio demo error (#2976)
Browse files Browse the repository at this point in the history
  • Loading branch information
lvhan028 authored Dec 30, 2024
1 parent 9c16443 commit b7a56c7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lmdeploy/serve/gradio/vl.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,13 @@ def chat(chatbot, session, max_new_tokens, top_p, top_k, temperature):
else:
prompt = history[-1][0][0]
images = history[-1][0][1:]
prompt = (prompt, images)

logger.info('prompt: ' + str(prompt))
prompt = engine.vl_prompt_template.prompt_to_messages(prompt)
# convert prompt into GPT4V format
prompt = [
dict(role='user', content=[dict(type='text', text=prompt)])
]
for image in images:
prompt[0]['content'].append(
dict(type='image_data', image_data=dict(data=image)))
t0 = time.perf_counter()
inputs = _run_until_complete(
engine._get_prompt_input(prompt, True, sequence_start, ''))
Expand Down

0 comments on commit b7a56c7

Please sign in to comment.