kuroneko5943 commited on
Commit
96ec482
1 Parent(s): 758ab5e

从txt下载数据,支持dataview

Browse files
Files changed (1) hide show
  1. amz20.py +7 -9
amz20.py CHANGED
@@ -51,7 +51,7 @@ class AMZ20(datasets.GeneratorBasedBuilder):
51
  label_column='label',
52
  citation="",
53
  data_dir= "",
54
- data_url = "https://huggingface.co/datasets/kuroneko3578/amz20/resolve/main/data.7z",
55
  url='https://github.com/ws719547997/LNB-DA')
56
  for domain_name in domain_list
57
  ]
@@ -71,25 +71,23 @@ class AMZ20(datasets.GeneratorBasedBuilder):
71
  )
72
 
73
  def _split_generators(self, dl_manager):
74
- downloaded_file = dl_manager.download_and_extract(self.config.data_url)
75
- print(downloaded_file)
76
 
77
- test_file = rf'{downloaded_file}\data\test\{self.config.name}.txt'
78
- dev_file = rf'{downloaded_file}\data\dev\{self.config.name}.txt'
79
- train_file = rf'{downloaded_file}\data\train\{self.config.name}.txt'
80
  return [datasets.SplitGenerator(name=datasets.Split.TEST,
81
  gen_kwargs={
82
- "data_file": test_file,
83
  "split": "test",
84
  },),
85
  datasets.SplitGenerator(name=datasets.Split.VALIDATION,
86
  gen_kwargs={
87
- "data_file": dev_file,
88
  "split": "dev",
89
  },),
90
  datasets.SplitGenerator(name=datasets.Split.TRAIN,
91
  gen_kwargs={
92
- "data_file": train_file,
93
  "split": "train",
94
  },)]
95
 
 
51
  label_column='label',
52
  citation="",
53
  data_dir= "",
54
+ data_url = "https://huggingface.co/datasets/kuroneko3578/amz20/resolve/main/",
55
  url='https://github.com/ws719547997/LNB-DA')
56
  for domain_name in domain_list
57
  ]
 
71
  )
72
 
73
  def _split_generators(self, dl_manager):
 
 
74
 
75
+ test_file = rf'{self.config.data_url}test/{self.config.name}.txt'
76
+ dev_file = rf'{self.config.data_url}dev/{self.config.name}.txt'
77
+ train_file = rf'{self.config.data_url}train/{self.config.name}.txt'
78
  return [datasets.SplitGenerator(name=datasets.Split.TEST,
79
  gen_kwargs={
80
+ "data_file": dl_manager.download(test_file),
81
  "split": "test",
82
  },),
83
  datasets.SplitGenerator(name=datasets.Split.VALIDATION,
84
  gen_kwargs={
85
+ "data_file": dl_manager.download(dev_file),
86
  "split": "dev",
87
  },),
88
  datasets.SplitGenerator(name=datasets.Split.TRAIN,
89
  gen_kwargs={
90
+ "data_file": dl_manager.download(train_file),
91
  "split": "train",
92
  },)]
93