dreamerdeo commited on
Commit
b207441
·
1 Parent(s): 24a463d
Files changed (1) hide show
  1. finqa.py +6 -10
finqa.py CHANGED
@@ -45,28 +45,24 @@ class FinQA(datasets.GeneratorBasedBuilder):
45
  dev_file = "dev.json"
46
  test_file = "test.json"
47
 
48
- root_dir = 'finqa'
49
  return [
50
  datasets.SplitGenerator(
51
  name=datasets.Split.TRAIN,
52
- # These kwargs will be passed to _generate_examples
53
- gen_kwargs={"main_filepath": os.path.join(root_dir, train_file), "root_dir": root_dir},
54
  ),
55
  datasets.SplitGenerator(
56
- name=datasets.Split.TEST,
57
- # These kwargs will be passed to _generate_examples
58
- gen_kwargs={"main_filepath": os.path.join(root_dir, dev_file), "root_dir": root_dir},
59
  ),
60
  datasets.SplitGenerator(
61
- name=datasets.Split.VALIDATION,
62
- # These kwargs will be passed to _generate_examples
63
- gen_kwargs={"main_filepath": os.path.join(root_dir, test_file), "root_dir": root_dir},
64
  ),
65
  ]
66
 
67
 
68
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
69
- def _generate_examples(self, main_filepath, root_dir):
70
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
71
  with open(main_filepath, encoding="utf-8") as f:
72
  # skip the first line since it is the tsv header
 
45
  dev_file = "dev.json"
46
  test_file = "test.json"
47
 
 
48
  return [
49
  datasets.SplitGenerator(
50
  name=datasets.Split.TRAIN,
51
+ gen_kwargs={"main_filepath": train_file},
 
52
  ),
53
  datasets.SplitGenerator(
54
+ name=datasets.Split.VALIDATION,
55
+ gen_kwargs={"main_filepath": dev_file},
 
56
  ),
57
  datasets.SplitGenerator(
58
+ name=datasets.Split.TEST,
59
+ gen_kwargs={"main_filepath": test_file},
 
60
  ),
61
  ]
62
 
63
 
64
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
65
+ def _generate_examples(self, main_filepath):
66
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
67
  with open(main_filepath, encoding="utf-8") as f:
68
  # skip the first line since it is the tsv header