Set 5, phase 1 (step 0): checkpoint verification, ADM FID-4K for SiT, JiT/encoder load checks, report
9d945e1 verified Download set5/code/s0_env.py from LamTNguyen/repa-representation-probing: direct link, hf CLI and curl.
- Browser
- Download file 1.56 kB
-
https://huggingface.co/datasets/LamTNguyen/repa-representation-probing/resolve/main/set5/code/s0_env.py
- Command line
-
hf download hf://datasets/LamTNguyen/repa-representation-probing/set5/code/s0_env.py
-
curl -L -o s0_env.py https://huggingface.co/datasets/LamTNguyen/repa-representation-probing/resolve/main/set5/code/s0_env.py
1.56 kB
| """Session start: report GPU and disk, install the few pip packages set 5 needs, check Drive and the HF secret. | |
| The HF token is read from Colab Secrets (HF_TOKEN) and only its presence is reported; it is exported to the | |
| process environment for huggingface_hub and never printed. | |
| """ | |
| import os | |
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).resolve().parent)) | |
| from common5 import OUT_DRIVE, OUT_LOCAL, disk_free_gb, drive_ok, env_report, log, write_json # noqa: E402 | |
| smi, df = env_report() | |
| print(smi) | |
| print(df) | |
| log(f"free disk on /content: {disk_free_gb():.0f} GB") | |
| need = ["torch-fidelity", "diffusers", "timm", "torchdiffeq"] | |
| subprocess.run([sys.executable, "-m", "pip", "install", "-q", *need], check=True) | |
| try: | |
| from google.colab import userdata | |
| tok = userdata.get("HF_TOKEN") | |
| os.environ["HF_TOKEN"] = tok | |
| hf = "present" | |
| except Exception as e: # secret missing or notebook access not granted | |
| hf = f"unavailable ({type(e).__name__})" | |
| log("HF_TOKEN:", hf) | |
| log("Drive mounted:", drive_ok(), "->", OUT_DRIVE if drive_ok() else OUT_LOCAL) | |
| import torch # noqa: E402 | |
| write_json(OUT_LOCAL / "step0" / "env.json", { | |
| "gpu": torch.cuda.get_device_name() if torch.cuda.is_available() else None, | |
| "gpu_mem_gb": round(torch.cuda.get_device_properties(0).total_memory / 1e9, 1) if torch.cuda.is_available() else None, | |
| "torch": torch.__version__, "python": sys.version.split()[0], "free_disk_gb": round(disk_free_gb()), | |
| "hf_token": hf, "drive": drive_ok(), "nvidia_smi": smi, "df": df}) | |