mllmTeam commited on
Commit
450329d
ยท
verified ยท
1 Parent(s): 4d33be5

fix huggingface api usage

Browse files
Files changed (1) hide show
  1. README.md +66 -14
README.md CHANGED
@@ -38,7 +38,10 @@ task_ids:
38
  - [Index and Parquet files for `MobileViews_Screenshots_ViewHierarchies`](#index-and-parquet-files-for-mobileviews_screenshots_viewhierarchies)
39
  - [Index files for `MobileViews_Apps_CompeleteTraces`](#index-files-for-mobileviews_apps_compeletetraces)
40
  - [๐ŸŒ How to Download](#-how-to-download)
41
- - [Download via Hugging Face Python Library](#download-via-hugging-face-python-library)
 
 
 
42
  - [๐Ÿ“‹ Usage Guidelines](#-usage-guidelines)
43
  - [Using `zip` and `parquet` Files in `MobileViews_Screenshots_ViewHierarchies`](#using-zip-and-parquet-files-in-mobileviews_screenshots_viewhierarchies)
44
  - [Mapping Screenshots and States in `MobileViews_Apps_CompleteTraces`](#mapping-screenshots-and-states-in-mobileviews_apps_completetraces)
@@ -162,47 +165,96 @@ Each index CSV in `MobileViews_Apps_CompleteTraces/Index_CSV.zip` lists the app
162
  | com.sportzentral.app | 25 |
163
  | com.boostedproductivity.app | 23 |
164
 
 
 
 
 
165
  ## ๐ŸŒ How to Download
166
 
167
- ### Download via Hugging Face Python Library
168
 
169
- **Install the library:**
170
 
171
  ```bash
172
  pip install huggingface_hub
173
  ```
174
 
175
- Before downloading, please ensure you are logged in with your Hugging Face token. If you don't have a token, you can create your own `Access Tokens` at Hugging Face.
176
 
177
- **Login with your token:**
178
 
179
- ```python
180
  huggingface-cli login
181
  ```
 
182
  Follow the prompts to input your token.
183
 
 
 
 
 
184
  **Download specific files:**
185
 
 
 
186
  ```python
187
  from huggingface_hub import hf_hub_download
188
 
189
- # Download specific files
190
- hf_hub_download(repo_id="mllmTeam/MobileViews", filename="MobileViews_Screenshots_ViewHierarchies/Parquets/MobileViews_0-150000.parquet", repo_type="dataset")
191
- hf_hub_download(repo_id="mllmTeam/MobileViews", filename="MobileViews_Screenshots_ViewHierarchies/Zip_Files/MobileViews_0-150000.zip", repo_type="dataset")
192
- hf_hub_download(repo_id="mllmTeam/MobileViews", filename="AppMetadata.csv", repo_type="dataset")
193
  ```
194
 
195
  **Download the entire repository:**
196
 
197
- ```python
198
- from huggingface_hub
199
 
200
- import snapshot_download
 
201
 
202
  # Download the entire repository
203
- snapshot_download(repo_id="mllmTeam/MobileViews", repo_type="dataset")
 
 
 
 
 
 
 
 
 
 
204
  ```
205
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  ## ๐Ÿ“‹ Usage Guidelines
207
 
208
  ### Using `zip` and `parquet` Files in `MobileViews_Screenshots_ViewHierarchies`
 
38
  - [Index and Parquet files for `MobileViews_Screenshots_ViewHierarchies`](#index-and-parquet-files-for-mobileviews_screenshots_viewhierarchies)
39
  - [Index files for `MobileViews_Apps_CompeleteTraces`](#index-files-for-mobileviews_apps_compeletetraces)
40
  - [๐ŸŒ How to Download](#-how-to-download)
41
+ - [Download via Hugging Face Python Library or CLI](#download-via-hugging-face-python-library-or-cli)
42
+ - [**Option 1: Download via Python Script**](#option-1-download-via-python-script)
43
+ - [**Option 2: Download via Hugging Face CLI**](#option-2-download-via-hugging-face-cli)
44
+ - [References](#references)
45
  - [๐Ÿ“‹ Usage Guidelines](#-usage-guidelines)
46
  - [Using `zip` and `parquet` Files in `MobileViews_Screenshots_ViewHierarchies`](#using-zip-and-parquet-files-in-mobileviews_screenshots_viewhierarchies)
47
  - [Mapping Screenshots and States in `MobileViews_Apps_CompleteTraces`](#mapping-screenshots-and-states-in-mobileviews_apps_completetraces)
 
165
  | com.sportzentral.app | 25 |
166
  | com.boostedproductivity.app | 23 |
167
 
168
+ Hereโ€™s how you can integrate the `huggingface-cli` resumable download feature into the Python-based instructions to make it concise and useful:
169
+
170
+ ---
171
+
172
  ## ๐ŸŒ How to Download
173
 
174
+ ### Download via Hugging Face Python Library or CLI
175
 
176
+ **Step 1: Install the library:**
177
 
178
  ```bash
179
  pip install huggingface_hub
180
  ```
181
 
182
+ Before downloading, ensure you are logged in with your Hugging Face token. If you don't have a token, create an `Access Token` on [Hugging Face](https://huggingface.co/settings/tokens).
183
 
184
+ **Step 2: Login with your token:**
185
 
186
+ ```bash
187
  huggingface-cli login
188
  ```
189
+
190
  Follow the prompts to input your token.
191
 
192
+ ---
193
+
194
+ #### **Option 1: Download via Python Script**
195
+
196
  **Download specific files:**
197
 
198
+ Use the `hf_hub_download` method to download individual files:
199
+
200
  ```python
201
  from huggingface_hub import hf_hub_download
202
 
203
+ # Download a single file
204
+ hf_hub_download(repo_id="mllmTeam/MobileViews", filename="MobileViews_Screenshots_ViewHierarchies/Zip_Files/MobileViews_0-150000.zip", repo_type="dataset", local_dir="/path/to/your_local_dir")
 
 
205
  ```
206
 
207
  **Download the entire repository:**
208
 
209
+ Use the `snapshot_download` method to download the entire dataset:
 
210
 
211
+ ```python
212
+ from huggingface_hub import snapshot_download
213
 
214
  # Download the entire repository
215
+ snapshot_download(repo_id="mllmTeam/MobileViews", repo_type="dataset", local_dir="/path/to/your_local_dir")
216
+ ```
217
+
218
+ ---
219
+
220
+ #### **Option 2: Download via Hugging Face CLI**
221
+
222
+ **Download specific files:**
223
+
224
+ ```bash
225
+ huggingface-cli download --repo-type dataset --resume-download mllmTeam/MobileViews/[FILE_PATH] --local-dir [LOCAL_DIRECTORY] --local-dir-use-symlinks False
226
  ```
227
 
228
+ Example:
229
+
230
+ ```bash
231
+ huggingface-cli download --repo-type dataset --resume-download mllmTeam/MobileViews/MobileViews_Screenshots_ViewHierarchies/Parquets/MobileViews_0-150000.parquet --local-dir ./mobileviews_dataset --local-dir-use-symlinks False
232
+ ```
233
+
234
+ **Download the entire repository:**
235
+
236
+ ```bash
237
+ huggingface-cli download --repo-type dataset --resume-download mllmTeam/MobileViews --local-dir [LOCAL_DIRECTORY] --local-dir-use-symlinks False
238
+ ```
239
+
240
+ Example:
241
+
242
+ ```bash
243
+ huggingface-cli download --repo-type dataset --resume-download mllmTeam/MobileViews --local-dir ./local_dataset --local-dir-use-symlinks False
244
+ ```
245
+
246
+ If the download is interrupted, run the command again, and it will resume from the last completed point.
247
+
248
+ ---
249
+ ### References
250
+ For more parameters and advanced usage, refer to the official documentation:
251
+
252
+ - [`hf_hub_download` Documentation](https://huggingface.co/docs/huggingface_hub/v0.27.0.rc0/en/package_reference/file_download#huggingface_hub.hf_hub_download)
253
+
254
+ - [`snapshot_download` Documentation](https://huggingface.co/docs/huggingface_hub/v0.27.0.rc0/en/package_reference/file_download#huggingface_hub.snapshot_download)
255
+
256
+ - [`Hugging Face CLI` Documentation](https://huggingface.co/docs/huggingface_hub/guides/cli#huggingface-cli-download)
257
+
258
  ## ๐Ÿ“‹ Usage Guidelines
259
 
260
  ### Using `zip` and `parquet` Files in `MobileViews_Screenshots_ViewHierarchies`