yuhuixu1993 / PC-DARTS

PC-DARTS:Partial Channel Connections for Memory-Efficient Differentiable Architecture Search
436 stars 108 forks source link

How can i import the network and weights in a different script ? #14

Closed cristyioan2000 closed 5 years ago

cristyioan2000 commented 5 years ago

Hello,

I want to load the found architecture in a different script, is there a way to load the architecture structure(class) and the .weight file externally, just by importing using torch.load() ?

Thanks

yuhuixu1993 commented 5 years ago

@cristyioan2000, I think you may need to add the structure file as the model.py, e.g. resnet.py and import the structure in the training file.

cristyioan2000 commented 5 years ago

I was thinking that I can create a checkpoint file

checkpoint_file = {
'model': Some_Model_Class(),
'weights':model.state_dict()
} 
torch.save(checkpoint_file,'architecture.pth')

I'm going to try both ways and post the result.