kjunh commited on
Commit
c4088cb
·
1 Parent(s): 3e99dde

Fix bug in download script

Browse files
Files changed (1) hide show
  1. EgoSpeak.py +18 -8
EgoSpeak.py CHANGED
@@ -31,14 +31,24 @@ class EgoSpeak(GeneratorBasedBuilder):
31
  )
32
 
33
  def _split_generators(self, dl_manager):
34
- # Path to the dataset directory (change if different)
35
- data_dir = os.path.abspath(dl_manager.manual_dir)
36
- return [
37
- SplitGenerator(
38
- name=Split.TRAIN,
39
- gen_kwargs={"data_dir": data_dir},
40
- ),
41
- ]
 
 
 
 
 
 
 
 
 
 
42
 
43
  def _generate_examples(self, data_dir):
44
  """Generate examples from the dataset directory structure."""
 
31
  )
32
 
33
  def _split_generators(self, dl_manager):
34
+ # Use the Hugging Face cache directory as the default
35
+ data_dir = os.path.abspath(dl_manager.manual_dir or dl_manager.cache_dir)
36
+
37
+ # If no data is available in the cache or provided manually, raise an error
38
+ if not os.listdir(data_dir):
39
+ raise ValueError(
40
+ "Dataset requires data to be present in the Hugging Face cache or manually specified. "
41
+ "Please provide the `data_dir` parameter or ensure the dataset is cached correctly. "
42
+ "For example: `load_dataset('kjunh/EgoSpeak', data_dir='/path/to/dataset')`."
43
+ )
44
+
45
+ return [
46
+ SplitGenerator(
47
+ name=Split.TRAIN,
48
+ gen_kwargs={"data_dir": data_dir},
49
+ ),
50
+ ]
51
+
52
 
53
  def _generate_examples(self, data_dir):
54
  """Generate examples from the dataset directory structure."""