Spaces:
Running
Running
Joshua Lochner
commited on
Commit
•
7781f10
1
Parent(s):
9ced7bd
Add compatibility for python 3.6+
Browse files- src/model.py +1 -1
- src/utils.py +4 -1
src/model.py
CHANGED
@@ -58,7 +58,7 @@ class ModelArguments:
|
|
58 |
)
|
59 |
|
60 |
|
61 |
-
@lru_cache
|
62 |
def get_classifier_vectorizer(classifier_args):
|
63 |
classifier_path = os.path.join(
|
64 |
classifier_args.classifier_dir, classifier_args.classifier_file)
|
|
|
58 |
)
|
59 |
|
60 |
|
61 |
+
@lru_cache(maxsize=None)
|
62 |
def get_classifier_vectorizer(classifier_args):
|
63 |
classifier_path = os.path.join(
|
64 |
classifier_args.classifier_dir, classifier_args.classifier_file)
|
src/utils.py
CHANGED
@@ -157,7 +157,10 @@ class InterruptibleTaskPool:
|
|
157 |
t = time()
|
158 |
# Send SIGINT if process doesn't exit quickly enough, and kill it as last resort
|
159 |
# .is_alive() also implicitly joins the process (good practice in linux)
|
160 |
-
while
|
|
|
|
|
|
|
161 |
if time() > t + self.grace_period:
|
162 |
for p in alive_procs:
|
163 |
os.kill(p.pid, signal.SIGINT)
|
|
|
157 |
t = time()
|
158 |
# Send SIGINT if process doesn't exit quickly enough, and kill it as last resort
|
159 |
# .is_alive() also implicitly joins the process (good practice in linux)
|
160 |
+
while True:
|
161 |
+
alive_procs = [p for p in procs if p.is_alive()]
|
162 |
+
if not alive_procs:
|
163 |
+
break
|
164 |
if time() > t + self.grace_period:
|
165 |
for p in alive_procs:
|
166 |
os.kill(p.pid, signal.SIGINT)
|