PrototypeMultiProcessingReadingService¶
- class torchdata.dataloader2.PrototypeMultiProcessingReadingService(num_workers: int = 0, multiprocessing_context=None, prefetch_worker: int = 10, prefetch_mainloop: int = 10)¶
PrototypeMultiProcessingReadingServicethat spawns multiple subprocesses to iterate theDataPipegraph. ThisReadingServiceis still under prototype stage and will replaceMultiProcessingReadingServiceeventually.- Parameters:
num_workers (int, optional) – How many subprocesses to use for data loading.
0will be replaced byInProcessReadingServicein the future.multiprocessing_context (str, optional) – Multiprocessing starting method. If method is None then the default context is returned. Otherwise method should be ‘fork’, ‘spawn’.
- finalize() None¶
PrototypeMultiProcessingReadingServiceinvalidate states & properly exits all subprocesses.
- initialize(datapipe: Union[IterDataPipe, MapDataPipe]) Union[IterDataPipe, MapDataPipe]¶
PrototypeMultiProcessingReadingServicefinds information about sharding, separates graph by multiple pieces and reconnects it using queues. creates subprocesses.
- initialize_iteration() None¶
ReadingServicespins up service for an epoch. Called at the beginning of every time gettingDataLoader2iterator.