Get Y list from databunch

I want to use custom loss function for categorization of an unbalanced dataset and to do it I need to calculate per category items distribution, something like this:

weights = 1 / np.bincount(Y)
weights = torch.tensor(weights, dtype=torch.float)
loss = nn.CrossEntropyLoss(weight=weights)

But I got a little bit stuck how to retrieve numericalized labels from databunch. Can anybody please give me the cue what is the proper way to do it?