One workaround I use for multi-label classification is to sum the one-hot encoding along the row dimension.
For example, let’s assume there are 5 possible labels in a dataset and each item can have some subset of these labels (including all 5 labels). The code to one-hot encode an item’s labels would look like this:
labels = torch.LongTensor([1, 2, 4])
y_onehot = nn.functional.one_hot(labels, num_classes=5)
y_onehot = y_onehot.sum(dim=0).float()

Hope this helps!