Instructions to use cszhilu1998/LiveWorld with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use cszhilu1998/LiveWorld with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("cszhilu1998/LiveWorld", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Download LiveWorld-Code/scripts/run_panodata_all.py from cszhilu1998/LiveWorld: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/cszhilu1998/LiveWorld/resolve/main/LiveWorld-Code/scripts/run_panodata_all.py
- Command line
-
hf download hf://cszhilu1998/LiveWorld/LiveWorld-Code/scripts/run_panodata_all.py
-
curl -L -o run_panodata_all.py https://huggingface.co/cszhilu1998/LiveWorld/resolve/main/LiveWorld-Code/scripts/run_panodata_all.py
1.54 kB
| """Resume the full PanoData test split on physical GPU 3; retain run status.""" | |
| from pathlib import Path | |
| import fcntl | |
| import json | |
| import os | |
| import subprocess | |
| import sys | |
| import time | |
| root=Path(__file__).resolve().parents[1] | |
| logs=root/'logs' | |
| lock=(logs/'panodata_all.lock').open('w') | |
| fcntl.flock(lock,fcntl.LOCK_EX|fcntl.LOCK_NB) | |
| status_path=logs/'panodata_all_status.json' | |
| metadata=Path('/home/zhangzhilu/shared/datasets/Pano-World/PanoData-v4/test.txt') | |
| count=sum(bool(line.strip()) for line in metadata.read_text().splitlines()) | |
| env=os.environ.copy() | |
| env['CUDA_VISIBLE_DEVICES']='3' | |
| env.setdefault('OMP_NUM_THREADS','8') | |
| env.setdefault('PYTORCH_CUDA_ALLOC_CONF','expandable_segments:True') | |
| command=[sys.executable,'-u','scripts/infer_panodata.py','--max_samples',str(count), | |
| '--perspective_num_frames','1','--num_frames','81','--skip_existing','--device','cuda:0'] | |
| def save(state,**extra): | |
| payload={'state':state,'gpu':3,'total_samples':count,'command':command, | |
| 'updated_at':time.strftime('%Y-%m-%d %H:%M:%S %z'),**extra} | |
| temporary=status_path.with_suffix('.tmp') | |
| temporary.write_text(json.dumps(payload,indent=2));temporary.replace(status_path) | |
| print(json.dumps(payload),flush=True) | |
| with (logs/'infer_panodata_all.log').open('ab',buffering=0) as log: | |
| child=subprocess.Popen(command,cwd=root,env=env,stdin=subprocess.DEVNULL, | |
| stdout=log,stderr=subprocess.STDOUT) | |
| save('running',pid=child.pid) | |
| code=child.wait() | |
| save('complete' if code==0 else 'failed',returncode=code) | |
| raise SystemExit(code) | |