Download verify_release.py from owensong/Inflect-Mini-v3: direct link, hf CLI and curl.
- Browser
- Download file 1.62 kB
-
https://huggingface.co/owensong/Inflect-Mini-v3/resolve/main/verify_release.py
- Command line
-
hf download hf://owensong/Inflect-Mini-v3/verify_release.py
-
curl -L -o verify_release.py https://huggingface.co/owensong/Inflect-Mini-v3/resolve/main/verify_release.py
1.62 kB
| """Verify an Inflect early-access download without importing model dependencies.""" | |
| import argparse | |
| import hashlib | |
| import json | |
| from pathlib import Path | |
| def verify(root): | |
| root = root.resolve() | |
| manifest = json.loads((root / 'release-manifest.json').read_text(encoding='utf-8')) | |
| if manifest.get('schema') != 'inflect-v3-early-access-package-v1': | |
| raise ValueError('Unrecognized release inventory') | |
| entries = manifest.get('files') | |
| if not isinstance(entries, dict) or not entries: | |
| raise ValueError('Empty release inventory') | |
| for name, expected in entries.items(): | |
| relative = Path(name) | |
| path = root / relative | |
| if relative.is_absolute() or '..' in relative.parts or path.is_symlink(): | |
| raise ValueError('Unsafe inventory path: ' + name) | |
| if not path.is_file() or not path.resolve().is_relative_to(root): | |
| raise ValueError('Missing file: ' + name) | |
| if path.stat().st_size != expected['bytes']: | |
| raise ValueError('Unexpected file size: ' + name) | |
| with path.open('rb') as stream: | |
| digest = hashlib.file_digest(stream, 'sha256').hexdigest() | |
| if digest != expected['sha256']: | |
| raise ValueError('File checksum mismatch: ' + name) | |
| return dict(verified=True, model=manifest['model'], checked_files=len(entries)) | |
| def main(): | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument('--root', type=Path, default=Path(__file__).resolve().parent) | |
| args = parser.parse_args() | |
| print(json.dumps(verify(args.root))) | |
| if __name__ == '__main__': | |
| main() | |