Good to hear you’ve solved the first issue! 
For the second one: check the shape of the model output and make sure it contains logits for at least 17 classes, since the target tries to index it with a value of 16 ([0, 16] make 17 valid classes).