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

/usr/lib/python3.7/site-packages/torch/jit/_trace.py:754: UserWarning: The input to trace is already a ScriptModule, tracing it is a no-op. Returning the object as is. #3

Open
claire199705 opened this issue Mar 20, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@claire199705
Copy link

import torch
from PIL import Image

img = Image.open('hen.jpg')
model = torch.hub.load('hankyul2/EfficientNetV2-pytorch', 'efficientnet_v2_s', pretrained=True, nclass=1000)

import matplotlib.pyplot as plt
from torchvision import transforms

transform = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
])
x = transform(img).unsqueeze(0)
model.eval()
trace_model = torch.jit.trace(model, x)
torch.jit.trace(trace_model, "./efficientnet_v2_s.pt")
print("Successfully save traced model")

torch jit trace出现问题

@hankyul2 hankyul2 added the bug Something isn't working label Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants