Outdated function get_models() used

#1
by druefena - opened

Hello,

I am trying to load this model, but run into an issue that is occuring here:
https://huggingface.co/minchul/cvlface_adaface_vit_base_kprpe_webface4m/blob/c8e9e0758a9e0d4ffdf6c8d925f9bd42b3676b6e/wrapper.py#L4

ImportError: This modeling file requires the following packages that were not found in your environment: models. Run pip install models

Namely, the models library is outdated and cannot be installed. Did you mean to use the get_models() function from the transformers library?

Can you please fix this so that the model can be properly loaded?

Thank you in advance!

same issue for me

same issue for me

It seems that the cvlface package has too many errors. The bigger problem is that there is no response or support available.

models is not a package to install, but a directory included in the code base.
It seems that the issue you are encountering with no module model error is due to trying to use the the Transformers AutoModel.from_pretrained() to load the model.
Our code does not support that. Instead we provide a manually downloading model code and model weights in the README file.
Try using model = load_model_by_repo_id(repo_id, path, HF_TOKEN) from the README file.

Change the code of load_model_from_local_path 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 issue for me.
@druefena @Jayakumark @christalsh @yubindongjin @minchul

Sign up or log in to comment