ProgramComputer commited on
Commit
8bc3012
1 Parent(s): a53ad1a

Update test.py

Browse files
Files changed (1) hide show
  1. test.py +28 -2
test.py CHANGED
@@ -65,7 +65,7 @@ _URL = "https://mm.kaist.ac.kr/datasets/voxceleb"
65
 
66
  _URLS = {
67
  "video": {
68
- "placeholder": "hf://datasets/ProgramComputer/voxceleb/vox2/vox2_dev_mp4_partaa",
69
  "dev": (
70
  "hf://datasets/ProgramComputer/voxceleb/vox2/vox2_dev_mp4_partaa",
71
  "hf://datasets/ProgramComputer/voxceleb/vox2/vox2_dev_mp4_partab",
@@ -90,7 +90,7 @@ _URLS = {
90
  "test": "hf://datasets/ProgramComputer/voxceleb/vox1/vox1_test_wav.zip",
91
  },
92
  "audio2": {
93
- "placeholder": "hf://datasets/ProgramComputer/voxceleb/vox2/vox2_dev_aac_partaa",
94
  "dev": (
95
  "hf://datasets/ProgramComputer/voxceleb/vox2/vox2_dev_aac_partaa",
96
  "hf://datasets/ProgramComputer/voxceleb/vox2/vox2_dev_aac_partab",
@@ -191,6 +191,32 @@ class Test(datasets.GeneratorBasedBuilder):
191
  ["audio1", "audio2"] if self.config.name == "audio" else [self.config.name]
192
  )
193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  def progress(q, cur, total):
195
  with datasets.utils.logging.tqdm(
196
  unit="B",
 
65
 
66
  _URLS = {
67
  "video": {
68
+ "placeholder": "hf://datasets/ProgramComputer/voxceleb/vox2/vox2_dev_mp4_parta",
69
  "dev": (
70
  "hf://datasets/ProgramComputer/voxceleb/vox2/vox2_dev_mp4_partaa",
71
  "hf://datasets/ProgramComputer/voxceleb/vox2/vox2_dev_mp4_partab",
 
90
  "test": "hf://datasets/ProgramComputer/voxceleb/vox1/vox1_test_wav.zip",
91
  },
92
  "audio2": {
93
+ "placeholder": "hf://datasets/ProgramComputer/voxceleb/vox2/vox2_dev_aac_parta",
94
  "dev": (
95
  "hf://datasets/ProgramComputer/voxceleb/vox2/vox2_dev_aac_partaa",
96
  "hf://datasets/ProgramComputer/voxceleb/vox2/vox2_dev_aac_partab",
 
191
  ["audio1", "audio2"] if self.config.name == "audio" else [self.config.name]
192
  )
193
 
194
+
195
+ def download_custom(placeholder_url, path):
196
+ nonlocal dl_manager
197
+ sources = _PLACEHOLDER_MAPS[placeholder_url]
198
+ tmp_paths = []
199
+ lengths = []
200
+ start_positions = []
201
+ for url in sources:
202
+ head = requests.head(url,timeout=5,stream=True,allow_redirects=True,verify=False)
203
+ if head.status_code == 401:
204
+ raise ValueError("failed to authenticate with VoxCeleb host")
205
+ if head.status_code < 200 or head.status_code >= 300:
206
+ raise ValueError("failed to fetch dataset")
207
+ content_length = head.headers.get("Content-Length")
208
+ if content_length is None:
209
+ raise ValueError("expected non-empty Content-Length")
210
+ content_length = int(content_length)
211
+ tmp_path = Path(path + "." + sha256(url.encode("utf-8")).hexdigest())
212
+ tmp_paths.append(tmp_path)
213
+ lengths.append(content_length)
214
+ start_positions.append(
215
+ tmp_path.stat().st_size
216
+ if tmp_path.exists() and dl_manager.download_config.resume_download
217
+ else 0
218
+ )
219
+
220
  def progress(q, cur, total):
221
  with datasets.utils.logging.tqdm(
222
  unit="B",