Hugging face repo sample code issues
Closed this issue · 4 comments
The sample code on huggingface repo page, errors saying models package is missing
The models directory is included in the huggingface code.
(https://huggingface.co/minchul/cvlface_adaface_vit_base_kprpe_webface4m/tree/main)
It would be good to inspect why, in your code, the code is not registering the directory as a package.
If it requires changing the huggingface code, feel free to let me know.
While using the code in readme of huggingface, I am getting the same error. Can you please check? @mk-minchul
I faced the same issue when I directly used the demo code from huggingface. But I was able to correctly run the verify.py script. So I went in and found the difference between the two. The problem lies in the load_model_from_local_path
. You should change it to:
def load_model_from_local_path(path, HF_TOKEN=None):
cwd = os.getcwd()
os.chdir(path)
sys.path.insert(0, path)
model = AutoModel.from_pretrained(path, trust_remote_code=True, token=HF_TOKEN)
os.chdir(cwd)
sys.path.pop(0)
return model
This solved the importing problem for me.
@mk-minchul @arnav-roy @jkfnc
Thank you @SARIHUST for the notice. I have changed the huggingface repo to fix the problem.