As shown in the huggingface doc for BertForSequenceClassification, the parameter “labels” is actually optional. Only when “labels” is provided would “loss” be returned. Thus you can simply pass “None” as the label input, and use the “text_fea” as the output prediction.