eduagarcia commited on
Commit
cb8eda9
·
1 Parent(s): afa14ae

fix: config for generator can't be none

Browse files
Files changed (1) hide show
  1. portuguese_benchmark.py +10 -9
portuguese_benchmark.py CHANGED
@@ -229,9 +229,10 @@ def _get_sts_features(config):
229
  )
230
 
231
  def _csv_generator(file_path: str,
 
232
  indexes_path: Optional[str] = None,
233
- split: Optional[str] = None,
234
- config: PTBenchmarkConfig = None):
235
  """Yields examples."""
236
  df = pd.read_csv(file_path)
237
  columns = config.text_and_label_columns
@@ -250,7 +251,7 @@ def _csv_generator(file_path: str,
250
  }
251
  yield id_, example
252
 
253
- def _conll_ner_generator(file_path: str, config: PTBenchmarkConfig = None):
254
  with open(file_path, encoding="utf-8") as f:
255
 
256
  guid = 0
@@ -280,7 +281,7 @@ def _conll_ner_generator(file_path: str, config: PTBenchmarkConfig = None):
280
  "ner_tags": ner_tags,
281
  }
282
 
283
- def _assin2_generator(file_path, config: PTBenchmarkConfig = None):
284
  """Yields examples."""
285
  id_ = 0
286
 
@@ -390,16 +391,16 @@ class PTBenchmark(datasets.GeneratorBasedBuilder):
390
  if self.config.file_type == "csv":
391
  yield from _csv_generator(
392
  file_path,
 
393
  indexes_path=indexes_path,
394
- split=split,
395
- config=self.config
396
  )
397
  elif self.config.task_type == "ner":
398
- yield from _conll_ner_generator(file_path, config=self.config)
399
  elif self.config.task_type == "rte":
400
  if "assin2" in self.config.name:
401
- yield from _assin2_generator(file_path, config=self.config)
402
  elif self.config.task_type == "sts":
403
  if "assin2" in self.config.name:
404
- yield from _assin2_generator(file_path, config=self.config)
405
 
 
229
  )
230
 
231
  def _csv_generator(file_path: str,
232
+ config: PTBenchmarkConfig,
233
  indexes_path: Optional[str] = None,
234
+ split: Optional[str] = None
235
+ ):
236
  """Yields examples."""
237
  df = pd.read_csv(file_path)
238
  columns = config.text_and_label_columns
 
251
  }
252
  yield id_, example
253
 
254
+ def _conll_ner_generator(file_path: str, config: PTBenchmarkConfig):
255
  with open(file_path, encoding="utf-8") as f:
256
 
257
  guid = 0
 
281
  "ner_tags": ner_tags,
282
  }
283
 
284
+ def _assin2_generator(file_path, config: PTBenchmarkConfig):
285
  """Yields examples."""
286
  id_ = 0
287
 
 
391
  if self.config.file_type == "csv":
392
  yield from _csv_generator(
393
  file_path,
394
+ self.config,
395
  indexes_path=indexes_path,
396
+ split=split
 
397
  )
398
  elif self.config.task_type == "ner":
399
+ yield from _conll_ner_generator(file_path, self.config)
400
  elif self.config.task_type == "rte":
401
  if "assin2" in self.config.name:
402
+ yield from _assin2_generator(file_path, self.config)
403
  elif self.config.task_type == "sts":
404
  if "assin2" in self.config.name:
405
+ yield from _assin2_generator(file_path, self.config)
406