Download utils/util_opts.py from airdm/InvSR: direct link, hf CLI and curl.
- Browser
- Download file 623 Bytes
-
https://huggingface.co/spaces/airdm/InvSR/resolve/main/utils/util_opts.py
- Command line
-
hf download hf://spaces/airdm/InvSR/utils/util_opts.py
-
curl -L -o util_opts.py https://huggingface.co/spaces/airdm/InvSR/resolve/main/utils/util_opts.py
623 Bytes
| #!/usr/bin/env python | |
| # -*- coding:utf-8 -*- | |
| # Power by Zongsheng Yue 2021-11-24 15:07:43 | |
| import argparse | |
| def update_args(args_json, args_parser): | |
| for arg in vars(args_parser): | |
| args_json[arg] = getattr(args_parser, arg) | |
| def str2bool(v): | |
| """ | |
| https://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse | |
| """ | |
| if isinstance(v, bool): | |
| return v | |
| if v.lower() in ("yes", "true", "t", "y", "1"): | |
| return True | |
| elif v.lower() in ("no", "false", "f", "n", "0"): | |
| return False | |
| else: | |
| raise argparse.ArgumentTypeError("boolean value expected") | |