DataBunches that grabs data "on the fly"?

Ignacio, you can e.g. create you own Dataset

class MyDS(Dataset):
    def __len__(self):
        return 10000

    def __getitem__(self, index):
        # external database is queried here
        the_x = ...
        the_y = ...
        return torch.unsqueeze(the_x, 0), torch.unsqueeze(the_y, 0)
        # watch for dimensions and types here

Instances of MyDS are then given to Databunch.create. Databunch is then given to Learner.

See also this reply about fetching multiple inputs at once.

Ignacio @oguiza, in case you want to return a whole batch from Dataset.__getitem__(): see here

1 Like