| 60 | print(f"Failed to download {url}. Status code: {res.status_code}") |
| 61 | |
| 62 | def 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 | |
| 78 | class Predictor(BasePredictor): |
| 79 | def setup(self) -> None: |