Adapter Training for regression #637
-
Hello, I'd like to create/train an adapter for a Regression task and the evaluation is based on MSE and Spearman's correlation coefficient. Any advice on what needs to be changed from a classification task in Adapter Training? With my thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @FahadEbrahim, there should be not much that needs to be changed! The classification head provided by model.add_classification_head(
"task_name"
num_labels=1,
) The rest of the training script should be very similar to classification. As an example, you can have a look at the GLUE script, which supports STS-B (a regression task evaluated with spearmen coefficient) in addition to the other (classification) tasks: https://github.com/adapter-hub/adapters/blob/main/examples/pytorch/text-classification/run_glue.py Hope this helps! |
Beta Was this translation helpful? Give feedback.
Hi @FahadEbrahim,
there should be not much that needs to be changed! The classification head provided by
AdapterModel
classes automatically switches to regression training (with MSE loss), if you setnum_labels
to 1, e.g.:The rest of the training script should be very similar to classification. As an example, you can have a look at the GLUE script, which supports STS-B (a regression task evaluated with spearmen coefficient) in addition to the other (classification) tasks: https://github.com/adapter-hub/adapters/blob/main/examples/pytorch/text-classification/run_glue.py
Hope this helps!