自行准备好相关的依赖
import timm
import torch
# 至少支持2种协议, 一种是本地协议local-dir:,一种是hg下载hf_hub;
# hf_hub:timm/efficientvit_m4.r224_in1k for hg ; 需要自行设置:HF_ENDPOINT=https://hf-mirror.com 环境变量
model = timm.create_model('local-dir:/home/ctbots/llm/timm/efficientvit_b0.r224_in1k', pretrained=True)
model.eval()
# 模拟输入
dummy_input = torch.randn(1, 3, 224, 224)
output = model(dummy_input)
print(str(output))