"vscode:/vscode.git/clone" did not exist on "aec0e8c9289920e4971fb0b4bbe5b5942a7103f4"
Unverified Commit dfdf85d3 authored by Hengwen Tong's avatar Hengwen Tong Committed by GitHub
Browse files

[pipeline utils] sanitize pretrained_model_name_or_path (#5173)



Make sure the repo_id is valid before sending it to huggingface_hub to get a more understandable error message.

Re #5110
Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
parent 539846a7
......@@ -1033,6 +1033,10 @@ class DiffusionPipeline(ConfigMixin, PushToHubMixin):
# 1. Download the checkpoints and configs
# use snapshot download here to get it working from from_pretrained
if not os.path.isdir(pretrained_model_name_or_path):
if pretrained_model_name_or_path.count("/") > 1:
raise ValueError(
f"The provided pretrained_model_name_or_path \"{pretrained_model_name_or_path}\""
" is neither a valid local path nor a valid repo id. Please check the parameter.")
cached_folder = cls.download(
pretrained_model_name_or_path,
cache_dir=cache_dir,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment