mittal commited on
Commit
8936455
·
verified ·
1 Parent(s): 4dcf829

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +43 -17
README.md CHANGED
@@ -69,27 +69,53 @@ Find recordings samples [here](https://huggingface.co/datasets/nyu-dice-lab/wave
69
 
70
  ## Usage
71
 
 
 
 
 
 
72
  ### Loading the Dataset
73
 
74
  ```python
75
  from datasets import load_dataset
76
-
77
- # Load full dataset
78
- dataset = load_dataset("nyu-dice-lab/wavepulse-radio-raw-transcripts")
79
-
80
- # Load specific state
81
- dataset = load_dataset("nyu-dice-lab/wavepulse-radio-raw-transcripts", "NY")
82
-
83
- # Filter by date range
84
- filtered_ds = dataset.filter(
85
- lambda x: "2024-08-01" <= x['datetime'] <= "2024-08-31"
86
- )
87
-
88
- # Filter by station
89
- station_ds = dataset.filter(lambda x: x['station'] == 'WXYZ')
90
-
91
- # Get all segments from a specific transcript
92
- transcript_ds = dataset.filter(lambda x: x['transcript_id'] == 'AK_KAGV_2024_08_25_13_00')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  ```
94
 
95
  ### Data Schema
 
69
 
70
  ## Usage
71
 
72
+ ```python
73
+ pip install datasets
74
+ pip install huggingface-hub
75
+ ```
76
+
77
  ### Loading the Dataset
78
 
79
  ```python
80
  from datasets import load_dataset
81
+ from huggingface_hub import HfApi, HfFolder
82
+ import time
83
+
84
+ # Configure longer timeout and retries
85
+ import huggingface_hub
86
+ huggingface_hub.constants.HF_HUB_DOWNLOAD_TIMEOUT = 60 # Increase timeout to 60 seconds
87
+
88
+ def load_dataset_with_retry(dataset_name, subset=None, max_retries=3):
89
+ for attempt in range(max_retries):
90
+ try:
91
+ if subset:
92
+ return load_dataset(dataset_name, subset)
93
+ else:
94
+ return load_dataset(dataset_name)
95
+ except Exception as e:
96
+ if attempt == max_retries - 1:
97
+ raise e
98
+ print(f"Attempt {attempt + 1} failed, retrying in {2 ** attempt} seconds...")
99
+ time.sleep(2 ** attempt) # Exponential backoff
100
+
101
+ # Load dataset with retry logic
102
+ try:
103
+ # For full dataset
104
+ dataset = load_dataset_with_retry("nyu-dice-lab/wavepulse-radio-raw-transcripts")
105
+ # Or for specific state
106
+ # dataset = load_dataset_with_retry("nyu-dice-lab/wavepulse-radio-raw-transcripts", "NY")
107
+
108
+ # Your filtering operations remain the same
109
+ filtered_ds = dataset.filter(
110
+ lambda x: "2024-08-01" <= x['datetime'] <= "2024-08-31"
111
+ )
112
+ station_ds = dataset.filter(lambda x: x['station'] == 'WXYZ')
113
+ transcript_ds = dataset.filter(
114
+ lambda x: x['transcript_id'] == 'AK_KAGV_2024_08_25_13_00'
115
+ )
116
+
117
+ except Exception as e:
118
+ print(f"Failed to load dataset after all retries: {str(e)}")
119
  ```
120
 
121
  ### Data Schema