object-wakeup icon indicating copy to clipboard operation
object-wakeup copied to clipboard

Error "ImportError: cannot import name 'ViTModel'"

Open RyanHangZhou opened this issue 3 years ago • 2 comments

Hi,

With PyTorch 1.0.0 and transformer (from 3.8 to 4.18), for running sample inference, we always have the problem: ImportError: cannot import name 'ViTModel'. The provided environment seems errorous for deployment. It seems that the pretrained model is obtained from a very early PyTorch version (1.0.0), while for installing transformer package, PyTorch 1.0.0 has incompatible issues.

Looking forward to your responses, thanks.

RyanHangZhou avatar Nov 03 '22 09:11 RyanHangZhou

Hello Hang,

Would you please try PyTorch 1.9 (or 1.10). I just rechecked the virtual env we have and found the current environment file might have incorrect dependency version numbers.

Let me know if it works for you or not.

Kulbear avatar Nov 03 '22 19:11 Kulbear

Hello Hang,

Would you please try PyTorch 1.9 (or 1.10). I just rechecked the virtual env we have and found the current environment file might have incorrect dependency version numbers.

Let me know if it works for you or not.

Thanks Ji, after upgrading PyTorch version to 1.9.0, it works!

RyanHangZhou avatar Nov 03 '22 20:11 RyanHangZhou