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.99k stars 1.34k forks source link

Re-enable autograd after reading model #140

Closed cplusx closed 5 years ago

cplusx commented 5 years ago

I found when import face_alignment package, it set torch.set_grad_enabled(False), which makes torch close autograd. I was planning to use this package to extract landmarks for my training task and it created some trouble because autograd was closed. I spent some time to finally figure this out. I think it will be a good feature if autograd is re-enabled after loading model.

1adrianb commented 5 years ago

Thanks for suggestion, I will wrap in torch.no_grad() and fix this.