gzwei commited on
Commit
6860ab1
·
verified ·
1 Parent(s): 3556642

Upload maverix.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. maverix.py +3 -5
maverix.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import subprocess
2
  import tarfile
3
  import zipfile
@@ -7,7 +8,6 @@ from urllib.request import urlretrieve
7
 
8
  import datasets
9
  import pandas as pd
10
- from datasets import config
11
  from huggingface_hub import hf_hub_download
12
 
13
 
@@ -202,8 +202,7 @@ def split_video(input_path: Path, output_dir: Path):
202
  class MaverixDatasetConfig(datasets.BuilderConfig):
203
  def __init__(
204
  self,
205
- # metadata_url: Path = "maverix/test.jsonl",
206
- metadata_url: str = "maverix/dev.jsonl",
207
  subtitles_url: str = "subtitle.tar.gz",
208
  cookies_file: Optional[Path] = None,
209
  **kwargs,
@@ -267,7 +266,7 @@ class MaverixDataset(datasets.GeneratorBasedBuilder):
267
  if self.config.metadata_url is None:
268
  raise ValueError("You must provide metadata_url")
269
 
270
- base_cache_dir = dl_manager.download_config.cache_dir or config.HF_DATASETS_CACHE
271
  cache_dir = Path(base_cache_dir) / "maverix"
272
  cache_dir.mkdir(parents=True, exist_ok=True)
273
 
@@ -298,7 +297,6 @@ class MaverixDataset(datasets.GeneratorBasedBuilder):
298
  # Example generation (lazy download)
299
  # =========================
300
  def _generate_examples(self, metadata_path, cache_dir):
301
- # TODO: fix the rest of this and test end-to-end
302
  metadata = pd.read_json(metadata_path, lines=True)
303
 
304
  vid_full_dir = cache_dir / "vid_full"
 
1
+ import os
2
  import subprocess
3
  import tarfile
4
  import zipfile
 
8
 
9
  import datasets
10
  import pandas as pd
 
11
  from huggingface_hub import hf_hub_download
12
 
13
 
 
202
  class MaverixDatasetConfig(datasets.BuilderConfig):
203
  def __init__(
204
  self,
205
+ metadata_url: Path = "maverix/test.jsonl",
 
206
  subtitles_url: str = "subtitle.tar.gz",
207
  cookies_file: Optional[Path] = None,
208
  **kwargs,
 
266
  if self.config.metadata_url is None:
267
  raise ValueError("You must provide metadata_url")
268
 
269
+ base_cache_dir = os.path.expanduser(os.getenv("HF_HOME", "~/.cache/huggingface/"))
270
  cache_dir = Path(base_cache_dir) / "maverix"
271
  cache_dir.mkdir(parents=True, exist_ok=True)
272
 
 
297
  # Example generation (lazy download)
298
  # =========================
299
  def _generate_examples(self, metadata_path, cache_dir):
 
300
  metadata = pd.read_json(metadata_path, lines=True)
301
 
302
  vid_full_dir = cache_dir / "vid_full"