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

problem with classification #6

Open
alibeknakhimov opened this issue Oct 28, 2023 · 0 comments
Open

problem with classification #6

alibeknakhimov opened this issue Oct 28, 2023 · 0 comments

Comments

@alibeknakhimov
Copy link

import torch
from torch.utils.mobile_optimizer import optimize_for_mobile

model = torch.load('best.pt',map_location="cpu")
model.eval()
example = torch.rand(1, 3, 224, 224)
traced_script_module = torch.jit.trace(model, example)
optimized_traced_model = optimize_for_mobile(traced_script_module)
optimized_traced_model._save_for_lite_interpreter("model.pt")

when i use this code for optimize for mobile it has error

AttributeError Traceback (most recent call last)
in <cell line: 6>()
4
5 model = torch.load('best.pt',map_location="cpu")
----> 6 model.eval()
7 example = torch.rand(1, 3, 224, 224)
8 traced_script_module = torch.jit.trace(model, example)

AttributeError: 'dict' object has no attribute 'eval'

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

No branches or pull requests

1 participant