In recipes/../dpo/config_full.yaml, use a local directory for the model, eg: path/to/model
It will throw an error:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_errors.py", line 261, in hf_raise_for_status
response.raise_for_status()
File "/usr/local/lib/python3.10/dist-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/api/models/data/zephyr-1b-sft-full/tree/main?recursive=True&expand=False
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/alignment-handbook/scripts/run_dpo.py", line 220, in <module>
main()
File "/alignment-handbook/scripts/run_dpo.py", line 121, in main
if is_adapter_model(model, model_args.model_revision):
File "/alignment-handbook/src/alignment/model_utils.py", line 102, in is_adapter_model
repo_files = list_repo_files(model_name_or_path, revision=revision)
File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_deprecation.py", line 101, in inner_f
return f(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/hf_api.py", line 2213, in list_repo_files
return [
File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/hf_api.py", line 2213, in <listcomp>
return [
File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/hf_api.py", line 2179, in list_files_info
for subpath_info in paginate(path=tree_url, headers=headers, params={"recursive": True, "expand": expand}):
File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_pagination.py", line 36, in paginate
hf_raise_for_status(r)
File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_errors.py", line 293, in hf_raise_for_status
raise RepositoryNotFoundError(message, response) from e
huggingface_hub.utils._errors.RepositoryNotFoundError: 404 Client Error. (Request ID: Root=1-659ea868-2ceb4a3e51084810535b1d81;2c59fce0-fb33-4d89-ac5e-93006069031d)
Repository Not Found for url: https://huggingface.co/api/models/data/zephyr-1b-sft-full/tree/main?recursive=True&expand=False.
Please make sure you specified the correct `repo_id` and `repo_type`.
If you are trying to access a private or gated repo, make sure you are authenticated.
def is_adapter_model(model_name_or_path: str, revision: str = "main") -> bool:
try:
# Try first if model on a Hub repo
repo_files = list_repo_files(model_name_or_path, revision=revision)
except HFValidationError:
# If not, check local repo
repo_files = os.listdir(model_name_or_path)
return "adapter_model.safetensors" in repo_files or "adapter_model.bin" in repo_files
Steps to repro:
path/to/model
It will throw an error:
It looks like the problem is this code in model_utils.py
Is not catching
RepositoryNotFoundError