Skip to content

Failed to load pretrained weight file in densenet #1

Open
@randomstate4242

Description

@randomstate4242

I saved weight file as below.

import torch
from torchvision import models

// Download and load the pre-trained model
model = models.densenet121(pretrained=True)
print(model)

// Set upgrading the gradients to False
for param in model.parameters():
param.requires_grad = False

modelname = 'densenet121.pt'
example_input = torch.rand(1, 3, 224, 224)
script_module = torch.jit.trace(model, example_input)
script_module.save(modelname)

and then,

DenseNet model;
std::cout << model << std::endl;
model.apply(init_weights);
torch::load(model, "densenet121.pt"); <= void load(Value& value, LoadFromArgs&&... args) { ... archive >> value; } unhandled exception happened ㅠㅠ

image

Thank you in advance for your future help^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions