Hello everyone,
I’m trying to have weight caching , but on one of my models it fails . for caching I’m simply running this snippet :
fname = 'cached_weights_s3fd.pt'
test_imgs = Detector.gen_fake_img(batch=1)
traced = torch.jit.trace(self.detector, test_imgs, check_trace=False)
script = traced.save(fname)
self.detector = torch.jit.load(fname)

and the full stacktrace is as follows:
Traceback (most recent call last):
  File "d:\Codes\Pytorch_Retinaface\detection_core\main_detector.py", line 2074, in <module>
    run_test()
  File "d:\Codes\Pytorch_Retinaface\detection_core\main_detector.py", line 2065, in run_test
    run_capture_sfd()
  File "d:\Codes\Pytorch_Retinaface\detection_core\main_detector.py", line 2002, in run_capture_sfd
    after_detection_fn=None)
  File "Pytorch\detection_core\main_detector.py", line 1523, in __init__
    self._init()
  File "Pytorch\detection_core\main_detector.py", line 1536, in _init
    traced = torch.jit.trace(self.detector, test_imgs, check_trace=False)
  File "C:\Users\User\Anaconda3\lib\site-packages\torch\jit\__init__.py", line 911, in trace
    name = _qualified_name(func)
  File "C:\Users\User\Anaconda3\lib\site-packages\torch\_jit_internal.py", line 683, in _qualified_name
    name = obj.__name__
AttributeError: 'FaceAlignment' object has no attribute '__name__'


Whats wrong?
As far as  I know all classes has __name__ attribute, including the mentioned class in the error.(the name is ‘FaceAlignment’ obviously)
So I’m not sure why I’m getting this. Any help is greatly appreciated.