GithubHelp home page GithubHelp logo

Can't load ckpt about byol-pytorch HOT 4 CLOSED

lucidrains avatar lucidrains commented on May 14, 2024
Can't load ckpt

from byol-pytorch.

Comments (4)

aiyolo avatar aiyolo commented on May 14, 2024 2

yes, ckpt['state_dict'] saves the model's parameters. The way that pytorch lightning load checkpoint is different from pytorch, you should try the following code instead:

from torchvision import models
resnet = models.resnet50(pretrained=False)
cfg = dict(
    net=resnet,
    image_size = 256,
    hidden_layer = 'avgpool',
    projection_size = 256,
    projection_hidden_size = 4096,
    moving_average_decay = 0.99
)
model = SelfSupervisedLearner.load_from_checkpoint(
            'lightning_logs/version_1/checkpoints/epoch=127.ckpt', **cfg
          )

from byol-pytorch.

AndrewTal avatar AndrewTal commented on May 14, 2024

I tried this and it seemed okay, I don't know if it is correct.
截屏2020-11-18 下午12 19 15

At the same time, the resnet parameters have also changed. Is the ResNet model saved in this way correct?

from byol-pytorch.

wencc-ucas avatar wencc-ucas commented on May 14, 2024

model = SelfSupervisedLearner.load_from_checkpoint(
'lightning_logs/version_1/checkpoints/epoch=127.ckpt', **cfg
)

when I tried this, I got another issue:" TypeError: load_from_checkpoint() got an unexpected keyword argument 'net'"

from byol-pytorch.

 avatar commented on May 14, 2024

model = SelfSupervisedLearner.load_from_checkpoint(
'lightning_logs/version_1/checkpoints/epoch=127.ckpt', **cfg
)

when I tried this, I got another issue:" TypeError: load_from_checkpoint() got an unexpected keyword argument 'net'"

yes, I got this issue too.

from byol-pytorch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.