Code Monkey home page Code Monkey logo

Comments (11)

Jamshidhsp avatar Jamshidhsp commented on August 29, 2024 2

@hanoonaR I saw you edited the message on saving the model. It works now! You helped a lot. I really appreciate it!

from research-contributions.

hanoonaR avatar hanoonaR commented on August 29, 2024 1

@Jamshidhsp,

I solved it by modifying the line in UNETR/BTCV/trainer.py that saves the model as,

torch.save(model.state_dict(), filename). Provide the filename as model.pth instead of model.pt.

Thank you.

from research-contributions.

hanoonaR avatar hanoonaR commented on August 29, 2024 1

HI @Jamshidhsp ,

Sure. Please find the environment details:
python: 3.8.13
protobuf: 3.19.4
torch: 1.9.1+cu111
monai: 0.7.0
nibabel: 3.1.1

PS: Please note that the command to save model is modified from torch.save(save_dict, filename) to torch.save(model.state_dict(), filename).

Hope it helps. Thank you.

from research-contributions.

Jamshidhsp avatar Jamshidhsp commented on August 29, 2024 1

@hanoonaR Thank you for the details and your help. It didn't work, but very useful. I will try finding it out.

from research-contributions.

ahatamiz avatar ahatamiz commented on August 29, 2024

Hi @1640477469

It is most likely a mismatch between your Pytorch/MONAI version and specified dependencies in this repository.

Thanks

from research-contributions.

hanoonaR avatar hanoonaR commented on August 29, 2024

Hi @1640477469,

I faced the same problem with UNETR models trained using the repository. Did you find any solution?

Thank you.

from research-contributions.

Jamshidhsp avatar Jamshidhsp commented on August 29, 2024

Same issue with me, I am not able to load my own trained model. Could somebody work it out please?

from research-contributions.

Jamshidhsp avatar Jamshidhsp commented on August 29, 2024

@hanoonaR Thank you very much. I did it and now, I am facing the error:
RuntimeError: PytorchStreamReader failed locating file constants.pkl: file not found

Could you manage it?
Thanks

from research-contributions.

hanoonaR avatar hanoonaR commented on August 29, 2024

@Jamshidhsp, Yes I faced the same issue and had to retrain the model and save it in the above mentioned way, in .pth form. The issue was then resolved. Thank you.

from research-contributions.

Jamshidhsp avatar Jamshidhsp commented on August 29, 2024

@hanoonaR Thank you again. I am gonna retrain again!

from research-contributions.

Jamshidhsp avatar Jamshidhsp commented on August 29, 2024

@hanoonaR Thank you very much for your help. Actually I tried to get over it. I used the same version of pytorch and monai, changed model from .pt to .pth. But at the end, I face the error again. I am wondering the problem arises from python version or protobuf version. Could you please check the version of protobuf/python you used? I really appreciate it.
Thanks

from research-contributions.

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.