Datasets:
Languages:
English
Size:
10K<n<100K
fix: Fix UnicodeDecodeError and pyarrow.lib.ArrowInvalid when loading
Browse files```cmd
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 6265: character maps to <undefined>
```
Fix UnicodeDecodeError by forcing encoding to UTF-8 in _generate_examples.
```cmd
pyarrow.lib.ArrowInvalid: Integer value 2710988854 not in range: -2147483648 to 2147483647
```
Fix integer value out of bounds in stats_view or stats_downloads by using unsigned type.
- unsplash-25k-photos.py +3 -3
unsplash-25k-photos.py
CHANGED
@@ -49,8 +49,8 @@ class Unsplash(datasets.GeneratorBasedBuilder):
|
|
49 |
'photo_location_longitude': datasets.Value("string"),
|
50 |
'photo_location_country': datasets.Value("string"),
|
51 |
'photo_location_city': datasets.Value("string"),
|
52 |
-
'stats_views': datasets.Value("
|
53 |
-
'stats_downloads': datasets.Value("
|
54 |
'ai_description': datasets.Value("string"),
|
55 |
'ai_primary_landmark_name': datasets.Value("string"),
|
56 |
'ai_primary_landmark_latitude': datasets.Value("string"),
|
@@ -80,7 +80,7 @@ class Unsplash(datasets.GeneratorBasedBuilder):
|
|
80 |
|
81 |
def _generate_examples(self, filepath):
|
82 |
"""This function returns the examples in the raw (text) form."""
|
83 |
-
with open(filepath, "r") as f:
|
84 |
id_ = 0
|
85 |
for line in f:
|
86 |
if id_ == 0:
|
|
|
49 |
'photo_location_longitude': datasets.Value("string"),
|
50 |
'photo_location_country': datasets.Value("string"),
|
51 |
'photo_location_city': datasets.Value("string"),
|
52 |
+
'stats_views': datasets.Value("uint32"),
|
53 |
+
'stats_downloads': datasets.Value("uint32"),
|
54 |
'ai_description': datasets.Value("string"),
|
55 |
'ai_primary_landmark_name': datasets.Value("string"),
|
56 |
'ai_primary_landmark_latitude': datasets.Value("string"),
|
|
|
80 |
|
81 |
def _generate_examples(self, filepath):
|
82 |
"""This function returns the examples in the raw (text) form."""
|
83 |
+
with open(filepath, "r", encoding="utf-8") as f:
|
84 |
id_ = 0
|
85 |
for line in f:
|
86 |
if id_ == 0:
|