The usual way would be to pass a transformation to your Dataset and apply it in the __getitem__.
Based on the linked code, it seems that you are using different abstractions, where get_batch is calling into a DataLoader. You could either try to apply the transformation directly in the get_batch method or add it to the LmdbDataset and apply it in the __getitem__. The data loading tutorial 2 explains the common use case in more detail.