monkeypatch.data.batch_dataset_fetcher

monkeypatch.data.batch_dataset_fetcher

Monkey patches for the dataset fetcher to handle batches of packed indexes.

Functions

Name Description
apply_multipack_dataloader_patch This patch allows DataLoader to correctly process batches that contain multiple bins
patch_fetchers Apply patches to PyTorch’s DataLoader components.
patched_worker_loop Worker loop that ensures patches are applied in worker processes.
remove_multipack_dataloader_patch Remove the monkeypatch and restore original PyTorch DataLoader behavior.

apply_multipack_dataloader_patch

monkeypatch.data.batch_dataset_fetcher.apply_multipack_dataloader_patch()

This patch allows DataLoader to correctly process batches that contain multiple bins of packed sequences.

patch_fetchers

monkeypatch.data.batch_dataset_fetcher.patch_fetchers()

Apply patches to PyTorch’s DataLoader components.

patched_worker_loop

monkeypatch.data.batch_dataset_fetcher.patched_worker_loop(*args, **kwargs)

Worker loop that ensures patches are applied in worker processes.

remove_multipack_dataloader_patch

monkeypatch.data.batch_dataset_fetcher.remove_multipack_dataloader_patch()

Remove the monkeypatch and restore original PyTorch DataLoader behavior.