The error is raised in nn.CrossEntropyLoss or nn.NLLLoss, if you pass a target tensor containing an invalid index. The offending target has a value of 17, which would indicate that your are working on a multi-class classification use case of at least 18 classes. If that’s correct, your model output should have the shape [batch_size, nb_classes=18] for a multi-class classification while the target would have the shape [batch_size] containing class indices in the range [0, 17].
Since this error is raised, your model output seems to have a wrong shape and I don’t know how the learning rate could chage this.