Upload extensions_built_in/dataset_tools/DatasetTools.py with huggingface_hub
Browse files
extensions_built_in/dataset_tools/DatasetTools.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections import OrderedDict
|
| 2 |
+
import gc
|
| 3 |
+
import torch
|
| 4 |
+
from jobs.process import BaseExtensionProcess
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def flush():
|
| 8 |
+
torch.cuda.empty_cache()
|
| 9 |
+
gc.collect()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
class DatasetTools(BaseExtensionProcess):
|
| 13 |
+
|
| 14 |
+
def __init__(self, process_id: int, job, config: OrderedDict):
|
| 15 |
+
super().__init__(process_id, job, config)
|
| 16 |
+
|
| 17 |
+
def run(self):
|
| 18 |
+
super().run()
|
| 19 |
+
|
| 20 |
+
raise NotImplementedError("This extension is not yet implemented")
|