mirror of
https://github.com/neonbjb/tortoise-tts.git
synced 2026-01-25 10:00:47 +01:00
13 lines
448 B
Python
13 lines
448 B
Python
import os
|
|
|
|
def pick_max_worker():
|
|
# Determine the number of CPU cores
|
|
cpu_count = os.cpu_count()
|
|
if cpu_count is None:
|
|
cpu_count = 1 # Default to 1 if unable to determine
|
|
|
|
# Assume the tasks are I/O-bound; we can afford to have more workers
|
|
# You might want to adjust this logic based on the nature of your tasks
|
|
max_workers = cpu_count * 2
|
|
print(f"Picked max workers: {max_workers}")
|
|
return max_workers |