-
Notifications
You must be signed in to change notification settings - Fork 42
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
Pretrained model #8
Comments
Here is the code for pretrained model. # load AlexNet pre-trained model
def load_pretrained(model):
url = 'https://download.pytorch.org/models/alexnet-owt-4df8aa71.pth'
pretrained_dict = model_zoo.load_url(url)
model_dict = model.state_dict()
# filter out unmatch dict and delete last fc bias, weight
pretrained_dict = {k: v for k, v in pretrained_dict.items() if k in model_dict}
# del pretrained_dict['classifier.6.bias']
# del pretrained_dict['classifier.6.weight']
model_dict.update(pretrained_dict)
model.load_state_dict(model_dict) |
@redhat12345 Thanks for your reply. Can anyone help me please how can I train the model with out pretrained model. |
You can remove the |
@SSARCandy |
Oh. Just remove the |
I have removed load_pretrained() in main. But got the error. Traceback (most recent call last): |
all you have to do is remove line 143-146 |
Thank you so much. I want to use LeNet. But I got error. I want to do SHVN to MNIST. I have created the class lenet. Can you please tell me how can I do that? Thanks in advanced. transform = transforms.Compose([ ###SVHN to MNIST train_dataset = datasets.SVHN('SVHN', download=True, transform=transform, split='train') source_loader = torch.utils.data.DataLoader(train_dataset, batch_size=BATCH_SIZE[0], shuffle=True) class LeNet(nn.Module):
I have also changed class DeepCORAL(nn.Module):
|
Change the input size. The input size should be 32*32 transform = transforms.Compose([ |
Thank you so much. It's working but got poor accuracy. |
In your code you are using pretrained model. For an example, I will not use pretrained model, then what can I do?
I am writing a data loader code. Hopefully, I will get good accuracy as paper and then I will send pull request.
Please help me so that I can use your code without pretrained model.
Thanks in advanced.
The text was updated successfully, but these errors were encountered: