shibing624 commited on
Commit
8d44f12
1 Parent(s): 4732cbe

Update python-source-code.py

Browse files
Files changed (1) hide show
  1. python-source-code.py +11 -11
python-source-code.py CHANGED
@@ -18,7 +18,7 @@ CPP_HOME = "https://github.com/fffaraz/awesome-cpp"
18
 
19
  _CITATION = "https://github.com/shibing624/code-autocomplete"
20
 
21
- _DATA_URL = "https://huggingface.co/datasets/shibing624/python-source-code/resolve/main/download.zip"
22
 
23
 
24
  class SourceCodeConfig(datasets.BuilderConfig):
@@ -48,7 +48,7 @@ class SourceCode(datasets.GeneratorBasedBuilder):
48
  SourceCodeConfig(
49
  name="python",
50
  description=_DESCRIPTION,
51
- features=["code"],
52
  data_url=_DATA_URL,
53
  citation=_CITATION,
54
  url=PYTHON_HOME,
@@ -56,7 +56,7 @@ class SourceCode(datasets.GeneratorBasedBuilder):
56
  SourceCodeConfig(
57
  name="java",
58
  description=_DESCRIPTION,
59
- features=["code"],
60
  data_url=_DATA_URL,
61
  citation=_CITATION,
62
  url=JAVA_HOME,
@@ -64,7 +64,7 @@ class SourceCode(datasets.GeneratorBasedBuilder):
64
  SourceCodeConfig(
65
  name="cpp",
66
  description=_DESCRIPTION,
67
- features=["code"],
68
  data_url=_DATA_URL,
69
  citation=_CITATION,
70
  url=CPP_HOME,
@@ -85,7 +85,7 @@ class SourceCode(datasets.GeneratorBasedBuilder):
85
 
86
  def _split_generators(self, dl_manager):
87
  dl_dir = dl_manager.download_and_extract(self.config.data_url) or ""
88
- dl_dir = os.path.join(dl_dir, f"download/{self.config.name}")
89
  return [
90
  datasets.SplitGenerator(
91
  name=datasets.Split.TRAIN,
@@ -99,12 +99,12 @@ class SourceCode(datasets.GeneratorBasedBuilder):
99
  "filepath": os.path.join(dl_dir, f"valid.txt"),
100
  },
101
  ),
102
- # datasets.SplitGenerator(
103
- # name=datasets.Split.TEST,
104
- # gen_kwargs={
105
- # "filepath": os.path.join(dl_dir, f"test.txt"),
106
- # },
107
- # ),
108
  ]
109
 
110
  def _generate_examples(self, filepath):
 
18
 
19
  _CITATION = "https://github.com/shibing624/code-autocomplete"
20
 
21
+ _DATA_URL = "https://github.com/shibing624/code-autocomplete/releases/download/0.0.4/source_code.zip"
22
 
23
 
24
  class SourceCodeConfig(datasets.BuilderConfig):
 
48
  SourceCodeConfig(
49
  name="python",
50
  description=_DESCRIPTION,
51
+ features=["text"],
52
  data_url=_DATA_URL,
53
  citation=_CITATION,
54
  url=PYTHON_HOME,
 
56
  SourceCodeConfig(
57
  name="java",
58
  description=_DESCRIPTION,
59
+ features=["text"],
60
  data_url=_DATA_URL,
61
  citation=_CITATION,
62
  url=JAVA_HOME,
 
64
  SourceCodeConfig(
65
  name="cpp",
66
  description=_DESCRIPTION,
67
+ features=["text"],
68
  data_url=_DATA_URL,
69
  citation=_CITATION,
70
  url=CPP_HOME,
 
85
 
86
  def _split_generators(self, dl_manager):
87
  dl_dir = dl_manager.download_and_extract(self.config.data_url) or ""
88
+ dl_dir = os.path.join(dl_dir, f"source_code/{self.config.name}")
89
  return [
90
  datasets.SplitGenerator(
91
  name=datasets.Split.TRAIN,
 
99
  "filepath": os.path.join(dl_dir, f"valid.txt"),
100
  },
101
  ),
102
+ datasets.SplitGenerator(
103
+ name=datasets.Split.TEST,
104
+ gen_kwargs={
105
+ "filepath": os.path.join(dl_dir, f"test.txt"),
106
+ },
107
+ ),
108
  ]
109
 
110
  def _generate_examples(self, filepath):