Download src/train/torchtask/utils/tool.py from Inmental/Env_mixer: direct link, hf CLI and curl.
- Browser
- Download file 394 Bytes
-
https://huggingface.co/spaces/Inmental/Env_mixer/resolve/main/src/train/torchtask/utils/tool.py
- Command line
-
hf download hf://spaces/Inmental/Env_mixer/src/train/torchtask/utils/tool.py
-
curl -L -o tool.py https://huggingface.co/spaces/Inmental/Env_mixer/resolve/main/src/train/torchtask/utils/tool.py
394 Bytes
| from . import logger | |
| def dict_value(dictionary, name, default=None, err=False): | |
| if dictionary is None: | |
| if err: | |
| logger.log_err('The given dictionary is None\n') | |
| else: | |
| return default | |
| if name in dictionary: | |
| return dictionary[name] | |
| elif err: | |
| logger.log_err('Cannot find key: {0}'.format(name)) | |
| else: | |
| return default | |