cwolff commited on
Commit
a07bb50
·
verified ·
1 Parent(s): 1c0c495

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. dataset.py +7 -1
  2. test.py +4 -1
dataset.py CHANGED
@@ -52,7 +52,13 @@ class Schemapile(datasets.GeneratorBasedBuilder):
52
  )
53
 
54
  def _split_generators(self, dl_manager):
55
- data_path = dl_manager.download_and_extract("data.jsonl")
 
 
 
 
 
 
56
  return [
57
  datasets.SplitGenerator(
58
  name=datasets.Split.TRAIN,
 
52
  )
53
 
54
  def _split_generators(self, dl_manager):
55
+ # Support both local and remote (Hub) loading
56
+ data_files = self.config.data_files if hasattr(self.config, "data_files") else None
57
+ if data_files:
58
+ data_path = dl_manager.download_and_extract(data_files["train"] if isinstance(data_files, dict) else data_files)
59
+ else:
60
+ # Default to data.jsonl in repo
61
+ data_path = dl_manager.download_and_extract("data.jsonl")
62
  return [
63
  datasets.SplitGenerator(
64
  name=datasets.Split.TRAIN,
test.py CHANGED
@@ -1,6 +1,7 @@
1
 
2
  import json
3
  from collections import defaultdict
 
4
 
5
  def check_jsonl_file(filename):
6
  valid = True
@@ -46,4 +47,6 @@ def check_jsonl_file(filename):
46
  print(err)
47
 
48
  if __name__ == "__main__":
49
- check_jsonl_file("data.jsonl")
 
 
 
1
 
2
  import json
3
  from collections import defaultdict
4
+ from datasets import load_dataset
5
 
6
  def check_jsonl_file(filename):
7
  valid = True
 
47
  print(err)
48
 
49
  if __name__ == "__main__":
50
+ check_jsonl_file("data.jsonl")
51
+
52
+ ds = load_dataset("cwolff/schemapile")