Support decode token logprobs (#130)
This commit is contained in:
@@ -9,10 +9,24 @@ The capital of France is Paris.\nThe capital of the United States is Washington,
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import time
|
||||
|
||||
import requests
|
||||
|
||||
def test_decode(url, return_logprob):
|
||||
response = requests.post(
|
||||
url + "/generate",
|
||||
json={
|
||||
"text": "The capital of France is",
|
||||
"sampling_params": {
|
||||
"temperature": 0,
|
||||
"max_new_tokens": 32,
|
||||
},
|
||||
"return_logprob": return_logprob,
|
||||
"logprob_start_len": 0,
|
||||
},
|
||||
)
|
||||
print(response.json())
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--host", type=str, default="http://127.0.0.1")
|
||||
@@ -21,16 +35,5 @@ if __name__ == "__main__":
|
||||
|
||||
url = f"{args.host}:{args.port}"
|
||||
|
||||
response = requests.post(
|
||||
url + "/generate",
|
||||
json={
|
||||
"text": "The capital of France is",
|
||||
"sampling_params": {
|
||||
"temperature": 0,
|
||||
"max_new_tokens": 32,
|
||||
},
|
||||
# "return_logprob": True,
|
||||
# "logprob_start_len": 0,
|
||||
},
|
||||
)
|
||||
print(response.json())
|
||||
test_decode(url, False)
|
||||
test_decode(url, True)
|
||||
|
||||
Reference in New Issue
Block a user