2021-09-18 10:52:07 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p nix-prefetch-scripts
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
set -eou pipefail
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
version=$1
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
linux_cuda_version="cu121"
|
2022-09-09 14:08:57 +00:00
|
|
|
linux_bucket="https://download.pytorch.org/whl/${linux_cuda_version}"
|
2023-05-24 13:37:59 +00:00
|
|
|
darwin_bucket="https://download.pytorch.org/whl/cpu"
|
2021-09-18 10:52:07 +00:00
|
|
|
|
|
|
|
url_and_key_list=(
|
2022-09-09 14:08:57 +00:00
|
|
|
"x86_64-linux-38 $linux_bucket/torchvision-${version}%2B${linux_cuda_version}-cp38-cp38-linux_x86_64.whl torchvision-${version}-cp38-cp38-linux_x86_64.whl"
|
|
|
|
"x86_64-linux-39 $linux_bucket/torchvision-${version}%2B${linux_cuda_version}-cp39-cp39-linux_x86_64.whl torchvision-${version}-cp39-cp39-linux_x86_64.whl"
|
|
|
|
"x86_64-linux-310 $linux_bucket/torchvision-${version}%2B${linux_cuda_version}-cp310-cp310-linux_x86_64.whl torchvision-${version}-cp310-cp310-linux_x86_64.whl"
|
2023-05-24 13:37:59 +00:00
|
|
|
"x86_64-linux-311 $linux_bucket/torchvision-${version}%2B${linux_cuda_version}-cp311-cp311-linux_x86_64.whl torchvision-${version}-cp311-cp311-linux_x86_64.whl"
|
2024-01-02 11:29:13 +00:00
|
|
|
"x86_64-darwin-38 $darwin_bucket/torchvision-${version}-cp38-cp38-macosx_10_13_x86_64.whl torchvision-${version}-cp38-cp38-macosx_10_9_x86_64.whl"
|
|
|
|
"x86_64-darwin-39 $darwin_bucket/torchvision-${version}-cp39-cp39-macosx_10_13_x86_64.whl torchvision-${version}-cp39-cp39-macosx_10_9_x86_64.whl"
|
|
|
|
"x86_64-darwin-310 $darwin_bucket/torchvision-${version}-cp310-cp310-macosx_10_13_x86_64.whl torchvision-${version}-cp310-cp310-macosx_10_9_x86_64.whl"
|
|
|
|
"x86_64-darwin-311 $darwin_bucket/torchvision-${version}-cp311-cp311-macosx_10_13_x86_64.whl torchvision-${version}-cp311-cp311-macosx_10_9_x86_64.whl"
|
2023-05-24 13:37:59 +00:00
|
|
|
"aarch64-darwin-38 $darwin_bucket/torchvision-${version}-cp38-cp38-macosx_11_0_arm64.whl torchvision-${version}-cp38-cp38-macosx_11_0_arm64.whl"
|
|
|
|
"aarch64-darwin-39 $darwin_bucket/torchvision-${version}-cp39-cp39-macosx_11_0_arm64.whl torchvision-${version}-cp39-cp39-macosx_11_0_arm64.whl"
|
|
|
|
"aarch64-darwin-310 $darwin_bucket/torchvision-${version}-cp310-cp310-macosx_11_0_arm64.whl torchvision-${version}-cp310-cp310-macosx_11_0_arm64.whl"
|
|
|
|
"aarch64-darwin-311 $darwin_bucket/torchvision-${version}-cp311-cp311-macosx_11_0_arm64.whl torchvision-${version}-cp311-cp311-macosx_11_0_arm64.whl"
|
2021-09-18 10:52:07 +00:00
|
|
|
)
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
hashfile="binary-hashes-$version.nix"
|
2021-09-18 10:52:07 +00:00
|
|
|
echo " \"$version\" = {" >> $hashfile
|
|
|
|
|
|
|
|
for url_and_key in "${url_and_key_list[@]}"; do
|
|
|
|
key=$(echo "$url_and_key" | cut -d' ' -f1)
|
|
|
|
url=$(echo "$url_and_key" | cut -d' ' -f2)
|
|
|
|
name=$(echo "$url_and_key" | cut -d' ' -f3)
|
|
|
|
|
|
|
|
echo "prefetching ${url}..."
|
|
|
|
hash=$(nix hash to-sri --type sha256 `nix-prefetch-url "$url" --name "$name"`)
|
|
|
|
|
|
|
|
echo " $key = {" >> $hashfile
|
|
|
|
echo " name = \"$name\";" >> $hashfile
|
|
|
|
echo " url = \"$url\";" >> $hashfile
|
|
|
|
echo " hash = \"$hash\";" >> $hashfile
|
|
|
|
echo " };" >> $hashfile
|
|
|
|
|
|
|
|
echo
|
|
|
|
done
|
|
|
|
|
|
|
|
echo " };" >> $hashfile
|
|
|
|
echo "done."
|