Shu1L0n9 commited on
Commit
6d14735
·
verified ·
1 Parent(s): f6dd929

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -26
README.md CHANGED
@@ -69,48 +69,41 @@ All images are 96x96 pixels and are provided in PNG format.
69
 
70
  ## 🧼 Clean STL-10 Dataset, 🔧 How to Load?
71
 
72
- 🎉 We uploaded our cleaned STL-10 dataset to Hugging Face! You can easily load and use it with the 🤗 `webdataset` library.
73
 
74
- ---
 
 
 
 
 
 
 
75
 
76
  ### 🔧 Load with WebDataset
77
 
78
  ```python
79
- from huggingface_hub import hf_hub_url, HfFileSystem
80
  import webdataset as wds
 
81
 
82
- # Replace with your actual Hugging Face token
83
- token = "your_huggingface_token_here"
84
- fs = HfFileSystem(token=token)
85
 
86
- repo_id = "Shu1L0n9/CleanSTL-10"
87
- splits = {
88
- 'train': '**/train-*.tar',
89
- 'test': '**/test-*.tar',
90
- 'unlabeled': '**/unlabeled-*.tar'
91
- }
92
 
93
- def load_split(split):
94
- pattern = f"hf://datasets/{repo_id}/{splits[split]}"
95
- files = [fs.resolve_path(p) for p in fs.glob(pattern)]
96
- urls = [hf_hub_url(f.repo_id, f.path_in_repo, repo_type="dataset") for f in files]
97
- pipe_url = f"pipe: curl -s -L -H 'Authorization:Bearer {token}' {'::'.join(urls)}"
98
- return wds.WebDataset(pipe_url, shardshuffle=False).decode("pil")
99
-
100
- # Load the splits
101
- train_ds = load_split("train")
102
- test_ds = load_split("test")
103
- unlabeled_ds = load_split("unlabeled")
104
  ```
105
 
106
- > ℹ️ Requires: `webdataset`, `huggingface_hub`, `fsspec`
107
  > Install with:
108
 
109
  ```bash
110
- pip install webdataset huggingface_hub fsspec
111
  ```
112
 
113
-
114
  ### 🔑 How to Get Your Hugging Face Token
115
 
116
  To download from Hugging Face with authentication, you’ll need a **User Access Token**:
 
69
 
70
  ## 🧼 Clean STL-10 Dataset, 🔧 How to Load?
71
 
72
+ 🎉 We uploaded our cleaned STL-10 dataset to Hugging Face! You can easily load and use it with the 🤗 'datasets' or `webdataset` library.
73
 
74
+ ### 🥸 Load with datasets library (Recommended, Quick start)
75
+
76
+ ```python
77
+ from datasets import load_dataset
78
+
79
+ # Login using e.g. `huggingface-cli login` to access this dataset
80
+ ds = load_dataset("Shu1L0n9/CleanSTL-10")
81
+ ```
82
 
83
  ### 🔧 Load with WebDataset
84
 
85
  ```python
 
86
  import webdataset as wds
87
+ from huggingface_hub import HfFileSystem, get_token, hf_hub_url
88
 
89
+ splits = {'train': 'train-*.tar', 'test': 'test-*.tar', 'unlabeled': 'unlabeled-*.tar'}
 
 
90
 
91
+ # Login using e.g. `huggingface-cli login` to access this dataset
92
+ fs = HfFileSystem()
93
+ files = [fs.resolve_path(path) for path in fs.glob("hf://datasets/Shu1L0n9/CleanSTL-10/" + splits["train"])]
94
+ urls = [hf_hub_url(file.repo_id, file.path_in_repo, repo_type="dataset") for file in files]
95
+ urls = f"pipe: curl -s -L -H 'Authorization:Bearer {get_token()}' {'::'.join(urls)}"
 
96
 
97
+ ds = wds.WebDataset(urls).decode()
 
 
 
 
 
 
 
 
 
 
98
  ```
99
 
100
+ > ℹ️ Requires: `webdataset`, `huggingface_hub`
101
  > Install with:
102
 
103
  ```bash
104
+ pip install webdataset huggingface_hub
105
  ```
106
 
 
107
  ### 🔑 How to Get Your Hugging Face Token
108
 
109
  To download from Hugging Face with authentication, you’ll need a **User Access Token**: