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

loss function error in tutorial /0_basic.py #315

Open
Juanhui28 opened this issue Jul 24, 2024 · 0 comments
Open

loss function error in tutorial /0_basic.py #315

Juanhui28 opened this issue Jul 24, 2024 · 0 comments

Comments

@Juanhui28
Copy link

hello,

Thanks for providing the amazon repo. But I have a question regarding the loss function in tutorial /0_basic.py. The loss function is loss_func = torch.nn.CrossEntropyLoss() which applies the softmax and log internally. And when we use PromptForClassification and from openprompt.prompts import ManualVerbalizer as model and verbalizer, the default setting for the output of logits = prompt_model(inputs) would go through the softmax and log : https://github.com/thunlp/OpenPrompt/blob/main/openprompt/prompts/manual_verbalizer.py#L147. Then the logits are input the the loss_func which would go through the softmax and log again. I guess there is something wrong? I doesn't make sense the logits go through softmax and log twice. Thanks.

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

1 participant