/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
Labels
bug
Something isn't working
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出现问题
The text was updated successfully, but these errors were encountered: