OpenAI Compatible Frontend (#116)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import argparse
|
||||
import uuid
|
||||
|
||||
from cacheflow import ServerArgs, LLMServer, SamplingParams
|
||||
|
||||
@@ -20,17 +19,19 @@ def main(args: argparse.Namespace):
|
||||
SamplingParams(n=3, best_of=3, use_beam_search=True, temperature=0.0)),
|
||||
]
|
||||
|
||||
request_id = 0
|
||||
|
||||
# Run the server.
|
||||
while True:
|
||||
# To test iteration-level scheduling, we add one request at each step.
|
||||
if test_prompts:
|
||||
prompt, sampling_params = test_prompts.pop(0)
|
||||
request_id = str(uuid.uuid4().hex[:8])
|
||||
server.add_request(request_id, prompt, sampling_params)
|
||||
server.add_request(str(request_id), prompt, sampling_params)
|
||||
request_id += 1
|
||||
|
||||
request_outputs = server.step()
|
||||
for request_output in request_outputs:
|
||||
if request_output.done:
|
||||
if request_output.finished():
|
||||
print(request_output)
|
||||
|
||||
if not (server.has_unfinished_requests() or test_prompts):
|
||||
|
||||
Reference in New Issue
Block a user