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

Update sampling_params.md

parent ad82bac6
...@@ -84,9 +84,12 @@ response = requests.post( ...@@ -84,9 +84,12 @@ response = requests.post(
) )
prev = 0 prev = 0
for chunk in response.iter_lines(decode_unicode=False, delimiter=b"\0"): for chunk in response.iter_lines(decode_unicode=False):
if chunk: chunk = chunk.decode("utf-8")
data = json.loads(chunk.decode()) if chunk and chunk.startswith("data:"):
if chunk == "data: [DONE]":
break
data = json.loads(chunk[5:].strip("\n"))
output = data["text"].strip() output = data["text"].strip()
print(output[prev:], end="", flush=True) print(output[prev:], end="", flush=True)
prev = len(output) prev = len(output)
......
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