Upload register.py with huggingface_hub
Browse files- register.py +1 -13
register.py
CHANGED
@@ -3,19 +3,8 @@ import os
|
|
3 |
import importlib
|
4 |
import inspect
|
5 |
|
6 |
-
from . import blocks
|
7 |
from .artifact import Artifact
|
8 |
from .utils import Singleton
|
9 |
-
|
10 |
-
def register_blocks():
|
11 |
-
# Iterate over every object in the blocks module
|
12 |
-
for name, obj in inspect.getmembers(blocks):
|
13 |
-
# Make sure the object is a class
|
14 |
-
if inspect.isclass(obj):
|
15 |
-
# Make sure the class is a subclass of Artifact (but not Artifact itself)
|
16 |
-
if issubclass(obj, Artifact) and obj is not Artifact:
|
17 |
-
Artifact.register_class(obj)
|
18 |
-
|
19 |
# Usage
|
20 |
non_registered_files = ['__init__.py', 'artifact.py', 'utils.py', 'register.py', 'metric.py', 'dataset.py', 'blocks.py']
|
21 |
|
@@ -38,8 +27,7 @@ def _register_all_artifacts():
|
|
38 |
Artifact.register_class(obj)
|
39 |
|
40 |
|
41 |
-
|
42 |
-
class ProjectArtifactRegisterer():
|
43 |
|
44 |
def __init__(self):
|
45 |
|
|
|
3 |
import importlib
|
4 |
import inspect
|
5 |
|
|
|
6 |
from .artifact import Artifact
|
7 |
from .utils import Singleton
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
# Usage
|
9 |
non_registered_files = ['__init__.py', 'artifact.py', 'utils.py', 'register.py', 'metric.py', 'dataset.py', 'blocks.py']
|
10 |
|
|
|
27 |
Artifact.register_class(obj)
|
28 |
|
29 |
|
30 |
+
class ProjectArtifactRegisterer(Singleton):
|
|
|
31 |
|
32 |
def __init__(self):
|
33 |
|