mirror of
https://github.com/FunAudioLLM/CosyVoice.git
synced 2026-02-04 09:29:25 +08:00
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.
This commit is contained in:
@@ -385,7 +385,7 @@ class CosyVoice2Model(CosyVoiceModel):
|
||||
# this_uuid is used to track variables related to this inference thread
|
||||
self.synchronize_stream()
|
||||
stream_context = self.stream_context_pool.get()
|
||||
with torch.cuda.stream(stream_context):
|
||||
with stream_context:
|
||||
|
||||
this_uuid = str(uuid.uuid1())
|
||||
with self.lock:
|
||||
|
||||
Reference in New Issue
Block a user