yw26342 commited on
Commit
2ebd03b
·
1 Parent(s): 5cc990e

Rename test.py to test1.py

Browse files
Files changed (1) hide show
  1. test.py → test1.py +12 -6
test.py → test1.py RENAMED
@@ -568,14 +568,20 @@ class Food500(datasets.GeneratorBasedBuilder):
568
  metadata = dl_manager.iter_archive(split_metadata_path)
569
  for file_path, file_obj in metadata:
570
  if file_path == _TRAIN_TXT:
571
- train_set = set(file_obj.read().split("\n"))
572
- train_set = {path.encode("utf-8") for path in train_set}
 
 
573
  if file_path == _VALID_TXT:
574
- valid_set = set(file_obj.read().split("\n"))
575
- valid_set = {path.encode("utf-8") for path in train_set}
 
 
576
  if file_path == _TEST_TXT:
577
- test_set = set(file_obj.read().split("\n"))
578
- test_set = {path.encode("utf-8") for path in train_set}
 
 
579
  pass
580
  return [
581
  datasets.SplitGenerator(
 
568
  metadata = dl_manager.iter_archive(split_metadata_path)
569
  for file_path, file_obj in metadata:
570
  if file_path == _TRAIN_TXT:
571
+ # train_set = set(file_obj.read().split("\n"))
572
+ # train_set = {path.encode("utf-8") for path in train_set}
573
+ with open(file_path, encoding="utf-8") as f:
574
+ train_set = set(f.read().split("\n"))
575
  if file_path == _VALID_TXT:
576
+ # valid_set = set(file_obj.read().split("\n"))
577
+ # valid_set = {path.encode("utf-8") for path in valid_set}
578
+ with open(file_path, encoding="utf-8") as f:
579
+ valid_set = set(f.read().split("\n"))
580
  if file_path == _TEST_TXT:
581
+ # test_set = set(file_obj.read().split("\n"))
582
+ # test_set = {path.encode("utf-8") for path in test_set}
583
+ with open(file_path, encoding="utf-8") as f:
584
+ test_set = set(f.read().split("\n"))
585
  pass
586
  return [
587
  datasets.SplitGenerator(