We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Issue
learn = vision_learner(dls, resnet18, metrics=error_rate, loss_func = nn.CrossEntropyLoss(weight=tensor(2.,1.)))
learn.summary()
Optimizer used: <function Adam at 0x79df4959c790> Loss function: CrossEntropyLoss()
The workaround
learn.loss_func.func = nn.CrossEntropyLoss(weight=tensor(2.,1.))
Optimizer used: <function Adam at 0x79df4959c790> Loss function: CrossEntropyLoss( (func): CrossEntropyLoss() )
https://forums.fast.ai/t/changing-default-loss-functions/28981
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Issue
loss function added in when creating learner
learn = vision_learner(dls, resnet18, metrics=error_rate, loss_func = nn.CrossEntropyLoss(weight=tensor(2.,1.)))
learn.summary reveals no modified loss function in use
learn.summary()
Optimizer used: <function Adam at 0x79df4959c790>
Loss function: CrossEntropyLoss()
The workaround
loss function added in when creating learner
learn = vision_learner(dls, resnet18, metrics=error_rate, loss_func = nn.CrossEntropyLoss(weight=tensor(2.,1.)))
After learner is created I add in the loss function
learn.loss_func.func = nn.CrossEntropyLoss(weight=tensor(2.,1.))
summary reveals the function actually updated this time
learn.summary()
Optimizer used: <function Adam at 0x79df4959c790>
Loss function: CrossEntropyLoss(
(func): CrossEntropyLoss()
)
forum posts that reveal the same issue
https://forums.fast.ai/t/changing-default-loss-functions/28981
The text was updated successfully, but these errors were encountered: