yonikremer
commited on
Commit
•
91ce433
1
Parent(s):
fca1dff
made the sever start script asynchronous multithreaded
Browse files- on_server_start.py +7 -6
on_server_start.py
CHANGED
@@ -1,10 +1,13 @@
|
|
1 |
"""
|
2 |
A script that is run when the server starts.
|
3 |
"""
|
4 |
-
from
|
|
|
5 |
from transformers import logging as transformers_logging
|
6 |
from huggingface_hub import logging as huggingface_hub_logging
|
7 |
|
|
|
|
|
8 |
|
9 |
def disable_progress_bar():
|
10 |
"""
|
@@ -24,13 +27,11 @@ def download_useful_models():
|
|
24 |
"facebook/opt-125m",
|
25 |
"facebook/opt-iml-max-30b",
|
26 |
)
|
27 |
-
|
28 |
-
download_repository
|
29 |
-
model_name,
|
30 |
-
)
|
31 |
|
32 |
|
33 |
-
def main():
|
34 |
disable_progress_bar()
|
35 |
download_useful_models()
|
36 |
|
|
|
1 |
"""
|
2 |
A script that is run when the server starts.
|
3 |
"""
|
4 |
+
from concurrent.futures import ThreadPoolExecutor
|
5 |
+
|
6 |
from transformers import logging as transformers_logging
|
7 |
from huggingface_hub import logging as huggingface_hub_logging
|
8 |
|
9 |
+
from download_repo import download_repository
|
10 |
+
|
11 |
|
12 |
def disable_progress_bar():
|
13 |
"""
|
|
|
27 |
"facebook/opt-125m",
|
28 |
"facebook/opt-iml-max-30b",
|
29 |
)
|
30 |
+
with ThreadPoolExecutor() as executor:
|
31 |
+
executor.map(download_repository, useful_models)
|
|
|
|
|
32 |
|
33 |
|
34 |
+
async def main():
|
35 |
disable_progress_bar()
|
36 |
download_useful_models()
|
37 |
|