MCPcopy
hub / github.com/XPixelGroup/DiffBIR / load_model_from_url

Function load_model_from_url

diffbir/utils/common.py:113–120  ·  view source on GitHub ↗
(url: str)

Source from the content-addressed store, hash-verified

111
112
113def load_model_from_url(url: str) -> Dict[str, torch.Tensor]:
114 sd_path = load_file_from_url(url, model_dir="weights")
115 sd = torch.load(sd_path, map_location="cpu")
116 if "state_dict" in sd:
117 sd = sd["state_dict"]
118 if list(sd.keys())[0].startswith("module"):
119 sd = {k[len("module.") :]: v for k, v in sd.items()}
120 return sd
121
122
123def sliding_windows(

Callers 6

run_gradio.pyFile · 0.90
load_cleanerMethod · 0.85
load_cleanerMethod · 0.85
load_cleanerMethod · 0.85
load_cleanerMethod · 0.85
load_cldmMethod · 0.85

Calls 1

load_file_from_urlFunction · 0.85

Tested by

no test coverage detected