controlnet_aux
controlnet_aux copied to clipboard
huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name'
when I load local ckpt
from controlnet_aux import OpenposeDetector
model = OpenposeDetector.from_pretrained("./diffusers/ControlNet")
a error occurred :
Traceback (most recent call last):
File "test_controlnet.py", line 105, in <module>
model = OpenposeDetector.from_pretrained("./diffusers/ControlNet")
File "/opt/conda/lib/python3.8/site-packages/controlnet_aux/open_pose/__init__.py", line 36, in from_pretrained
body_model_path = hf_hub_download(pretrained_model_or_path, filename)
File "/opt/conda/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
validate_repo_id(arg_value)
File "/opt/conda/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 166, in validate_repo_id
raise HFValidationError(
huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': './diffusers/ControlNet'. Use `repo_type` argument if needed.
.from_pretrained downloads from hugginface hub.
try this
open_pose = OpenposeDetector.from_pretrained("lllyasviel/ControlNet")
but I want to use local ckpt, which I downloaded
Hey @onefish51,
If you want to load the model locally, you should just do:
from controlnet_aux import OpenposeDetector
from controlnet_aux.open_pose.body import Body
body_model = Body("./diffusers/ControlNet/annotator/ckpts/body_pose_model.pth")
detector = OpenposeDetector(body_model)
if repo_id.count("/") > 1:
raise HFValidationError(
"Repo id must be in the form 'repo_name' or 'namespace/repo_name':"
f" '{repo_id}'. Use `repo_type` argument if needed."
)
Hey @depyronick,
Could you maybe open a new issue with a reproducible error message?
Hey @depyronick,
Could you maybe open a new issue with a reproducible error message?
huggingface_hub
module raises an error if pretrained_model_or_path
has more than one /
in it. because of that we cannot use from_pretrained
methods for specifying local paths.
your previous example works, but it's the case for all other type of nets.
e.g. for scribble should also use (instead from_pretrained
):
network_model = Network('./controlnets/net/annotator/ckpts/network-bsds500.pth')
hed = HEDdetector(network_model)
image = hed(image, scribble=True)
i've no issue on this, just a reminder for future explorers.