Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The file output after training the model is a .ckpt file. Is this the final result of the model? #143

Open
niwenbo123 opened this issue Dec 27, 2024 · 2 comments
Labels
question Further information is requested

Comments

@niwenbo123
Copy link

Hello, I used the model you provided for training, and after completing the training, I noticed that the output file is a .ckpt file. I would like to confirm whether this .ckpt file is the final result of the model training? Do I need any further steps (such as converting it to another format) in order to use it for inference or deployment?
Snipaste_2024-12-27_19-34-42

@niwenbo123 niwenbo123 added the question Further information is requested label Dec 27, 2024
@henrytsui000
Copy link
Member

henrytsui000 commented Jan 3, 2025

Hi,

Yes, the .ckpt file can be considered the final result of the model training. To use it for inference or deployment, we currently recommend the following adjustments because we haven't fully merged the lightning training process and the original process.

In yolo/lazy.py, modify line 37:
https://github.com/WongKinYiu/YOLO/blob/51f507f61e733b2a1ef993a5bc544f4e8b749f1d/yolo/lazy.py#L37
to

model = ValidateModel.load_from_checkpoint('[your checkpoint path]', cfg=cfg)

This should allow you to load your checkpoint for inference or further deployment.

Best regards,
Henry Tsui

@ramonhollands
Copy link
Contributor

@henrytsui000

I extended the code to do inference on my custom trained model:

""" if cfg.task.task == "inference":
if 'ckpt' in cfg.weight:
model = InferenceModel.load_from_checkpoint(cfg.weight, cfg=cfg)
else:
model = InferenceModel(cfg)
trainer.predict(model)
"""

This gives errors related to
⚠ Weight Not Found for key: 18.conv3.0.bottleneck.1.conv1.conv1 (because they are stored as model.model.
and
Unexpected key(s) in state_dict: "ema.model.0.conv.weight"

What do you recommend? I saw the related PR (152) but I think the 'load_from_checkpoint' is the way to go eventually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants