Problem type if statement seems to be wrong in text_classification.py?

I was reading the source code in transformers\pipelines\text_classification.py

Line 175-178

            if self.model.config.problem_type == "multi_label_classification" or self.model.config.num_labels == 1:
                function_to_apply = ClassificationFunction.SIGMOID
            elif self.model.config.problem_type == "single_label_classification" or self.model.config.num_labels > 1:
                function_to_apply = ClassificationFunction.SOFTMAX

Altough when I was debugging the code, it seems problem_type is empty and it is the num_lables to decide which function to apply, but should it be SIGMOID for single label classification and SOFTMAX for multi-label?

1 Like