Many thanks @nielsr, the thing is that we use PytorchLightning and it saves the model in ckpt format automatically and then it has this load_from_ckpt function too. Do you know if there is compatibility between the ckpt format of PL and the HF format?