Spaces:
Configuration error
Configuration error
Download utils/system_utils.py from karthikkrazy/PEAR: direct link, hf CLI and curl.
- Browser
- Download file 499 Bytes
-
https://huggingface.co/spaces/karthikkrazy/PEAR/resolve/main/utils/system_utils.py
- Command line
-
hf download hf://spaces/karthikkrazy/PEAR/utils/system_utils.py
-
curl -L -o system_utils.py https://huggingface.co/spaces/karthikkrazy/PEAR/resolve/main/utils/system_utils.py
499 Bytes
| from errno import EEXIST | |
| from os import makedirs, path | |
| import os | |
| def mkdir_p(folder_path): | |
| # Creates a directory. equivalent to using mkdir -p on the command line | |
| try: | |
| makedirs(folder_path) | |
| except OSError as exc: # Python >2.5 | |
| if exc.errno == EEXIST and path.isdir(folder_path): | |
| pass | |
| else: | |
| raise | |
| def searchForMaxIteration(folder): | |
| saved_iters = [int(fname.split("_")[-1]) for fname in os.listdir(folder)] | |
| return max(saved_iters) | |