yitu-opensource / T2T-ViT

ICCV2021, Tokens-to-Token ViT: Training Vision Transformers from Scratch on ImageNet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

On the Parameter Selection Problem of 'pretrained' in Creating Models

xuanRyc opened this issue · comments

I want to use a pretrained model。when I follow this code
'from models.t2t_vit import *
from utils import load_for_transfer_learning

create model

model = t2t_vit_14()

load the pretrained weights

load_for_transfer_learning(model, /path/to/pretrained/weights, use_ema=True, strict=False, num_classes=1000)',

only by turning 't2t_vit_t_14()'Setting the parameter 'pretrained' to False is necessary for normal operation, otherwise an error will be reported,just like'RuntimeError: Invalid pretrained config, cannot load weights. Use pretrained=False for random init.'
I don't know if I actually used the parameters of the pretrained model