Download code_repair/codecontests/src/artifacts.py from Gen-Verse/RSI-Anything: direct link, hf CLI and curl.
- Browser
- Download file 648 Bytes
-
https://huggingface.co/datasets/Gen-Verse/RSI-Anything/resolve/main/code_repair/codecontests/src/artifacts.py
- Command line
-
hf download hf://datasets/Gen-Verse/RSI-Anything/code_repair/codecontests/src/artifacts.py
-
curl -L -o artifacts.py https://huggingface.co/datasets/Gen-Verse/RSI-Anything/resolve/main/code_repair/codecontests/src/artifacts.py
648 Bytes
| import hashlib,json | |
| from pathlib import Path | |
| def hash_object(value): | |
| return hashlib.sha256(json.dumps(value,sort_keys=True,ensure_ascii=False,separators=(',',':')).encode()).hexdigest() | |
| def checkpoint_manifest(path): | |
| path=Path(path).resolve() | |
| metadata=json.loads((path/'inference.json').read_text()) | |
| for name,expected in metadata['files'].items(): | |
| p=(path/name).resolve() | |
| if path not in p.parents or not p.is_file() or hashlib.sha256(p.read_bytes()).hexdigest()!=expected: | |
| raise RuntimeError('Model file checksum mismatch: '+name) | |
| return metadata,metadata.get('model_identity',hash_object(metadata)) | |