fix test bug in srt_llava_next_test.py #470
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
otherwise it will cause error like below:
========== single ==========
/home/ubuntu/wubing/sglang/python/sglang/lang/interpreter.py:328: UserWarning: Error in stream_executor: Traceback (most recent call last):
File "/home/ubuntu/wubing/sglang/python/sglang/lang/interpreter.py", line 326, in _thread_worker_func
self._execute(expr)
File "/home/ubuntu/wubing/sglang/python/sglang/lang/interpreter.py", line 369, in _execute
self._execute(x)
File "/home/ubuntu/wubing/sglang/python/sglang/lang/interpreter.py", line 369, in _execute
self._execute(x)
File "/home/ubuntu/wubing/sglang/python/sglang/lang/interpreter.py", line 375, in _execute
self._execute_image(other)
File "/home/ubuntu/wubing/sglang/python/sglang/lang/interpreter.py", line 419, in _execute_image
base64_data = encode_image_base64(path)
File "/home/ubuntu/wubing/sglang/python/sglang/utils.py", line 116, in encode_image_base64
image.save(buffered, format="PNG")
AttributeError: 'tuple' object has no attribute 'save'
warnings.warn(f"Error in stream_executor: {get_exception_traceback()}")
Traceback (most recent call last):
File "/home/ubuntu/wubing/sglang/examples/usage/llava/srt_llava_next_test.py", line 78, in
single()
File "/home/ubuntu/wubing/sglang/examples/usage/llava/srt_llava_next_test.py", line 22, in single
print(state["answer"], "\n")
File "/home/ubuntu/wubing/sglang/python/sglang/lang/interpreter.py", line 844, in getitem
return self.get_var(name)
File "/home/ubuntu/wubing/sglang/python/sglang/lang/interpreter.py", line 831, in get_var
return self.stream_executor.get_var(name)
File "/home/ubuntu/wubing/sglang/python/sglang/lang/interpreter.py", line 252, in get_var
return self.variables[name]
KeyError: 'answer'