Make the dataset deterministic

#1
by lhoestq HF staff - opened
Files changed (1) hide show
  1. cats_vs_dogs_sample.py +1 -1
cats_vs_dogs_sample.py CHANGED
@@ -70,7 +70,7 @@ class CatsVsDogs(datasets.GeneratorBasedBuilder):
70
 
71
  def _generate_examples(self, images_path):
72
  logger.info("generating examples from = %s", images_path)
73
- for i, filepath in enumerate(images_path.glob("**/*.jpg")):
74
  yield str(i), {
75
  "image": str(filepath),
76
  "labels": filepath.parent.name.lower(),
 
70
 
71
  def _generate_examples(self, images_path):
72
  logger.info("generating examples from = %s", images_path)
73
+ for i, filepath in enumerate(sorted(images_path.glob("**/*.jpg"))):
74
  yield str(i), {
75
  "image": str(filepath),
76
  "labels": filepath.parent.name.lower(),