Download code/ref15_fullft/preflight.py from laion/Humaneness-Voice-Small: direct link, hf CLI and curl.
- Browser
- Download file 2.19 kB
-
https://huggingface.co/laion/Humaneness-Voice-Small/resolve/main/code/ref15_fullft/preflight.py
- Command line
-
hf download hf://laion/Humaneness-Voice-Small/code/ref15_fullft/preflight.py
-
curl -L -o preflight.py https://huggingface.co/laion/Humaneness-Voice-Small/resolve/main/code/ref15_fullft/preflight.py
2.19 kB
| #!/usr/bin/env python3 | |
| """Require a successful full-parameter GPU canary and immutable S3 inputs.""" | |
| from __future__ import annotations | |
| import json | |
| import math | |
| from pathlib import Path | |
| import sys | |
| HERE = Path(__file__).resolve().parent | |
| HOME = HERE.parent | |
| sys.path.insert(0, str(HOME / 'hvs_ref_only_r128_v1')) | |
| from build_worklist import sha | |
| from text_resolution import RESOLUTION_MANIFEST | |
| SC = Path('/e/scratch/reformo/schuhmann1_moss') | |
| WORKLIST = SC / 'out/hvs_ref_only_r128_v1/worklist/MANIFEST.json' | |
| SMOKE = SC / 'out/hvs_ref_full_ft_v1/smoke_4gpu' | |
| def main(): | |
| source = json.loads(WORKLIST.read_text()) | |
| resolution = json.loads(RESOLUTION_MANIFEST.read_text()) | |
| assert source['status'] == 'COMPLETE' and source['eligible_unique_targets'] == 3_707_948 | |
| assert resolution['status'] == 'PASS' and resolution['source_worklist_sha256'] == sha(WORKLIST) | |
| scores = [json.loads(line) for line in (SMOKE / 'metrics.jsonl').read_text().splitlines()] | |
| trains = [row for row in scores if row.get('kind') == 'train'] | |
| validations = [row for row in scores if row.get('kind') == 'validation'] | |
| assert [row['step'] for row in trains[-2:]] == [1, 2] | |
| assert [row['step'] for row in validations[-3:]] == [0, 1, 2] | |
| assert all(math.isfinite(row['grad_norm']) and row['grad_norm'] > 0 for row in trains[-2:]) | |
| assert all(math.isfinite(row['nll_per_frame']) for row in validations[-3:]) | |
| assert all(row['reference_longer_than_2_96s'] > 0 for row in trains[-2:]) | |
| assert all(row['peak_allocated_gib'] < 90 for row in trains[-2:]) | |
| latest = json.loads((SMOKE / 'checkpoints/current.json').read_text()) | |
| assert latest['step'] == 2 | |
| complete = json.loads((SMOKE / 'checkpoints' / latest['directory'] / 'COMPLETE.json').read_text()) | |
| assert complete['step'] == 2 and complete['state_bytes'] > 1_000_000_000 | |
| print(json.dumps({'status': 'PASS', 'steps': 2, 'peak_gib': max(row['peak_allocated_gib'] for row in trains), | |
| 'validation_step2': validations[-1]['nll_per_frame'], | |
| 'worklist_sha256': sha(WORKLIST), 'resolution_sha256': sha(RESOLUTION_MANIFEST)}), flush=True) | |
| if __name__ == '__main__': | |
| main() | |