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

Fix logit processor bugs (#427)

parent 7023f413
../lang/example_image.png
\ No newline at end of file
...@@ -3,7 +3,6 @@ Usage: ...@@ -3,7 +3,6 @@ Usage:
python3 -m sglang.launch_server --model-path TinyLlama/TinyLlama-1.1B-Chat-v0.4 --port 30000 python3 -m sglang.launch_server --model-path TinyLlama/TinyLlama-1.1B-Chat-v0.4 --port 30000
python3 test_httpserver_decode.py python3 test_httpserver_decode.py
Output: Output:
The capital of France is Paris.\nThe capital of the United States is Washington, D.C.\nThe capital of Canada is Ottawa.\nThe capital of Japan is Tokyo The capital of France is Paris.\nThe capital of the United States is Washington, D.C.\nThe capital of Canada is Ottawa.\nThe capital of Japan is Tokyo
""" """
...@@ -23,6 +22,7 @@ def test_decode(url, return_logprob, top_logprobs_num, return_text): ...@@ -23,6 +22,7 @@ def test_decode(url, return_logprob, top_logprobs_num, return_text):
"temperature": 0, "temperature": 0,
"max_new_tokens": 32, "max_new_tokens": 32,
}, },
"stream": False,
"return_logprob": return_logprob, "return_logprob": return_logprob,
"top_logprobs_num": top_logprobs_num, "top_logprobs_num": top_logprobs_num,
"return_text_in_logprobs": return_text, "return_text_in_logprobs": return_text,
......
...@@ -26,6 +26,7 @@ def test_decode_stream(url, return_logprob, top_logprobs_num): ...@@ -26,6 +26,7 @@ def test_decode_stream(url, return_logprob, top_logprobs_num):
"return_logprob": return_logprob, "return_logprob": return_logprob,
"top_logprobs_num": top_logprobs_num, "top_logprobs_num": top_logprobs_num,
"return_text_in_logprobs": True, "return_text_in_logprobs": True,
"logprob_start_len": 0,
}, },
stream=True, stream=True,
) )
......
...@@ -34,7 +34,7 @@ async def test_concurrent(args): ...@@ -34,7 +34,7 @@ async def test_concurrent(args):
url + "/generate", url + "/generate",
{ {
"text": "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions. USER: <image>\nDescribe this picture ASSISTANT:", "text": "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions. USER: <image>\nDescribe this picture ASSISTANT:",
"image_data": "test_image.png", "image_data": "example_image.png",
"sampling_params": { "sampling_params": {
"temperature": 0, "temperature": 0,
"max_new_tokens": 16, "max_new_tokens": 16,
...@@ -55,7 +55,7 @@ def test_streaming(args): ...@@ -55,7 +55,7 @@ def test_streaming(args):
url + "/generate", url + "/generate",
json={ json={
"text": "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions. USER: <image>\nDescribe this picture ASSISTANT:", "text": "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions. USER: <image>\nDescribe this picture ASSISTANT:",
"image_data": "test_image.png", "image_data": "example_image.png",
"sampling_params": { "sampling_params": {
"temperature": 0, "temperature": 0,
"max_new_tokens": 128, "max_new_tokens": 128,
......
...@@ -6,10 +6,10 @@ The capital of France is Paris.\nThe capital of the United States is Washington, ...@@ -6,10 +6,10 @@ The capital of France is Paris.\nThe capital of the United States is Washington,
""" """
import argparse import argparse
import time
import requests import requests
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--host", type=str, default="http://127.0.0.1") parser.add_argument("--host", type=str, default="http://127.0.0.1")
......
...@@ -163,7 +163,7 @@ def test_regex(args): ...@@ -163,7 +163,7 @@ def test_regex(args):
regex = ( regex = (
r"""\{\n""" r"""\{\n"""
+ r""" "name": "[\w]+",\n""" + r""" "name": "[\w]+",\n"""
+ r""" "population": "[\w\d\s]+"\n""" + r""" "population": [\w\d\s]+\n"""
+ r"""\}""" + r"""\}"""
) )
......
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