Skip to content
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

How to finetune on Custom Loss function #38

Open
gopal86 opened this issue Mar 26, 2024 · 7 comments
Open

How to finetune on Custom Loss function #38

gopal86 opened this issue Mar 26, 2024 · 7 comments

Comments

@gopal86
Copy link

gopal86 commented Mar 26, 2024

Hi, I wanted to fine tune the model on my own dataset however with my own custom loss. Could you give an example on how to do that?
Thanks

@ashok-arjun
Copy link
Contributor

Hi @gopal86. What kind of loss functions would you like to finetune it with?

@jinxzed
Copy link

jinxzed commented Apr 15, 2024

Hi, I would like to train on weighted mape loss function. Kindly share an example

@ashok-arjun
Copy link
Contributor

You would have to replace the last layer with an appropriate layer for the loss function, and then finetune the model.

You could try finetuning just the last layer, or the entire model.

@gopal86
Copy link
Author

gopal86 commented Apr 16, 2024

Hi @gopal86. What kind of loss functions would you like to finetune it with?

I have certain constraints which I would like to impose. Could you give an example on how to fine-tune any custom loss function?

@ashok-arjun
Copy link
Contributor

When you finetune on any other function, you will have to change the last layer to whatever is appropriate.

For instance, if you would like to perform classification, you could put a linear layer with softmax at the end after the embeddings, and then use the cross entropy loss.

If you would like to perform regression, you could put a linear layer at the end with a single output, and use the MSE loss.

When training, you could train the full model or just the last layer.

An idea: To start with, you could get the embeddings from the pretrained model, and then train a simple statistical classifier/regressor on the embeddings.

@jinxzed
Copy link

jinxzed commented May 2, 2024 via email

@jinxzed
Copy link

jinxzed commented May 2, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants