1adrianb / face-alignment

:fire: 2D and 3D Face alignment library build using pytorch
https://www.adrianbulat.com
BSD 3-Clause "New" or "Revised" License
6.89k stars 1.33k forks source link

Error in initialization in version 1.3.0 #241

Closed La4La closed 3 years ago

La4La commented 3 years ago

First of all, thank you for developing this great library!

I've used this library for a while. I can use version 1.1.1 and 1.2.0 without any problem, however I got the following error after I updated it to 1.3.0 or 1.3.1. (I'm using pytorch 1.6.0+cu101.)

In [1]: import face_alignment

In [2]: fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=False)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-2-265c29806126> in <module>
----> 1 fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=False)

~/.local/lib/python3.8/site-packages/face_alignment/api.py in __init__(self, landmarks_type, network_size, device, flip_input, face_detector, verbose)
     65         else:
     66             network_name = '3DFAN-' + str(network_size)
---> 67         self.face_alignment_net = torch.jit.load(load_file_from_url(models_urls[network_name]))
     68
     69         self.face_alignment_net.to(device)

/opt/miniconda/lib/python3.8/site-packages/torch/jit/__init__.py in load(f, map_location, _extra_files)
    273     cu = torch._C.CompilationUnit()
    274     if isinstance(f, str) or isinstance(f, pathlib.Path):
--> 275         cpp_module = torch._C.import_ir_module(cu, f, map_location, _extra_files)
    276     else:
    277         cpp_module = torch._C.import_ir_module_from_buffer(cu, f.read(), map_location, _extra_files)

RuntimeError:

aten::_convolution(Tensor input, Tensor weight, Tensor? bias, int[] stride, int[] padding, int[] dilation, bool transposed, int[] output_padding, int groups,
bool benchmark, bool deterministic, bool cudnn_enabled) -> (Tensor):
Expected at most 12 arguments but found 13 positional arguments.
:
/home/SERILOCAL/adrian.bulat/miniconda3/lib/python3.7/site-packages/torch/nn/modules/conv.py(420): _conv_forward
/home/SERILOCAL/adrian.bulat/miniconda3/lib/python3.7/site-packages/torch/nn/modules/conv.py(423): forward
/home/SERILOCAL/adrian.bulat/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py(709): _slow_forward
/home/SERILOCAL/adrian.bulat/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py(725): _call_impl
/home/SERILOCAL/adrian.bulat/test/face-alignment/face_alignment/models/fan.py(134): forward
/home/SERILOCAL/adrian.bulat/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py(709): _slow_forward
/home/SERILOCAL/adrian.bulat/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py(725): _call_impl
/home/SERILOCAL/adrian.bulat/miniconda3/lib/python3.7/site-packages/torch/jit/_trace.py(940): trace_module
/home/SERILOCAL/adrian.bulat/miniconda3/lib/python3.7/site-packages/torch/jit/_trace.py(742): trace
kk1997-oct commented 3 years ago

I've got same problem like you just now. Have you solved it?

La4La commented 3 years ago

I've got same problem like you just now. Have you solved it?

Not yet. Want help from the author 🙏

1adrianb commented 3 years ago

A quick fix is to update to pytorch 1.7.x I will deploy a fix for 1.6.0 in 2-3 hours

1adrianb commented 3 years ago

This should be now fixed if you update from source or to 1.3.2. The minimum pytorch version required is 1.5