fix: Fix UnicodeDecodeError and pyarrow.lib.ArrowInvalid when loading

#3
by predprey - opened
Files changed (1) hide show
  1. 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("int32"),
53
- 'stats_downloads': datasets.Value("int32"),
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: