GIL error when importing torch in file with pybind11 function

I wrote a script where I call pybind11 function. Everything works fine until I import torch in the same file.

import example_cpp
import torch

if __name__ == "__main__":
    example_cpp.add(1, 2)
RuntimeError: The autograd engine was called while holding the GIL. If you are using the C++ API, the autograd engine is an expensive operation that does not require the GIL to be held so you should release it with 'pybind11::gil_scoped_release no_gil;'. If you are not using the C++ API, please report a bug to the pytorch team.