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