Download code/scripts/backfill_hubstats.py from MiniMaxAI/oss-ecosystem-data: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/datasets/MiniMaxAI/oss-ecosystem-data/resolve/6b66b5dfbd2511971fdd508836367eccaa30b162/code/scripts/backfill_hubstats.py
- Command line
-
hf download hf://datasets/MiniMaxAI/oss-ecosystem-data@6b66b5dfbd2511971fdd508836367eccaa30b162/code/scripts/backfill_hubstats.py
-
curl -L -o backfill_hubstats.py https://huggingface.co/datasets/MiniMaxAI/oss-ecosystem-data/resolve/6b66b5dfbd2511971fdd508836367eccaa30b162/code/scripts/backfill_hubstats.py
1.01 kB
| """Fill raw/hubstats/ (past downloads from cfahlgren1/hub-stats) by hand. | |
| python scripts/backfill_hubstats.py [--every 7] [--since 2025-01-01] [--push] | |
| The daily job does this by itself when the folder is empty in the dataset (see | |
| hfeco/hubstats.py); this is for refilling it by hand, e.g. with a different step. | |
| """ | |
| import argparse | |
| import sys | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parent.parent | |
| sys.path.insert(0, str(ROOT)) | |
| from hfeco import hubstats, org, store # noqa: E402 | |
| def main(): | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("--every", type=int, default=7) | |
| ap.add_argument("--since", default="2025-01-01") | |
| ap.add_argument("--push", action="store_true", help="upload what was written to the dataset") | |
| a = ap.parse_args() | |
| paths = hubstats.backfill(org.history_ids(org.public_models()), a.every, a.since) | |
| if a.push and paths: | |
| store.push(paths, "hub-stats downloads history") | |
| print("pushed") | |
| if __name__ == "__main__": | |
| main() | |