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

BUG: NeptuneCallback fails for losses other than BaseLoss #22

Closed
slawekslex opened this issue Jan 21, 2022 · 5 comments · Fixed by #29
Closed

BUG: NeptuneCallback fails for losses other than BaseLoss #22

slawekslex opened this issue Jan 21, 2022 · 5 comments · Fixed by #29
Assignees
Labels
bug Something isn't working

Comments

@slawekslex
Copy link

Describe the bug

The line here:

return repr(self.loss_func.func)

assumes that Learner.loss_func is an object with a func attribute. However loss_func can be any callable, like torch.nn.MSELoss or just a plain python function.

This causes is to crash with AttributeError

Reproduction

Create a Learner by passing loss_func=nn.MSELoss() or any other custom function. Together with NeptuneCallback

Expected behavior

Model trains without crashing

@Blaizzy Blaizzy self-assigned this Jan 22, 2022
@Blaizzy
Copy link
Contributor

Blaizzy commented Jan 22, 2022

Hi @slawekslex,

Prince Canuma here, from Neptune.ai,

Thank you for submitting this feedback, I have managed to replicate it with your description and submit a couple of possible fixes to the engineering team, I will let you know once it is fixed.

For now, if this is blocking you. You can edit your local ./neptune_fastai/impl/init.py file line 214 to:

@property
def _optimizer_criterion(self) -> str:
    return repr(self.loss_func)

Let me know this helps you!

@slawekslex
Copy link
Author

Thanks for looking into it @Blaizzy. I was able to work around it by setting a dummy attribute on my loss function.
The problem was more in figuring out what's wrong and the general experience of trying to use a library and needing to deal with error after error.

@Blaizzy
Copy link
Contributor

Blaizzy commented Jan 22, 2022

I understand, but thanks to your feedback we can improve and fix those errors.

Are there any other errors you are facing besides this one(#22) and vocab attr(#21) ?? I would be glad to hear all and dig into them so I provide feedback to engineering.

@slawekslex
Copy link
Author

I'm going to open issues here if I run into anything else. Thanks again for the responsiveness.

@Blaizzy
Copy link
Contributor

Blaizzy commented Jan 22, 2022

Most welcome! 👍

Have a great weekend 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants