Commit
·
f24d16b
1
Parent(s):
4649fcf
Update atlas-preprocessed-code.py
Browse files- atlas-preprocessed-code.py +17 -17
atlas-preprocessed-code.py
CHANGED
|
@@ -6,41 +6,41 @@ import os
|
|
| 6 |
logger = datasets.logging.get_logger(__name__)
|
| 7 |
|
| 8 |
_DESCRIPTION = """\
|
| 9 |
-
|
| 10 |
"""
|
| 11 |
|
| 12 |
# Define a list of programming languages for the subsets
|
| 13 |
-
_LANGUAGE_SUBSETS = ["
|
| 14 |
"java", "javascript", "jupyter", "kotlin", "php", "perl",
|
| 15 |
"python", "ruby", "rust", "shell", "swift", "typescript", "v"]
|
| 16 |
|
| 17 |
# Generate URLs for the subsets
|
| 18 |
-
_URL_LISTS = {language: f"https://huggingface.co/datasets/AtlasUnified/atlas-preprocessed-code/
|
| 19 |
for language in _LANGUAGE_SUBSETS}
|
| 20 |
|
| 21 |
-
_URL_BASE = 'https://
|
| 22 |
|
| 23 |
-
_DATA_DIR = os.environ.get('
|
| 24 |
|
| 25 |
-
class
|
| 26 |
-
"""BuilderConfig for
|
| 27 |
|
| 28 |
def __init__(self, *args, subsets, **kwargs):
|
| 29 |
-
"""BuilderConfig for
|
| 30 |
Args:
|
| 31 |
**kwargs: keyword arguments forwarded to super.
|
| 32 |
"""
|
| 33 |
-
super(
|
| 34 |
self.subsets = subsets
|
| 35 |
|
| 36 |
-
class
|
| 37 |
-
"""
|
| 38 |
|
| 39 |
# Generate builder configs for each language subset
|
| 40 |
-
BUILDER_CONFIGS = [
|
| 41 |
subsets=[language],
|
| 42 |
version=datasets.Version("1.0.0", ""),
|
| 43 |
-
description=f"
|
| 44 |
for language in _LANGUAGE_SUBSETS]
|
| 45 |
|
| 46 |
def _info(self):
|
|
@@ -50,7 +50,7 @@ class RedPajama1T(datasets.GeneratorBasedBuilder):
|
|
| 50 |
{
|
| 51 |
"text": datasets.Value("string"),
|
| 52 |
"meta": datasets.Value("string"),
|
| 53 |
-
"
|
| 54 |
}
|
| 55 |
),
|
| 56 |
supervised_keys=None,
|
|
@@ -107,13 +107,13 @@ class RedPajama1T(datasets.GeneratorBasedBuilder):
|
|
| 107 |
yield key, {
|
| 108 |
"text": text,
|
| 109 |
"meta": json.dumps(data),
|
| 110 |
-
"
|
| 111 |
}
|
| 112 |
else:
|
| 113 |
yield key, {
|
| 114 |
"text": data["text"],
|
| 115 |
"meta": data["meta"],
|
| 116 |
-
"
|
| 117 |
}
|
| 118 |
key += 1
|
| 119 |
except Exception as e:
|
|
@@ -122,4 +122,4 @@ class RedPajama1T(datasets.GeneratorBasedBuilder):
|
|
| 122 |
print(f'Row: {row}')
|
| 123 |
traceback.print_exc()
|
| 124 |
|
| 125 |
-
raise e
|
|
|
|
| 6 |
logger = datasets.logging.get_logger(__name__)
|
| 7 |
|
| 8 |
_DESCRIPTION = """\
|
| 9 |
+
AtlasCode is a clean-room, fully open-source implementation of the LLaMa dataset.
|
| 10 |
"""
|
| 11 |
|
| 12 |
# Define a list of programming languages for the subsets
|
| 13 |
+
_LANGUAGE_SUBSETS = ["c#", "c++", "c", "go", "html", "haskell",
|
| 14 |
"java", "javascript", "jupyter", "kotlin", "php", "perl",
|
| 15 |
"python", "ruby", "rust", "shell", "swift", "typescript", "v"]
|
| 16 |
|
| 17 |
# Generate URLs for the subsets
|
| 18 |
+
_URL_LISTS = {language: f"https://huggingface.co/datasets/AtlasUnified/atlas-preprocessed-code/resolve/main/{language}.jsonl"
|
| 19 |
for language in _LANGUAGE_SUBSETS}
|
| 20 |
|
| 21 |
+
_URL_BASE = 'https://huggingface.co/datasets/AtlasUnified/'
|
| 22 |
|
| 23 |
+
_DATA_DIR = os.environ.get('ATLAS_CODE_DATA_DIR', None)
|
| 24 |
|
| 25 |
+
class AtlasCodeConfig(datasets.BuilderConfig):
|
| 26 |
+
"""BuilderConfig for AtlasCode sample."""
|
| 27 |
|
| 28 |
def __init__(self, *args, subsets, **kwargs):
|
| 29 |
+
"""BuilderConfig for AtlasCode.
|
| 30 |
Args:
|
| 31 |
**kwargs: keyword arguments forwarded to super.
|
| 32 |
"""
|
| 33 |
+
super(AtlasCodeConfig, self).__init__(**kwargs)
|
| 34 |
self.subsets = subsets
|
| 35 |
|
| 36 |
+
class AtlasCode(datasets.GeneratorBasedBuilder):
|
| 37 |
+
"""AtlasCode: Reproducing the LLaMA training dataset of over 1.2 trillion tokens. Version 1.0.0."""
|
| 38 |
|
| 39 |
# Generate builder configs for each language subset
|
| 40 |
+
BUILDER_CONFIGS = [AtlasCodeConfig(name=language,
|
| 41 |
subsets=[language],
|
| 42 |
version=datasets.Version("1.0.0", ""),
|
| 43 |
+
description=f"AtlasCode {language} subset")
|
| 44 |
for language in _LANGUAGE_SUBSETS]
|
| 45 |
|
| 46 |
def _info(self):
|
|
|
|
| 50 |
{
|
| 51 |
"text": datasets.Value("string"),
|
| 52 |
"meta": datasets.Value("string"),
|
| 53 |
+
"atlas_code_subset": datasets.Value("string"),
|
| 54 |
}
|
| 55 |
),
|
| 56 |
supervised_keys=None,
|
|
|
|
| 107 |
yield key, {
|
| 108 |
"text": text,
|
| 109 |
"meta": json.dumps(data),
|
| 110 |
+
"atlas_code_subset": subset,
|
| 111 |
}
|
| 112 |
else:
|
| 113 |
yield key, {
|
| 114 |
"text": data["text"],
|
| 115 |
"meta": data["meta"],
|
| 116 |
+
"atlas_code_subset": subset,
|
| 117 |
}
|
| 118 |
key += 1
|
| 119 |
except Exception as e:
|
|
|
|
| 122 |
print(f'Row: {row}')
|
| 123 |
traceback.print_exc()
|
| 124 |
|
| 125 |
+
raise e
|