Download config.py from klayassist/checker: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/klayassist/checker/resolve/main/config.py
- Command line
-
hf download hf://klayassist/checker/config.py
-
curl -L -o config.py https://huggingface.co/klayassist/checker/resolve/main/config.py
1.15 kB
| from dotenv import load_dotenv | |
| import os | |
| load_dotenv("/notebooks/models/checker/.env", override=True) | |
| def getEnv(key: str) -> str: | |
| val = os.getenv(key) | |
| if val is None: | |
| raise Exception(f"{key} is not set") | |
| return val | |
| ROOT_DIR = getEnv("ROOT_DIR") | |
| def p(*path: str) -> str: | |
| return os.path.join(ROOT_DIR, *path) | |
| DS_DIR = getEnv("DS_DIR") | |
| import torch | |
| DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu") | |
| import random | |
| import numpy as np | |
| SEED = getEnv("SEED") | |
| def seed(): | |
| int_SEED = int(SEED) | |
| os.environ['PYTHONHASHSEED'] = SEED | |
| random.seed(int_SEED) | |
| np.random.seed(int_SEED) | |
| torch.manual_seed(int_SEED) | |
| import json | |
| def ActionDict(): | |
| with open(os.path.join(DS_DIR, "actions.json")) as f: | |
| action_dict = json.loads(f.read()) | |
| for action in action_dict: | |
| action_description = action_dict[action]["description"] | |
| action_description = f"{action_description}" # interpret escape characters | |
| action_dump = json.dumps({"name": action, "description": action_description}) | |
| action_dict[action] = action_dump | |
| return action_dict | |
| action_dict = ActionDict() | |
| num_actions = len(action_dict) | |