in torchdata/datapipes/iter/util/cacheholder.py [0:0]
def _end_caching(self):
filepath_fn, hash_dict, hash_type, extra_check_fn = OnDiskCacheHolderIterDataPipe._temp_dict.pop(self)
todo_dp, cached_dp = self.source_datapipe.demux(
2,
partial(
OnDiskCacheHolderIterDataPipe._cache_check_fn,
filepath_fn=filepath_fn,
hash_dict=hash_dict,
hash_type=hash_type,
extra_check_fn=extra_check_fn,
),
)
# Cached: keep filepath(s)
cached_dp = cached_dp.map(fn=filepath_fn)
# Convert list back to single elements
cached_dp = cached_dp.unbatch(-1)
self.source_datapipe = todo_dp
self._end_caching_flag = True
return cached_dp