Skip to content

Commit 4e5ea37

Browse files
committed
del create_background_tasks
1 parent a606343 commit 4e5ea37

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

gpt_server/model_worker/base/model_worker_base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ async def api_generate_stream(request: Request):
318318
params.pop("prompt")
319319
logger.debug(f"params {params}")
320320
generator = worker.generate_stream_gate(params)
321-
background_tasks = create_background_tasks(request_id)
322-
return StreamingResponse(generator, background=background_tasks)
321+
# background_tasks = create_background_tasks(request_id)
322+
return StreamingResponse(generator, background=None)
323323

324324

325325
@app.post("/worker_generate_voice_stream")
@@ -331,7 +331,7 @@ async def api_generate_stream(request: Request):
331331
params["request"] = request
332332
logger.debug(f"params {params}")
333333
generator = worker.generate_voice_stream(params)
334-
background_tasks = create_background_tasks(request_id)
334+
# background_tasks = create_background_tasks(request_id)
335335
response_format = params["response_format"]
336336
content_type = {
337337
"mp3": "audio/mpeg",
@@ -343,7 +343,7 @@ async def api_generate_stream(request: Request):
343343
}.get(response_format, f"audio/{response_format}")
344344
return StreamingResponse(
345345
generator,
346-
background=background_tasks,
346+
background=None,
347347
media_type=content_type,
348348
headers={
349349
"Content-Disposition": f"attachment; filename=speech.{response_format}",
@@ -365,8 +365,8 @@ async def api_generate(request: Request):
365365
logger.debug(f"params {params}")
366366
output = await worker.generate_gate(params)
367367
release_worker_semaphore()
368-
if os.getenv("backend") == "vllm":
369-
await worker.backend.engine.abort(request_id)
368+
# if os.getenv("backend") == "vllm":
369+
# await worker.backend.engine.abort(request_id)
370370
return JSONResponse(output)
371371

372372

gpt_server/model_worker/spark_tts.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ async def stream_async(self, params):
131131
async for chunk_data in generator:
132132
audio = audio_writer.write_chunk(chunk_data, finalize=False)
133133
yield audio
134-
yield audio_writer.write_chunk(finalize=True)
134+
end_chunk_data = audio_writer.write_chunk(finalize=True)
135+
yield end_chunk_data
136+
logger.debug(f"end_chunk_data 长度:{len(end_chunk_data)}")
135137

136138

137139
if __name__ == "__main__":

0 commit comments

Comments
 (0)