Skip to content

Custom batch sampler fails to re-instantiate in _dataloader_init_kwargs_resolve_sampler #20272

@Kamichanw

Description

@Kamichanw

Outline & Motivation

I created a batch sampler of batches which is used to sample a larger batch. For example, assume we have a PyTorch BatchSampler which yields a batch of batch_size=3. I can use my custom batch sampler whose batch_size=5 to sample 5 times from underlying batch sampler to yield a large batch of batch_size=15.

However, in function _dataloader_init_kwargs_resolve_sampler, it tries to inject a normal sampler (only yield one batch) to my custom batch sampler.

Pitch

I want to know what is the correct approach in my situation.

Additional context

No response

cc @justusschock @awaelchli

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions