1+ import functools
12import io
23import pathlib
34import re
@@ -183,12 +184,16 @@ def _make_datapipe(
183184 if config .annotations is None :
184185 dp = hint_sharding (images_dp )
185186 dp = hint_shuffling (dp )
186- return Mapper (dp , self ._collate_and_decode_image , fn_kwargs = dict ( decoder = decoder ))
187+ return Mapper (dp , functools . partial ( self ._collate_and_decode_image , decoder = decoder ))
187188
188189 meta_dp = Filter (
189190 meta_dp ,
190- self ._filter_meta_files ,
191- fn_kwargs = dict (split = config .split , year = config .year , annotations = config .annotations ),
191+ functools .partial (
192+ self ._filter_meta_files ,
193+ split = config .split ,
194+ year = config .year ,
195+ annotations = config .annotations ,
196+ ),
192197 )
193198 meta_dp = JsonParser (meta_dp )
194199 meta_dp = Mapper (meta_dp , getitem (1 ))
@@ -226,7 +231,7 @@ def _make_datapipe(
226231 buffer_size = INFINITE_BUFFER_SIZE ,
227232 )
228233 return Mapper (
229- dp , self ._collate_and_decode_sample , fn_kwargs = dict ( annotations = config .annotations , decoder = decoder )
234+ dp , functools . partial ( self ._collate_and_decode_sample , annotations = config .annotations , decoder = decoder )
230235 )
231236
232237 def _generate_categories (self , root : pathlib .Path ) -> Tuple [Tuple [str , str ]]:
@@ -235,7 +240,8 @@ def _generate_categories(self, root: pathlib.Path) -> Tuple[Tuple[str, str]]:
235240
236241 dp = resources [1 ].load (pathlib .Path (root ) / self .name )
237242 dp = Filter (
238- dp , self ._filter_meta_files , fn_kwargs = dict (split = config .split , year = config .year , annotations = "instances" )
243+ dp ,
244+ functools .partial (self ._filter_meta_files , split = config .split , year = config .year , annotations = "instances" ),
239245 )
240246 dp = JsonParser (dp )
241247
0 commit comments