anya-ji commited on
Commit
b52545b
·
verified ·
1 Parent(s): 2f7a34f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +45 -1
README.md CHANGED
@@ -14,7 +14,7 @@ We preprocessed the Visual Accent and Dialect Archive (https://archive.mith.umd.
14
  This version currently only contains read speech, specifically, readings of the Rainbow Passage, which contains every sound in English.
15
 
16
 
17
- Citation:
18
  ```
19
  @misc{vada,
20
  title = {{Visual Accent and Dialect Archive}},
@@ -30,3 +30,47 @@ Citation:
30
  note = {Accessed on DATE at \url{https://huggingface.co/datasets/Berkeley-NLP/visual_accent_dialect_archive}},
31
  }
32
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  This version currently only contains read speech, specifically, readings of the Rainbow Passage, which contains every sound in English.
15
 
16
 
17
+ ## Citation:
18
  ```
19
  @misc{vada,
20
  title = {{Visual Accent and Dialect Archive}},
 
30
  note = {Accessed on DATE at \url{https://huggingface.co/datasets/Berkeley-NLP/visual_accent_dialect_archive}},
31
  }
32
  ```
33
+
34
+ ## Loading the dataset (example)
35
+ ```python
36
+ from huggingface_hub import snapshot_download
37
+ from datasets import load_dataset, Audio, Video
38
+
39
+ repo = "Berkeley-NLP/visual_accent_dialect_archive"
40
+
41
+ # Download dataset snapshot (cached by HF)
42
+ root = snapshot_download(repo_id=repo, repo_type="dataset")
43
+
44
+ # Load metadata CSV
45
+ ds = load_dataset(
46
+ "csv",
47
+ data_files={"test": f"{root}/test.csv"},
48
+ split="test",
49
+ )
50
+
51
+ # Rename path columns
52
+ ds = ds.rename_columns({
53
+ "audio_segment_path": "audio",
54
+ "video_noaudio_segment_path": "video_no_audio",
55
+ "video_withaudio_segment_path": "video_with_audio",
56
+ })
57
+
58
+ # Convert repo-relative paths to absolute local paths
59
+ def absolutize(ex):
60
+ ex["audio"] = f"{root}/" + ex["audio"]
61
+ ex["video_no_audio"] = f"{root}/" + ex["video_no_audio"]
62
+ ex["video_with_audio"] = f"{root}/" + ex["video_with_audio"]
63
+ return ex
64
+
65
+ ds = ds.map(absolutize)
66
+
67
+ # Decode audio and video
68
+ ds = ds.cast_column("audio", Audio())
69
+ ds = ds.cast_column("video_no_audio", Video())
70
+ ds = ds.cast_column("video_with_audio", Video())
71
+
72
+ ex = ds[0]
73
+ print(ex["audio"]["sampling_rate"], ex["audio"]["array"].shape)
74
+ print(ex["video_no_audio"])
75
+ print(ex["video_with_audio"])
76
+ ```