Upload jobs/ExtensionJob.py with huggingface_hub
Browse files- jobs/ExtensionJob.py +22 -0
jobs/ExtensionJob.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from collections import OrderedDict
|
| 3 |
+
from jobs import BaseJob
|
| 4 |
+
from toolkit.extension import get_all_extensions_process_dict
|
| 5 |
+
from toolkit.paths import CONFIG_ROOT
|
| 6 |
+
|
| 7 |
+
class ExtensionJob(BaseJob):
|
| 8 |
+
|
| 9 |
+
def __init__(self, config: OrderedDict):
|
| 10 |
+
super().__init__(config)
|
| 11 |
+
self.device = self.get_conf('device', 'cpu')
|
| 12 |
+
self.process_dict = get_all_extensions_process_dict()
|
| 13 |
+
self.load_processes(self.process_dict)
|
| 14 |
+
|
| 15 |
+
def run(self):
|
| 16 |
+
super().run()
|
| 17 |
+
|
| 18 |
+
print("")
|
| 19 |
+
print(f"Running {len(self.process)} process{'' if len(self.process) == 1 else 'es'}")
|
| 20 |
+
|
| 21 |
+
for process in self.process:
|
| 22 |
+
process.run()
|