Can not find adapter_config.json using PeftConfig.from_pretrained

I have a huggingface spaces streamlit file
https://huggingface.co/spaces/foobar8675/bloom-7b1-lora-tagger/blob/main/app.py
which is throwing an error

ValueError: Can't find 'adapter_config.json' at 'foobar8675/bloom-7b1-lora-tagger'
Traceback:
File "/home/user/.local/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
File "/home/user/app/app.py", line 23, in <module>
    config = PeftConfig.from_pretrained(peft_model_id)
File "/home/user/.local/lib/python3.10/site-packages/peft/utils/config.py", line 108, in from_pretrained
    raise ValueError(f"Can't find '{CONFIG_NAME}' at '{pretrained_model_name_or_pa

on this line

peft_model_id = "foobar8675/bloom-7b1-lora-tagger"
config = PeftConfig.from_pretrained(peft_model_id)

the model at foobar8675/bloom-7b1-lora-tagger is public and I verified the adapter_config.json is on the model. iā€™m quite confused as to why this is happening and any help is appreciated.

1 Like

Hi, I have the same problem with the model bofenghuang/vigogne-chat-7b. While exporting it, it throws an ValueError: Canā€™t find ā€˜adapter_config.jsonā€™ even if the file exists.

i have the same issue for inference.
ValueError: Canā€™t find ā€˜adapter_config.jsonā€™ at ā€˜kirilzilla/alpaca-SGDā€™

i have the same problem using the file ā€œgenerate.pyā€ of alpaca-lora repository (GitHub) which calls a file in Peft repository.

I have the same issue as well. Can any one help?

Hey all,

For me the issue was authentication. Running through the stacktrace, if you see something like ā€œInvalid username and passwordā€ just after a link to the adapter_config.json file, itā€™s likely you have the same issue too.

To fix, youā€™ll need to login to the hub, which can be done programatically using the following snippet:

from huggingface_hub import login
import os

access_token = os.environ["HUGGING_FACE_HUB_TOKEN"]
login(token=access_token)

Hope this helps!

1 Like

use this

model.config.to_json_file(ā€œadapter_config.jsonā€)

then
model.push_to_hub(ā€œmodel nameā€)

2 Likes