Description
Describe the bug
Thanks for sharing great work! I want to test call the pre-trained model, but when I just call a pre-trained vision-transformer model, it gave me an error code.
Training with a single process on 1 GPUs.
Model vit_tiny_patch16_224 created, param count:5524802
Data processing configuration for current model + dataset:
input_size: (3, 224, 224)
interpolation: bicubic
mean: (0.5, 0.5, 0.5)
std: (0.5, 0.5, 0.5)
crop_pct: 0.9
AMP not enabled. Training in float32.
Scheduled epochs: 20
Traceback (most recent call last):
File "train.py", line 821, in
main()
File "train.py", line 612, in main
amp_autocast=amp_autocast, loss_scaler=loss_scaler, model_ema=model_ema, mixup_fn=mixup_fn)
File "train.py", line 680, in train_one_epoch
output = model(input)
File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/test_timm/pytorch-image-models/timm/models/vision_transformer.py", line 353, in forward
x = self.forward_features(x)
File "/test_timm/pytorch-image-models/timm/models/vision_transformer.py", line 338, in forward_features
x = self.patch_embed(x)
File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/test_timm/pytorch-image-models/timm/models/layers/patch_embed.py", line 33, in forward
torch._assert(H == self.img_size[0], f"Input image height ({H}) doesn't match model ({self.img_size[0]}).")
AttributeError: module 'torch' has no attribute '_assert'
To Reproduce
Steps to reproduce the behavior:
- Just run the command line below
python train.py ./data/hymenoptera_data/ --model vit_tiny_patch16_224 --pretrained --num-classes 2 --output ./result/test/ --epochs 10
Expected behavior
I thought to get some error of miss-matched between pre-trained weights and my own dataset or get the result of the trained model
Screenshots
Desktop (please complete the following information):
- OS: Ubuntu 18.04.5
- This repository version: pip 20.0.2
- PyTorch version w/ CUDA/cuDNN: 1.6.0 py3.7_cuda10.1.243_cudnn7.6.3_0
Additional context
I think this error seems to be PyTorch's attribute error caused by the Pytorch version. I can't find torch._assert method in the official Pytorch 1.6.0 or 1.7.0 documents. Maybe, it works on only Pytorch version 1.10.0. If it is, can you add some way for a lower version? My Cuda version is 10.1 and I can not upgrade Pytorch 1.6.0 to version 1.10.0. Thanks!