Skip to content

Commit e8a2682

Browse files
committed
Refactor CUDA stream context management in CosyVoice2Model
- Replaced the use of torch.cuda.stream with a direct context management approach for improved clarity and performance during inference. - This change simplifies the stream handling code while maintaining efficient resource utilization.
1 parent 369f3c2 commit e8a2682

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cosyvoice/cli/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def tts(self, text, flow_embedding, llm_embedding=torch.zeros(0, 192),
385385
# this_uuid is used to track variables related to this inference thread
386386
self.synchronize_stream()
387387
stream_context = self.stream_context_pool.get()
388-
with torch.cuda.stream(stream_context):
388+
with stream_context:
389389

390390
this_uuid = str(uuid.uuid1())
391391
with self.lock:

0 commit comments

Comments
 (0)