Download scripts/inference.py from OneScience-Group/NNCAM-Stable: direct link, hf CLI and curl.
- Browser
- Download file 470 Bytes
-
https://huggingface.co/OneScience-Group/NNCAM-Stable/resolve/main/scripts/inference.py
- Command line
-
hf download hf://OneScience-Group/NNCAM-Stable/scripts/inference.py
-
curl -L -o inference.py https://huggingface.co/OneScience-Group/NNCAM-Stable/resolve/main/scripts/inference.py
470 Bytes
| from pathlib import Path | |
| import sys,numpy as np,torch;R=Path(__file__).resolve().parents[1];sys.path.insert(0,str(R));from model.nncam_stable import * | |
| c=cfg(R);d=np.load(R/c['data']['path']);z=torch.load(R/c['paths']['checkpoint'],weights_only=True);m=NNCAM(**z['model_config']);m.load_state_dict(z['model']);p=R/c['paths']['predictions'];p.parent.mkdir(parents=True,exist_ok=True);np.savez(p,prediction=m(torch.tensor(d['input'])).detach(),target=d['target']);print(p) | |