Giter VIP home page Giter VIP logo

Comments (5)

tongchangD avatar tongchangD commented on September 26, 2024 1

@glenn-jocher I came up with a solution,
Only the pure model parameters are saved in version 8.1.106, and then the pure model parameters are obtained under 8.1.44.

from ultralytics.

glenn-jocher avatar glenn-jocher commented on September 26, 2024

Hi there! It seems like the issue might be related to incompatible versions between the one used to save the model (ultralytics==8.1.106) and the one you're trying to load it with (ultralytics==8.1.44). You might be able to resolve this error by ensuring both the saving and loading are performed with the same version of the library. If you cannot run the same older version, consider upgrading your current environment to match the version used for saving the model. Here’s how you can upgrade the library:

pip install ultralytics==8.1.106

Just make sure that the version number matches exactly to the one used for saving the model weights. Let me know if this helps or if you encounter any other issues! πŸš€

from ultralytics.

tongchangD avatar tongchangD commented on September 26, 2024

I am aware that the upgrade to 8.1.106 is capable of reading this weight, but I would like to read this weight under 8.1.44 for retraining.

from ultralytics.

glenn-jocher avatar glenn-jocher commented on September 26, 2024

@tongchangD hi there! That sounds like a great approach! By saving only the model parameters in version 8.1.106 and then loading them in version 8.1.44, you should be able to bypass the module compatibility issues. Here's a quick example of how you can do this:

Saving model parameters in 8.1.106

# Assuming 'model' is your trained model
torch.save(model.state_dict(), 'model_weights.pth')

Loading model parameters in 8.1.44

# Make sure to initialize the model architecture similarly as it was in 8.1.106
model.load_state_dict(torch.load('model_weights.pth', map_location=torch.device('cpu')))
model.eval()

This method ensures that you're only dealing with the raw weights and biases, independent of any specific module structure that might have changed between versions. Let me know if this works for you! 😊

from ultralytics.

github-actions avatar github-actions commented on September 26, 2024

πŸ‘‹ Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLO πŸš€ and Vision AI ⭐

from ultralytics.

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.