File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
tensorrt_llm/_torch/models/checkpoints/hf Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1
1
import glob
2
2
import multiprocessing
3
3
import os
4
+ from concurrent .futures import ThreadPoolExecutor
4
5
from typing import Any , List
5
6
6
7
import psutil
@@ -120,7 +121,7 @@ def prefetch_files(self, file_names: List[str]):
120
121
if len (local_file_names ) == 0 :
121
122
return
122
123
123
- max_processes = min (multiprocessing .cpu_count () * 2 , 16 ,
124
- len (local_file_names ))
125
- with multiprocessing . Pool ( processes = max_processes ) as pool :
126
- pool .map (self ._prefetch_one_file , local_file_names )
124
+ max_workers = min (multiprocessing .cpu_count () * 2 , 16 ,
125
+ len (local_file_names ))
126
+ with ThreadPoolExecutor ( max_workers = max_workers ) as executor :
127
+ list ( executor .map (self ._prefetch_one_file , local_file_names ) )
You can’t perform that action at this time.
0 commit comments