izhx commited on
Commit
0962dfd
·
1 Parent(s): 2eb68a5

Update google-code-jam.py

Browse files
Files changed (1) hide show
  1. google-code-jam.py +5 -4
google-code-jam.py CHANGED
@@ -29,7 +29,7 @@ SPLITS = {
29
  'test': [5, 6, 7, 8, 12], # For test in `Language Models are Universal Embedders` https://arxiv.org/pdf/2310.08232.pdf
30
  'deepsim': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
31
  }
32
- _URL = "https://huggingface.co/datasets/izhx/google-code-jam/resolve/main/googlejam4_src.zip"
33
 
34
 
35
  class GoogleCodeJam(datasets.GeneratorBasedBuilder):
@@ -45,8 +45,8 @@ class GoogleCodeJam(datasets.GeneratorBasedBuilder):
45
  {
46
  "fn1": datasets.Value("string"),
47
  "code1": datasets.Value("string"),
48
- "fn1": datasets.Value("string"),
49
- "code1": datasets.Value("string"),
50
  "label": datasets.Value("int32"),
51
  }
52
  ),
@@ -56,6 +56,7 @@ class GoogleCodeJam(datasets.GeneratorBasedBuilder):
56
 
57
  def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
58
  folder = dl_manager.download_and_extract(_URL)
 
59
  return [
60
  datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"folder": folder, "problems": SPLITS["test"]}),
61
  datasets.SplitGenerator(name='deepsim', gen_kwargs={"folder": folder, "problems": SPLITS["deepsim"]}),
@@ -81,7 +82,7 @@ class GoogleCodeJam(datasets.GeneratorBasedBuilder):
81
  vj = raw[problems[j]]
82
  match = i == j
83
  for n2, (fn2, code2) in enumerate(vj):
84
- if match and n1 <= n2:
85
  continue
86
  ins = {'fn1': fn1, 'code1': code1, 'fn2': fn2, 'code2': code2, 'label': int(match)}
87
  if reverse:
 
29
  'test': [5, 6, 7, 8, 12], # For test in `Language Models are Universal Embedders` https://arxiv.org/pdf/2310.08232.pdf
30
  'deepsim': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
31
  }
32
+ _URL = "https://huggingface.co/datasets/izhx/google-code-jam/resolve/main/googlejam4.tar.gz"
33
 
34
 
35
  class GoogleCodeJam(datasets.GeneratorBasedBuilder):
 
45
  {
46
  "fn1": datasets.Value("string"),
47
  "code1": datasets.Value("string"),
48
+ "fn2": datasets.Value("string"),
49
+ "code2": datasets.Value("string"),
50
  "label": datasets.Value("int32"),
51
  }
52
  ),
 
56
 
57
  def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
58
  folder = dl_manager.download_and_extract(_URL)
59
+ folder = os.path.join(folder, 'googlejam4_src')
60
  return [
61
  datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"folder": folder, "problems": SPLITS["test"]}),
62
  datasets.SplitGenerator(name='deepsim', gen_kwargs={"folder": folder, "problems": SPLITS["deepsim"]}),
 
82
  vj = raw[problems[j]]
83
  match = i == j
84
  for n2, (fn2, code2) in enumerate(vj):
85
+ if match and n2 <= n1:
86
  continue
87
  ins = {'fn1': fn1, 'code1': code1, 'fn2': fn2, 'code2': code2, 'label': int(match)}
88
  if reverse: