What exactly is your output?
It should be a tensor of size (N, C), where the element output[n, c] should be the probability that element n is of class c. Is this what it is? (It doesn’t sound like it, because output[n, 6] should be equal to 0 but the error is telling you you don’t have enough enough classes).