Spaces:
Runtime error
Runtime error
Download ScanSSD/utils/helpers.py from duycse1603/math2tex: direct link, hf CLI and curl.
- Browser
- Download file 288 Bytes
-
https://huggingface.co/spaces/duycse1603/math2tex/resolve/main/ScanSSD/utils/helpers.py
- Command line
-
hf download hf://spaces/duycse1603/math2tex/ScanSSD/utils/helpers.py
-
curl -L -o helpers.py https://huggingface.co/spaces/duycse1603/math2tex/resolve/main/ScanSSD/utils/helpers.py
288 Bytes
| import os | |
| import numpy as np | |
| def get_freer_gpu(): | |
| ''' | |
| Find which gpu is free | |
| ''' | |
| os.system('nvidia-smi -q -d Memory |grep -A4 GPU|grep Free >tmp') | |
| memory_available = [int(x.split()[2]) for x in open('tmp', 'r').readlines()] | |
| return int(np.argmax(memory_available)) |