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

Fine tune the existing Model #42

Open
muhammadabdullah34907 opened this issue Jul 2, 2020 · 1 comment
Open

Fine tune the existing Model #42

muhammadabdullah34907 opened this issue Jul 2, 2020 · 1 comment

Comments

@muhammadabdullah34907
Copy link

Hi @Nathanua

I want to fine tune the existing model(u2net). I understand that we can resume the training simply as discussed in this issue.
#33

if(model_name=='u2net'):
    net = U2NET(3, 1)
elif(model_name=='u2netp'):
    net = U2NETP(3,1)
net.load_state_dict(torch.load(saved_model_dir))

if torch.cuda.is_available():
    net.cuda()

In addition, to resume the training from where exactly it was, one usually needs to save and load the optimizer (especially for Adam)

So my question is In addition to weights, how can I load the optimizer state as well ?

@bluesky314
Copy link

I dont think opt state dict is given in pth file so you will have to restart it. Doing learning rate warmup will be a good idea.

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

2 participants