Download fetch_sources.py from SabaPivot/repro-differentiable-conformal-training-for-llm-reasoning-factuality: direct link, hf CLI and curl.
- Browser
- Download file 940 Bytes
-
https://huggingface.co/spaces/SabaPivot/repro-differentiable-conformal-training-for-llm-reasoning-factuality/resolve/main/fetch_sources.py
- Command line
-
hf download hf://spaces/SabaPivot/repro-differentiable-conformal-training-for-llm-reasoning-factuality/fetch_sources.py
-
curl -L -o fetch_sources.py https://huggingface.co/spaces/SabaPivot/repro-differentiable-conformal-training-for-llm-reasoning-factuality/resolve/main/fetch_sources.py
940 Bytes
| #!/usr/bin/env python3 | |
| from __future__ import annotations | |
| import hashlib,json,subprocess,tarfile | |
| from pathlib import Path | |
| R=Path(__file__).resolve().parent;S=R/'source';E=R/'source_extract';V='2604.20098v1' | |
| def sha(p):return hashlib.sha256(p.read_bytes()).hexdigest() | |
| def main(): | |
| S.mkdir(parents=True,exist_ok=True);E.mkdir(parents=True,exist_ok=True);pdf=S/f'{V}.pdf';arc=S/f'{V}.tar' | |
| subprocess.run(['curl','-fsSL','--retry','3',f'https://arxiv.org/pdf/{V}','-o',str(pdf)],check=True);subprocess.run(['curl','-fsSL','--retry','3',f'https://arxiv.org/e-print/{V}','-o',str(arc)],check=True) | |
| with tarfile.open(arc,'r:*') as h: | |
| for m in h.getmembers(): | |
| d=(E/m.name).resolve() | |
| if E.resolve() not in d.parents and d!=E.resolve():raise ValueError(m.name) | |
| h.extractall(E,filter='data') | |
| print(json.dumps({'paper_id':'XfndtVLIub','arxiv_id':V,'pdf_sha256':sha(pdf),'source_sha256':sha(arc)},indent=2)) | |
| if __name__=='__main__':main() | |