albertvillanova HF staff commited on
Commit
9e629d7
1 Parent(s): a3ca3d7

Support streaming python config (#5)

Browse files

- Host python data file in ZIP archive (3b9571d30610bb01d5eec460f5a9d09a50ae39d8)
- Update loading script (fcd110e46b8ff7c1edb66070ec98f040f86b0d57)

code_x_glue_cc_code_completion_token.py CHANGED
@@ -96,7 +96,7 @@ class CodeXGlueCcCodeCompletionTokenPythonImpl(CodeXGlueCcCodeCompletionTokenImp
96
  if language != "python":
97
  raise RuntimeError(f"Unknown language {language}")
98
 
99
- yield "data", "http://files.srl.inf.ethz.ch/data/py150_files.tar.gz"
100
 
101
  def process_string(self, token):
102
  # Copyright (c) Microsoft Corporation.
@@ -183,16 +183,6 @@ class CodeXGlueCcCodeCompletionTokenPythonImpl(CodeXGlueCcCodeCompletionTokenImp
183
  base_dir = file_paths["data"]
184
  filename = self.PYTHON_FILE_MAPPING[split_name]
185
 
186
- data_dir = os.path.join(base_dir, "data")
187
- if not os.path.exists(data_dir):
188
- import gzip
189
- import tarfile
190
-
191
- gzip_filename = os.path.join(base_dir, "data.tar.gz")
192
- with gzip.open(gzip_filename, "rb") as gzip_file:
193
- t = tarfile.TarFile(fileobj=gzip_file)
194
- t.extractall(path=base_dir)
195
-
196
  idx = 0
197
  for entry in self.py_tokenize(base_dir=base_dir, file_name=filename):
198
  path, out_tokens = entry
 
96
  if language != "python":
97
  raise RuntimeError(f"Unknown language {language}")
98
 
99
+ yield "data", "https://huggingface.co/datasets/code_x_glue_cc_code_completion_token/resolve/main/data/python/py150_files.zip"
100
 
101
  def process_string(self, token):
102
  # Copyright (c) Microsoft Corporation.
 
183
  base_dir = file_paths["data"]
184
  filename = self.PYTHON_FILE_MAPPING[split_name]
185
 
 
 
 
 
 
 
 
 
 
 
186
  idx = 0
187
  for entry in self.py_tokenize(base_dir=base_dir, file_name=filename):
188
  path, out_tokens = entry
data/python/py150_files.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1f679c6beaabd70d15cd49e6e47cd01dc1ec4226e60ec83a2bb210ff8acf6dd6
3
+ size 296440502