I have a test.py file that uses “class ArcMarginModel(torch.nn.Module)” from an insightface_models.py in a folder named “models” in my project. This is imported in an init.py file as follows:
from .insightface_models import ArcMarginModel
When I remove the init.py I get the following error (even if I move everything from insightface_models.py into my test.py):
Message=Can’t get attribute ‘ArcMarginModel’ on <module ‘models’ (namespace)>
My code is as follows:
arcface_checkpoint = torch.load(arcface_model, map_location=device) arcface = arcface_checkpoint['model'].module arcface = arcface.to(device) self.arcface.eval()
How can I make this work without the init.py? Why am I getting this error?