Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapter Training for regression #631

Closed
FahadEbrahim opened this issue Jan 5, 2024 · 1 comment
Closed

Adapter Training for regression #631

FahadEbrahim opened this issue Jan 5, 2024 · 1 comment
Labels
question Further information is requested

Comments

@FahadEbrahim
Copy link
Contributor

FahadEbrahim commented Jan 5, 2024

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,
Fahad.

@FahadEbrahim FahadEbrahim added the question Further information is requested label Jan 5, 2024
@FahadEbrahim FahadEbrahim changed the title Adapter for regression Adapter Training for regression Jan 5, 2024
@calpt
Copy link
Member

calpt commented Jan 17, 2024

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!

@adapter-hub adapter-hub locked and limited conversation to collaborators Jan 17, 2024
@calpt calpt converted this issue into discussion #637 Jan 17, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants