File size: 793 Bytes
21d44eb | 1 2 3 4 5 6 7 8 9 10 11 | """Restore the HF-backed environment archive only into disposable storage."""
import json,os,pathlib
os.environ['HF_HUB_DISABLE_XET']='1'
from huggingface_hub import hf_hub_download
root=pathlib.Path(__file__).resolve().parents[1];local=root/'.release_local'
config=json.loads((local/'hf-backup.json').read_text());token=pathlib.Path(config['token_file']).read_text().strip()
revision=json.loads((local/'hf-runtime-backup-status.json').read_text())['commit_oid']
for name in ('runtime-env.tar.gz','runtime-archive.json'):
path=hf_hub_download(repo_id=config['repo_id'],repo_type='model',filename='environment/'+name,revision=revision,token=token,local_dir='/tmp/robottt-runtime-download',cache_dir='/tmp/robottt-hf-download-cache')
print('Restored archive component:',name,flush=True)
|