Does writing a custom sampler that is guaranteed to sample from the smaller class every x samples work? Alternatively, a more crude but simpler solution is to just set weights for the desired balance you want and to simply throw out batches that have 0 entities for that class. Note that if you set shuffle=True this will still use all of your data over time, just not over every epoch.