@@ -89,7 +89,7 @@ To get a single tensor, you must explicitly use the Array feature type and speci
8989{' data' : < tf.Tensor: shape=(3 ,), dtype=int64, numpy=array([0 , 0 , 1 ])>
9090```
9191
92- Strings are also supported:
92+ Strings and binary objects are also supported:
9393
9494```py
9595>> > from datasets import Dataset, Features
@@ -111,7 +111,38 @@ You can also explicitly format certain columns and leave the other columns unfor
111111 ' text' : [' foo' , ' bar' ]}
112112```
113113
114- The [`Image` ] and [`Audio` ] feature types are not supported yet.
114+ String and binary objects are unchanged, since PyTorch only supports numbers.
115+
116+ The [`Image` ] and [`Audio` ] feature types are also supported:
117+
118+ ```py
119+ >> > from datasets import Dataset, Features, Audio, Image
120+ >> > data = [" path/to/image.png" ]
121+ >> > features = Features({" data" : Image()})
122+ >> > ds = Dataset.from_dict({" data" : data}, features = features)
123+ >> > ds = ds.with_format(" tf" )
124+ >> > ds[0 ]
125+ {' data' : < tf.Tensor: shape=(215 , 1200 , 4 ), dtype=uint8, numpy=
126+ array([[[255 , 215 , 106 , 255 ],
127+ [255 , 215 , 106 , 255 ],
128+ ... ,
129+ [255 , 255 , 255 , 255 ],
130+ [255 , 255 , 255 , 255 ]]], dtype = uint8)> }
131+ ```
132+
133+ ```py
134+ >> > from datasets import Dataset, Features, Audio, Image
135+ >> > data = [" path/to/audio.wav" ]
136+ >> > features = Features({" data" : Audio()})
137+ >> > ds = Dataset.from_dict({" data" : data}, features = features)
138+ >> > ds = ds.with_format(" tf" )
139+ >> > ds[0 ][" data" ][" array" ]
140+ < tf.Tensor: shape=(202311 ,), dtype=float32, numpy=
141+ array([ 6.1035156e-05 , 1.5258789e-05 , 1.6784668e-04 , ... ,
142+ - 1.5258789e-05 , - 1.5258789e-05 , 1.5258789e-05 ], dtype = float32)>
143+ >> > ds[0 ][" data" ][" sampling_rate" ]
144+ < tf.Tensor: shape=(), dtype=int32, numpy=44100 >
145+ ```
115146
116147# # Data loading
117148
0 commit comments