ProgramComputer commited on
Commit
6e89406
1 Parent(s): c18722c

Update vox_celeb.py

Browse files
Files changed (1) hide show
  1. vox_celeb.py +10 -11
vox_celeb.py CHANGED
@@ -62,7 +62,7 @@ _URL = "https://mm.kaist.ac.kr/datasets/voxceleb"
62
 
63
  _URLS = {
64
  "video": {
65
- "placeholder": "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox2_dev_mp4_parta",
66
  "dev": (
67
  "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox2_dev_mp4_partaa",
68
  "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox2_dev_mp4_partab",
@@ -77,7 +77,7 @@ _URLS = {
77
  "test": "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox2_test_mp4.zip",
78
  },
79
  "audio1": {
80
- "placeholder": "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox1_dev_wav_parta",
81
  "dev": (
82
  "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox1_dev_wav_partaa",
83
  "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox1_dev_wav_partab",
@@ -87,7 +87,7 @@ _URLS = {
87
  "test": "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox1_test_wav.zip",
88
  },
89
  "audio2": {
90
- "placeholder": "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox2_dev_aac_parta",
91
  "dev": (
92
  "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox2_dev_aac_partaa",
93
  "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox2_dev_aac_partab",
@@ -125,8 +125,7 @@ def format_urls(urls_dict, cred_key):
125
  def _mp_download(
126
  url,
127
  tmp_path,
128
- cred_user,
129
- cred_pass,
130
  resume_pos,
131
  length,
132
  queue,
@@ -138,7 +137,7 @@ def _mp_download(
138
  if resume_pos != 0:
139
  headers["Range"] = f"bytes={resume_pos}-"
140
  response = requests.get(
141
- url, auth=(cred_user, cred_pass), headers=headers, stream=True
142
  )
143
  if response.status_code >= 200 and response.status_code < 300:
144
  for chunk in response.iter_content(chunk_size=65536):
@@ -221,8 +220,7 @@ class VoxCeleb(datasets.GeneratorBasedBuilder):
221
 
222
  if not cred_key:
223
  raise ValueError("could not find key to log in")
224
- format_urls(_URLS, cred_key)
225
-
226
  _PLACEHOLDER_MAPS = dict(value for urls in _URLS.values() for value in ((urls["placeholder"], urls["dev"]), (urls["test"], (urls["test"],))))
227
  saved_credentials = False
228
 
@@ -241,13 +239,15 @@ class VoxCeleb(datasets.GeneratorBasedBuilder):
241
  lengths = []
242
  start_positions = []
243
  for url in sources:
244
- head = requests.head(url, auth=(cred_key))
 
245
  if head.status_code == 401:
246
  raise ValueError("failed to authenticate with VoxCeleb host")
247
  if head.status_code < 200 or head.status_code >= 300:
248
  raise ValueError("failed to fetch dataset")
249
  save_credentials()
250
  content_length = head.headers.get("Content-Length")
 
251
  if content_length is None:
252
  raise ValueError("expected non-empty Content-Length")
253
  content_length = int(content_length)
@@ -291,8 +291,7 @@ class VoxCeleb(datasets.GeneratorBasedBuilder):
291
  zip(
292
  sources,
293
  tmp_paths,
294
- repeat(cred_user),
295
- repeat(cred_pass),
296
  start_positions,
297
  lengths,
298
  repeat(q),
 
62
 
63
  _URLS = {
64
  "video": {
65
+ "placeholder": "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox2_dev_mp4_partaa",
66
  "dev": (
67
  "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox2_dev_mp4_partaa",
68
  "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox2_dev_mp4_partab",
 
77
  "test": "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox2_test_mp4.zip",
78
  },
79
  "audio1": {
80
+ "placeholder": "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox1_dev_wav_partaa",
81
  "dev": (
82
  "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox1_dev_wav_partaa",
83
  "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox1_dev_wav_partab",
 
87
  "test": "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox1_test_wav.zip",
88
  },
89
  "audio2": {
90
+ "placeholder": "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox2_dev_aac_partaa",
91
  "dev": (
92
  "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox2_dev_aac_partaa",
93
  "https://cn01.mmai.io/download/voxceleb?key={cred_key}&file=vox2_dev_aac_partab",
 
125
  def _mp_download(
126
  url,
127
  tmp_path,
128
+ cred_key,
 
129
  resume_pos,
130
  length,
131
  queue,
 
137
  if resume_pos != 0:
138
  headers["Range"] = f"bytes={resume_pos}-"
139
  response = requests.get(
140
+ url, headers=headers, stream=True,verify=False
141
  )
142
  if response.status_code >= 200 and response.status_code < 300:
143
  for chunk in response.iter_content(chunk_size=65536):
 
220
 
221
  if not cred_key:
222
  raise ValueError("could not find key to log in")
223
+ _URLS = format_urls(_URLS, cred_key)
 
224
  _PLACEHOLDER_MAPS = dict(value for urls in _URLS.values() for value in ((urls["placeholder"], urls["dev"]), (urls["test"], (urls["test"],))))
225
  saved_credentials = False
226
 
 
239
  lengths = []
240
  start_positions = []
241
  for url in sources:
242
+ head = requests.get(url,timeout=5,stream=True,allow_redirects=True,verify=False)#,headers=headers)
243
+
244
  if head.status_code == 401:
245
  raise ValueError("failed to authenticate with VoxCeleb host")
246
  if head.status_code < 200 or head.status_code >= 300:
247
  raise ValueError("failed to fetch dataset")
248
  save_credentials()
249
  content_length = head.headers.get("Content-Length")
250
+ head.close()
251
  if content_length is None:
252
  raise ValueError("expected non-empty Content-Length")
253
  content_length = int(content_length)
 
291
  zip(
292
  sources,
293
  tmp_paths,
294
+ repeat(cred_key),
 
295
  start_positions,
296
  lengths,
297
  repeat(q),