Open 7231 opened 1 year ago
I think on new version (0.0.6
) they have changed pth file.
(network-bsds500.pth
is gone now ...)
try this,
from controlnet_aux import HEDdetector
from controlnet_aux.hed import ControlNetHED_Apache2
# download the new file via .from_pretrained()
# this will download the file on huggingface cache dir
# usually ${HOME}/.cache/huggingface/hub/models--lllyasviel--Annotators
hed = HEDdetector.from_pretrained(model_repo)
model_dir = "...." # <-- find 'ControlNetHED.pth' file's directory from the cache dir
model_path = os.path.join(model_dir, "ControlNetHED.pth")
network = ControlNetHED_Apache2()
network.load_state_dict(torch.load(model_path, map_location="cpu"))
network.float().eval()
hed_detector = HEDdetector(network)
When I run:
I got this error:
ImportError: cannot import name 'Network' from 'controlnet_aux.hed'
(I find init.py of "hed" folder has no 'Network' class or function.