Download generator/image/fetch_mathlib.sh from desargues-hf/annals-math-rl-sample: direct link, hf CLI and curl.
- Browser
- Download file 972 Bytes
-
https://huggingface.co/datasets/desargues-hf/annals-math-rl-sample/resolve/main/generator/image/fetch_mathlib.sh
- Command line
-
hf download hf://datasets/desargues-hf/annals-math-rl-sample/generator/image/fetch_mathlib.sh
-
curl -L -o fetch_mathlib.sh https://huggingface.co/datasets/desargues-hf/annals-math-rl-sample/resolve/main/generator/image/fetch_mathlib.sh
972 Bytes
| # Unpack Mathlib's prebuilt cache in batches and truncate the files that importing Mathlib never | |
| # reads (generated C and .ilean editor indexes), keeping their .hash files so Lake still sees every | |
| # module as built. Lean + full Mathlib otherwise needs ~11 GB, more than a 10 GB sandbox disk. | |
| set -euo pipefail | |
| cd /opt/lean-env | |
| trim() { | |
| find .lake/packages -path '*/.lake/build/*' \( -name '*.c' -o -name '*.ilean' \) -size +0 -exec truncate -s 0 {} + | |
| } | |
| # Keep downloaded archives between categories. Mathlib's cache tool checks | |
| # archive presence, not installed oleans, when deciding whether to download. | |
| # Deleting them here would refetch each shared dependency for every category. | |
| for dir in .lake/packages/mathlib/Mathlib/*/; do | |
| name=$(basename "$dir") | |
| echo "== Mathlib/$name" | |
| lake exe cache get ".lake/packages/mathlib/Mathlib/$name" >/dev/null | |
| trim | |
| df -h / | tail -1 | |
| done | |
| lake exe cache get | |
| trim | |
| rm -rf "${HOME:-/root}/.cache/mathlib" | |