Why would you freeze the model params? Yes, the model is pretrained, but it has to be fine-tuned on the downstream task. Without that, it will act as a random classifier most likely. And for the loss function, use CrossEntropyLoss. Btw, instead of defining you own BERT for sequence classification, you can use the built-in BertForSequenceClassification from HuggingFace Transformers.