Due to network issues, I hope to be able to increase the use of proxies when downloading models, so that downloading models with diffusers and downloading preprocessors with controlnet_aux can go through the same proxy. For example, using a method similar "to _get_model_file()" in Diffusers where more parameters can be passed to "hf_hub_download()" when "from_pretrained()" needs to download in the preprocessor, or just add parameters for using "proxies" is more simple.
Such like:
(controlnet_aux/midas/init.py)
def from_pretrained(cls, pretrained_model_or_path, model_type="dpt_hybrid", filename=None, cache_dir=None, proxies=None):
if pretrained_model_or_path == "lllyasviel/ControlNet":
filename = filename or "annotator/ckpts/dpt_hybrid-midas-501f0c75.pt"
else:
filename = filename or "dpt_hybrid-midas-501f0c75.pt"
if os.path.isdir(pretrained_model_or_path):
model_path = os.path.join(pretrained_model_or_path, filename)
else:
model_path = hf_hub_download(pretrained_model_or_path, filename, cache_dir=cache_dir, proxies=proxies)
model = MiDaSInference(model_type=model_type, model_path=model_path)
return cls(model)
Due to network issues, I hope to be able to increase the use of proxies when downloading models, so that downloading models with diffusers and downloading preprocessors with controlnet_aux can go through the same proxy. For example, using a method similar "to _get_model_file()" in Diffusers where more parameters can be passed to "hf_hub_download()" when "from_pretrained()" needs to download in the preprocessor, or just add parameters for using "proxies" is more simple.
Such like: (controlnet_aux/midas/init.py)
I am willing to open a PR.