Upload dataset.py with huggingface_hub
Browse files- dataset.py +12 -46
dataset.py
CHANGED
|
@@ -1,49 +1,19 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
# blocks.py
|
| 5 |
-
# card.py
|
| 6 |
-
# catalog.py
|
| 7 |
-
# collections.py
|
| 8 |
-
# common.py
|
| 9 |
-
# file_utils.py
|
| 10 |
-
# fusion.py
|
| 11 |
-
# generator_utils.py
|
| 12 |
-
# instructions.py
|
| 13 |
-
# loaders.py
|
| 14 |
-
# load.py
|
| 15 |
-
# metric.py
|
| 16 |
-
# metrics.py
|
| 17 |
-
# normalizers.py
|
| 18 |
-
# operator.py
|
| 19 |
-
# operators.py
|
| 20 |
-
# processors.py
|
| 21 |
-
# recipe.py
|
| 22 |
-
# register.py
|
| 23 |
-
# splitters.py
|
| 24 |
-
# split_utils.py
|
| 25 |
-
# stream.py
|
| 26 |
-
# task.py
|
| 27 |
-
# templates.py
|
| 28 |
-
# text_utils.py
|
| 29 |
-
# utilize.py
|
| 30 |
-
# validate.py
|
| 31 |
-
#####
|
| 32 |
-
# imports for hf system:
|
| 33 |
-
#####
|
| 34 |
from .artifact import __file__ as _
|
|
|
|
| 35 |
from .blocks import __file__ as _
|
| 36 |
from .card import __file__ as _
|
| 37 |
from .catalog import __file__ as _
|
| 38 |
from .collections import __file__ as _
|
| 39 |
from .common import __file__ as _
|
| 40 |
from .file_utils import __file__ as _
|
| 41 |
-
|
| 42 |
-
# from .fusion import __file__
|
| 43 |
from .generator_utils import __file__ as _
|
| 44 |
from .instructions import __file__ as _
|
| 45 |
-
from .loaders import __file__ as _
|
| 46 |
from .load import __file__ as _
|
|
|
|
| 47 |
from .metric import __file__ as _
|
| 48 |
from .metrics import __file__ as _
|
| 49 |
from .normalizers import __file__ as _
|
|
@@ -52,22 +22,17 @@ from .operators import __file__ as _
|
|
| 52 |
from .processors import __file__ as _
|
| 53 |
from .recipe import __file__ as _
|
| 54 |
from .register import __file__ as _
|
|
|
|
| 55 |
from .schema import __file__ as _
|
| 56 |
-
from .splitters import __file__ as _
|
| 57 |
from .split_utils import __file__ as _
|
|
|
|
| 58 |
from .stream import __file__ as _
|
| 59 |
from .task import __file__ as _
|
| 60 |
from .templates import __file__ as _
|
| 61 |
from .text_utils import __file__ as _
|
|
|
|
|
|
|
| 62 |
|
| 63 |
-
# from .utilize import __file__ as _
|
| 64 |
-
# from .validate import __file__ as _
|
| 65 |
-
#############
|
| 66 |
-
|
| 67 |
-
from .register import register_blocks
|
| 68 |
-
from .artifact import Artifact, fetch_artifact, UnitxtArtifactNotFoundError
|
| 69 |
-
|
| 70 |
-
import datasets
|
| 71 |
|
| 72 |
def fetch(artifact_name):
|
| 73 |
try:
|
|
@@ -76,6 +41,7 @@ def fetch(artifact_name):
|
|
| 76 |
except UnitxtArtifactNotFoundError:
|
| 77 |
return None
|
| 78 |
|
|
|
|
| 79 |
def parse(query: str):
|
| 80 |
"""
|
| 81 |
Parses a query of the form 'key1=value1,key2=value2,...' into a dictionary.
|
|
@@ -101,7 +67,7 @@ class Dataset(datasets.GeneratorBasedBuilder):
|
|
| 101 |
|
| 102 |
@property
|
| 103 |
def generators(self):
|
| 104 |
-
|
| 105 |
if not hasattr(self, "_generators") or self._generators is None:
|
| 106 |
recipe = fetch(self.config.name)
|
| 107 |
if recipe is None:
|
|
|
|
| 1 |
+
import datasets
|
| 2 |
+
|
| 3 |
+
from .artifact import Artifact, UnitxtArtifactNotFoundError
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
from .artifact import __file__ as _
|
| 5 |
+
from .artifact import fetch_artifact
|
| 6 |
from .blocks import __file__ as _
|
| 7 |
from .card import __file__ as _
|
| 8 |
from .catalog import __file__ as _
|
| 9 |
from .collections import __file__ as _
|
| 10 |
from .common import __file__ as _
|
| 11 |
from .file_utils import __file__ as _
|
| 12 |
+
from .fusion import __file__ as _
|
|
|
|
| 13 |
from .generator_utils import __file__ as _
|
| 14 |
from .instructions import __file__ as _
|
|
|
|
| 15 |
from .load import __file__ as _
|
| 16 |
+
from .loaders import __file__ as _
|
| 17 |
from .metric import __file__ as _
|
| 18 |
from .metrics import __file__ as _
|
| 19 |
from .normalizers import __file__ as _
|
|
|
|
| 22 |
from .processors import __file__ as _
|
| 23 |
from .recipe import __file__ as _
|
| 24 |
from .register import __file__ as _
|
| 25 |
+
from .register import register_all_artifacts
|
| 26 |
from .schema import __file__ as _
|
|
|
|
| 27 |
from .split_utils import __file__ as _
|
| 28 |
+
from .splitters import __file__ as _
|
| 29 |
from .stream import __file__ as _
|
| 30 |
from .task import __file__ as _
|
| 31 |
from .templates import __file__ as _
|
| 32 |
from .text_utils import __file__ as _
|
| 33 |
+
from .utils import __file__ as _
|
| 34 |
+
from .validate import __file__ as _
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
def fetch(artifact_name):
|
| 38 |
try:
|
|
|
|
| 41 |
except UnitxtArtifactNotFoundError:
|
| 42 |
return None
|
| 43 |
|
| 44 |
+
|
| 45 |
def parse(query: str):
|
| 46 |
"""
|
| 47 |
Parses a query of the form 'key1=value1,key2=value2,...' into a dictionary.
|
|
|
|
| 67 |
|
| 68 |
@property
|
| 69 |
def generators(self):
|
| 70 |
+
register_all_artifacts()
|
| 71 |
if not hasattr(self, "_generators") or self._generators is None:
|
| 72 |
recipe = fetch(self.config.name)
|
| 73 |
if recipe is None:
|