MCPcopy Create free account
hub / github.com/cpystan/SD-VLM / download_weights

Function download_weights

predict.py:62–76  ·  view source on GitHub ↗
(baseurl: str, basedest: str, files: list[str])

Source from the content-addressed store, hash-verified

60 print(f"Failed to download {url}. Status code: {res.status_code}")
61
62def download_weights(baseurl: str, basedest: str, files: list[str]):
63 basedest = Path(basedest)
64 start = time.time()
65 print("downloading to: ", basedest)
66 basedest.mkdir(parents=True, exist_ok=True)
67 for f in files:
68 dest = basedest / f
69 url = os.path.join(REPLICATE_WEIGHTS_URL, baseurl, f)
70 if not dest.exists():
71 print("downloading url: ", url)
72 if dest.suffix == ".json":
73 download_json(url, dest)
74 else:
75 subprocess.check_call(["pget", url, str(dest)], close_fds=False)
76 print("downloading took: ", time.time() - start)
77
78class Predictor(BasePredictor):
79 def setup(self) -> None:

Callers 1

setupMethod · 0.85

Calls 1

download_jsonFunction · 0.85

Tested by

no test coverage detected