Open duarteharris opened 6 months ago
I tried the same code before but with num_labels=1 and the it worked, 'though isn't (I think) quite what I'd like since I want to model to predict either 0 or 1 and not a continuous from 0 to 1.
Setting the num_labels
to 1 is the solution for your problem. If you want an integer prediction, you will have to choose a threshold between 0 and 1 to determine whether it's a 0 or 1. Have a look at my answers here to help https://github.com/UKPLab/sentence-transformers/issues/2624.
I'm (more or less) following the Training_quora_duplicate_questions.py example using my own data.
As I understood from the cross encoder page, and I quote:
As such I've written the model thusly:
model = CrossEncoder("distilroberta-base", num_labels= 2)
and the evaluator thusly:
evaluator = CEBinaryClassificationEvaluator.from_input_examples(dev_examples, name= "Rooms-dev")
Yet, when I run the code as soon as it tries to evaluate for the first time it gives the following error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
I tried the same code before but with num_labels=1 and the it worked, 'though isn't (I think) quite what I'd like since I want to model to predict either 0 or 1 and not a continuous from 0 to 1.
Any ideia what might be causing this?
Code and error message below:
Thank you in advance for any help.