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
Support discriminative learning with OptimWrapper #2829
Comments
Here is another option, but it doesn't always work:
This works fine when passed here:
But when I tried the same thing for a second optimizer from pytorch:
I get the following error:
But using the splitter method that has no issues. |
Many thanks. So I guess there might be two possible solutions: try to make fastai's optimizers have the same structure as PyTorch's, or else try to make OptimWrapper or something similar change the splitter, right? |
I think it makes more sense to maintain consistency between pytorch and fastai (as it might help in the long run). For the implementation we can use this: def l2d(ps): return L(dict(params=p) for p in ps)
def splitter(m): return l2d(L(m[0][:3], m[0][3:], m[1:]).map(params)) With this we only need to add |
I will try to work on this tomorrow. |
@kevinbird15 Did the splitter function work for you in all the cases? There are some tests failing in my case. In |
@KushajveerSingh why did you close this? I don't believe it's resolved yet. |
Oh no. Was playing with |
@KushajveerSingh Are you working on this? Tag me and I will assign you if so. |
Currently, I am not working on this. |
Currently, the following code gives error
The error is as follows:
The error is due to the fact that pytorch optimizers want the param list to be of the format
list(dict(params='model_parameters'))
. In case of fastai this islist(list(params='model_parameters'))
.It was also verified that the error does not occur when discriminative learning is not used.
One possible solution to the problem is to update the splitter to output
list(dict)
as shown belowI don't know if this is the best solution but as of now it get the work done.
Working code
Maybe the splitter code can be made part of
OptimWrapper
but I am not sure.The text was updated successfully, but these errors were encountered: