Download scripts/build_native.py from ayjays132/PhillNet_Recall: direct link, hf CLI and curl.
- Browser
- Download file 735 Bytes
-
https://huggingface.co/ayjays132/PhillNet_Recall/resolve/main/scripts/build_native.py
- Command line
-
hf download hf://ayjays132/PhillNet_Recall/scripts/build_native.py
-
curl -L -o build_native.py https://huggingface.co/ayjays132/PhillNet_Recall/resolve/main/scripts/build_native.py
735 Bytes
| """Explicit local compilation; downloaded repositories never execute code on loading.""" | |
| from pathlib import Path | |
| import os,subprocess,sys,shutil | |
| root=Path(__file__).resolve().parents[1] | |
| compiler=os.environ.get('CC') or shutil.which('cc') or shutil.which('gcc') | |
| if not compiler:raise SystemExit('No C compiler found. The Python reference remains usable.') | |
| out=root/'phillnet_recall/native';out.mkdir(exist_ok=True) | |
| name='ugr.dll' if os.name=='nt' else 'libugr.dylib' if sys.platform=='darwin' else 'libugr.so' | |
| flags=['-std=c99','-O3','-ffp-contract=off','-fno-fast-math','-shared'] | |
| if os.name!='nt':flags+=['-fPIC'] | |
| cmd=[compiler,*flags,str(root/'native/ugr.c'),'-o',str(out/name),'-lm'] | |
| subprocess.run(cmd,check=True) | |
| print(out/name) | |