tfds-nightly 4.9.9.dev202507200047__py3-none-any.whl → 4.9.9.dev202507220045__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,6 +37,7 @@ print(ds['default'][0])
37
37
  from __future__ import annotations
38
38
 
39
39
  from collections.abc import Mapping, Sequence
40
+ import datetime
40
41
  import json
41
42
  from typing import Any
42
43
 
@@ -169,8 +170,9 @@ def datatype_converter(
169
170
  feature = dtype_mapping[field_data_type]
170
171
  elif enp.lazy.is_np_dtype(field_data_type):
171
172
  feature = field_data_type
172
- # We return a text feature for mlc.DataType.DATE features.
173
- elif field_data_type == pd.Timestamp:
173
+ # We return a text feature for mlc.DataType.DATE and mlc.DataType.TIME
174
+ # features.
175
+ elif field_data_type == pd.Timestamp or field_data_type == datetime.time:
174
176
  feature = text_feature.Text(doc=field.description)
175
177
  elif field_data_type == mlc.DataType.IMAGE_OBJECT:
176
178
  feature = image_feature.Image(doc=field.description)
@@ -165,6 +165,11 @@ def test_bbox_datatype_converter_with_invalid_format():
165
165
  text_feature.Text,
166
166
  None,
167
167
  ),
168
+ (
169
+ mlc.Field(data_types=mlc.DataType.TIME, description="Time feature"),
170
+ text_feature.Text,
171
+ None,
172
+ ),
168
173
  (
169
174
  mlc.Field(
170
175
  data_types=mlc.DataType.IMAGE_OBJECT,
@@ -93,7 +93,7 @@ class Video(sequence_feature.Sequence):
93
93
 
94
94
  def __init__(
95
95
  self,
96
- shape: Sequence[Optional[int]],
96
+ shape: Sequence[Optional[int]] | None = None,
97
97
  encoding_format: str = 'png',
98
98
  ffmpeg_extra_args: Sequence[str] = (),
99
99
  use_colormap: bool = False,
@@ -103,8 +103,8 @@ class Video(sequence_feature.Sequence):
103
103
  """Initializes the connector.
104
104
 
105
105
  Args:
106
- shape: tuple of ints, the shape of the video (num_frames, height, width,
107
- channels), where channels is 1 or 3.
106
+ shape: The shape of the video (num_frames, height, width, channels), where
107
+ channels is 1 or 3.
108
108
  encoding_format: The video is stored as a sequence of encoded images. You
109
109
  can use any encoding format supported by image_feature.Feature.
110
110
  ffmpeg_extra_args: A sequence of additional args to be passed to the
@@ -121,19 +121,22 @@ class Video(sequence_feature.Sequence):
121
121
  ValueError: If the shape is invalid
122
122
  """
123
123
  dtype = tf.dtypes.as_dtype(dtype)
124
- shape = tuple(shape)
125
- if len(shape) != 4:
126
- raise ValueError('Video shape should be of rank 4')
124
+ frame_shape = None
125
+ if shape:
126
+ shape = tuple(shape)
127
+ if len(shape) != 4:
128
+ raise ValueError('Video shape should be of rank 4')
129
+ frame_shape = shape[1:]
127
130
  self._encoding_format = encoding_format
128
131
  self._extra_ffmpeg_args = list(ffmpeg_extra_args or [])
129
132
  super(Video, self).__init__(
130
133
  image_feature.Image(
131
- shape=shape[1:],
134
+ shape=frame_shape,
132
135
  dtype=dtype,
133
136
  encoding_format=encoding_format,
134
137
  use_colormap=use_colormap,
135
138
  ),
136
- length=shape[0],
139
+ length=shape[0] if shape else None,
137
140
  )
138
141
 
139
142
  def _ffmpeg_decode(self, path_or_fobj):
@@ -48,6 +48,22 @@ class VideoFeatureTest(testing.FeatureExpectationsTestCase):
48
48
  test_attributes=dict(_encoding_format='png', _extra_ffmpeg_args=[]),
49
49
  )
50
50
 
51
+ def test_video_with_none_shape(self):
52
+ np_video = np.random.randint(256, size=(128, 64, 64, 3), dtype=np.uint8)
53
+
54
+ self.assertFeature(
55
+ feature=features.Video(shape=None),
56
+ shape=(None, None, None, 3),
57
+ dtype=tf.uint8,
58
+ tests=[
59
+ testing.FeatureExpectationItem(
60
+ value=np_video,
61
+ expected=np_video,
62
+ ),
63
+ ],
64
+ test_attributes=dict(_encoding_format='png', _extra_ffmpeg_args=[]),
65
+ )
66
+
51
67
  def test_video_concatenated_frames(self):
52
68
  video_shape = (None, 400, 640, 3)
53
69
  lsun_examples_path = os.path.join(self._test_data_path, 'lsun_examples')
@@ -119,6 +135,5 @@ class VideoFeatureTest(testing.FeatureExpectationsTestCase):
119
135
  ],
120
136
  )
121
137
 
122
-
123
138
  if __name__ == '__main__':
124
139
  testing.test_main()
@@ -119,6 +119,8 @@ def convert_hf_features(hf_features) -> feature_lib.FeatureConnector:
119
119
  sample_rate=hf_features.sampling_rate,
120
120
  dtype=np.int32,
121
121
  )
122
+ case hf_datasets.Video():
123
+ return feature_lib.Video()
122
124
 
123
125
  raise TypeError(f'Type {type(hf_features)} is not supported.')
124
126
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tfds-nightly
3
- Version: 4.9.9.dev202507200047
3
+ Version: 4.9.9.dev202507220045
4
4
  Summary: tensorflow/datasets is a library of datasets ready to use with TensorFlow.
5
5
  Home-page: https://github.com/tensorflow/datasets
6
6
  Download-URL: https://github.com/tensorflow/datasets/tags
@@ -141,8 +141,8 @@ tensorflow_datasets/core/data_sources/python_test.py,sha256=O3yqMPx40JlHN0uFfZPN
141
141
  tensorflow_datasets/core/dataset_builders/__init__.py,sha256=StTA3euephqDZdpTzJQgfWNqB5inZosrAhaWg2BOeio,1945
142
142
  tensorflow_datasets/core/dataset_builders/adhoc_builder.py,sha256=QVE8wWGPOgILPTC27Q28QZ3KIi5N64OGOfKpTq4W4_0,9216
143
143
  tensorflow_datasets/core/dataset_builders/adhoc_builder_test.py,sha256=yhRwrznK78MvHeWGRggnMTiyx_SlR1z30iD5VU3Gweo,13096
144
- tensorflow_datasets/core/dataset_builders/croissant_builder.py,sha256=Ef9fSTxFIvUKf_zfCqL3JyUje6f9buIQXvT1iuHgB20,16596
145
- tensorflow_datasets/core/dataset_builders/croissant_builder_test.py,sha256=1KPrGPFYHQvo33TwnG5LmPpdlyRTudPfni4ipFsj0ao,11607
144
+ tensorflow_datasets/core/dataset_builders/croissant_builder.py,sha256=0lVl7ZP8tc1zUNZAVoUCw9jV_RAo1O9Mc2iFM21WVSM,16674
145
+ tensorflow_datasets/core/dataset_builders/croissant_builder_test.py,sha256=4jFx88qcAi6mTU1fk_Kj9PpEPdhFEAYvZQFDD-AK8gw,11758
146
146
  tensorflow_datasets/core/dataset_builders/huggingface_dataset_builder.py,sha256=Loq3qeGk1Ias-d2oT_dK47BRNgTA4LKJchNGh7aA4a0,18313
147
147
  tensorflow_datasets/core/dataset_builders/huggingface_dataset_builder_test.py,sha256=6N3DLsry9LhDqhpleaoXrrhaGiLJMBgUlwDnAji-1fI,4389
148
148
  tensorflow_datasets/core/dataset_builders/view_builder.py,sha256=eaCtjN5Vg4rK8JD3auA4PhF9mjH5HvQ9dslDX8LbwyM,11907
@@ -213,8 +213,8 @@ tensorflow_datasets/core/features/top_level_feature.py,sha256=JeOnaBUqp-xFLuPxUt
213
213
  tensorflow_datasets/core/features/top_level_feature_test.py,sha256=JutGHU-08tg5KWiB3mIB6Q3a80CvS5_F6jG0bfAYXWM,3628
214
214
  tensorflow_datasets/core/features/translation_feature.py,sha256=Qmx39XwMJy18u9eoZlT3Spc0VT0qtqsTHahWoETLZZo,8284
215
215
  tensorflow_datasets/core/features/translation_feature_test.py,sha256=iK8ckwApuMu13BS1-vkny-m_NV6uNTz6ky5gbZEfxoc,6060
216
- tensorflow_datasets/core/features/video_feature.py,sha256=K4lld2N-a9TWrwYss8gEBGnkiraKqKyM81Z4chUj8qU,7720
217
- tensorflow_datasets/core/features/video_feature_test.py,sha256=qUFu8quELWr15r_VaMZGKoFPb2ueZkNmVJHBcgR5fkc,3772
216
+ tensorflow_datasets/core/features/video_feature.py,sha256=o4tuH4HxkG_sYCYUx8R-LVHcuIgFcfCNe8n0cE5MISk,7813
217
+ tensorflow_datasets/core/features/video_feature_test.py,sha256=k0qpYvZIC_-xXTG9EN1Mo2d9RA77CcvJYl9c0U3oXcQ,4255
218
218
  tensorflow_datasets/core/folder_dataset/__init__.py,sha256=Pn2mSU-CPxC89lvywHAD-XrhQj0mvAaqZogpekjr-bs,1515
219
219
  tensorflow_datasets/core/folder_dataset/compute_split_utils.py,sha256=Ob_ZaqfS00zViAtRhHK_ff7R8eJAtYDDh6XjQGXdcP4,13515
220
220
  tensorflow_datasets/core/folder_dataset/compute_split_utils_test.py,sha256=XBo4UC1IydAPuIP1SY2psrEVeEr3y0KPmCEje6yQWhs,3784
@@ -256,7 +256,7 @@ tensorflow_datasets/core/utils/file_utils.py,sha256=vL-ulAVClrvkA71DvEvdGR2EdNmO
256
256
  tensorflow_datasets/core/utils/file_utils_test.py,sha256=SCw_XFRhyxGCFEVjt9pOdupsoULPdi8iT38JBrnUuDM,13708
257
257
  tensorflow_datasets/core/utils/gcs_utils.py,sha256=8mBOgEepkah1Rw36F6DNIVhLzfXbR8iS8KMLQUM5sPk,5154
258
258
  tensorflow_datasets/core/utils/gcs_utils_test.py,sha256=Ig8S37AvFG2g7kNjYxqgmqNKlLPeXt31XD7RY4UzsDg,2578
259
- tensorflow_datasets/core/utils/huggingface_utils.py,sha256=J-TZyisMkjqsFWw6MAA0NWot4KPDmfWe_7t1R9wjQv4,5262
259
+ tensorflow_datasets/core/utils/huggingface_utils.py,sha256=NeYaUoO3vIFH8M0hZ8k4w7AchFZJIGsuV1XwKJVttfw,5325
260
260
  tensorflow_datasets/core/utils/huggingface_utils_test.py,sha256=wYKY5vh5q4ImpkvDjZWwcTbH1s2YORKpsklA-9Qwfxs,4792
261
261
  tensorflow_datasets/core/utils/image_utils.py,sha256=5xHKJO8wsPGZpuFoBsvwaXp_-pnrtwXvyLBSK7itAm4,5939
262
262
  tensorflow_datasets/core/utils/image_utils_test.py,sha256=6QLpWwveq4Jtw0nLxG4S-VGpVsI9qwr6bJm0Vgunbu0,3127
@@ -2468,10 +2468,10 @@ tensorflow_datasets/vision_language/wit/wit_test.py,sha256=PXS8DMNW-MDrT2p5oy4Ic
2468
2468
  tensorflow_datasets/vision_language/wit_kaggle/__init__.py,sha256=vGwSGeM8WE4Q-l0-eEE1sBojmk6YT0l1OO60AWa4Q40,719
2469
2469
  tensorflow_datasets/vision_language/wit_kaggle/wit_kaggle.py,sha256=q-vX_FBzIwsFxL4sY9vuyQ3UQD2PLM4yhUR4U6l-qao,16903
2470
2470
  tensorflow_datasets/vision_language/wit_kaggle/wit_kaggle_test.py,sha256=ZymHT1NkmD-pUnh3BmM3_g30c5afsWYnmqDD9dVyDSA,1778
2471
- tfds_nightly-4.9.9.dev202507200047.dist-info/licenses/AUTHORS,sha256=nvBG4WwfgjuOu1oZkuQKw9kg7X6rve679ObS-YDDmXg,309
2472
- tfds_nightly-4.9.9.dev202507200047.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
2473
- tfds_nightly-4.9.9.dev202507200047.dist-info/METADATA,sha256=Ipc7Hh4deRWTnUq8t6AprKbLXn1xFIDT4ts68KCZYEY,11694
2474
- tfds_nightly-4.9.9.dev202507200047.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
2475
- tfds_nightly-4.9.9.dev202507200047.dist-info/entry_points.txt,sha256=eHEL7nF5y1uCY2FgkuYIdE062epJXlAQTSdq89px4p4,73
2476
- tfds_nightly-4.9.9.dev202507200047.dist-info/top_level.txt,sha256=bAevmk9209s_oxVZVlN6hSDIVS423qrMQvmcWSvW4do,20
2477
- tfds_nightly-4.9.9.dev202507200047.dist-info/RECORD,,
2471
+ tfds_nightly-4.9.9.dev202507220045.dist-info/licenses/AUTHORS,sha256=nvBG4WwfgjuOu1oZkuQKw9kg7X6rve679ObS-YDDmXg,309
2472
+ tfds_nightly-4.9.9.dev202507220045.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
2473
+ tfds_nightly-4.9.9.dev202507220045.dist-info/METADATA,sha256=fjPYKkMek2RLp_EgZpG6zzwuTw74Pz-VNaNeZuCGScc,11694
2474
+ tfds_nightly-4.9.9.dev202507220045.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
2475
+ tfds_nightly-4.9.9.dev202507220045.dist-info/entry_points.txt,sha256=eHEL7nF5y1uCY2FgkuYIdE062epJXlAQTSdq89px4p4,73
2476
+ tfds_nightly-4.9.9.dev202507220045.dist-info/top_level.txt,sha256=bAevmk9209s_oxVZVlN6hSDIVS423qrMQvmcWSvW4do,20
2477
+ tfds_nightly-4.9.9.dev202507220045.dist-info/RECORD,,