Skip to content

Adapter Training for regression #637

Closed Answered by calpt
FahadEbrahim asked this question in Q&A
Discussion options

You must be logged in to vote

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 set num_labels to 1, e.g.:

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!

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by calpt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #631 on January 17, 2024 20:20.