I am trying to use the CoAtNet class in the following link CoAtNet Class from Github but I always have error while I am running the following lines:

from torch import nn, sqrt
import torch
import sys
from math import sqrt
from model.conv.MBConv import MBConvBlock
from model.attention.SelfAttention import ScaledDotProductAttention

and I get this error:

ModuleNotFoundError: No module named 'model'

from this line:

from model.conv.MBConv import MBConvBlock

can any one helps me Regards in advance !


1 Answer 1


If you are just using the CoAtNet.py file it gives this error since it is missing relative imports from other folder in the repository (i.e. the MBConvBlock and ScaledDotProductAttention classes). Make sure to either clone the full repository or copy just the two python files (SelfAttention.py and MBConv.py) in which the two classes are defined.

  • $\begingroup$ thank you Oxbowerce!, it has been worked. $\endgroup$
    – Beba.S
    Jan 4 at 0:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.