suke-sho commited on
Commit
dbc8de6
1 Parent(s): f02249f

Update multi-model-plant-genome-corpus.py

Browse files
Files changed (1) hide show
  1. multi-model-plant-genome-corpus.py +7 -4
multi-model-plant-genome-corpus.py CHANGED
@@ -77,10 +77,13 @@ class PlantMultiSpeciesGenomes(datasets.GeneratorBasedBuilder):
77
  )
78
 
79
  def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
80
- # Get the list of genome files in the plant_genomes directory
81
- genome_dir = "plant_genomes"
82
- genome_files = [os.path.join(genome_dir, f) for f in os.listdir(genome_dir) if f.endswith(".fna.gz")]
83
-
 
 
 
84
  return [
85
  datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"files": genome_files, "chunk_length": self.config.chunk_length})
86
  ]
 
77
  )
78
 
79
  def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
80
+ filepaths_txt = dl_manager.download('plant_genome_file_names.txt')
81
+
82
+ with open(filepaths_txt, 'r') as f:
83
+ filepaths = [os.path.join("plant_genomes", filepath.rstrip()) for filepath in f]
84
+
85
+ genome_files = dl_manager.download_and_extract(filepaths)
86
+
87
  return [
88
  datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"files": genome_files, "chunk_length": self.config.chunk_length})
89
  ]