Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from cerberus import Validator
ENV_CHOICES = ("aws", "desktop", "laptop")
CONFIG_SCHEMA = {
"runtime": {
"type": "dict",
"schema": {"cuda": {"type": "boolean", "required": True, "nullable": False},},
},
"logging": {
"type": "dict",
"schema": {
"wandb": {
"type": "dict",
"schema": {
"run_name": {"type": "string", "required": True, "nullable": True},
"project_name": {
"type": "string",
"required": True,
"nullable": True,
},
},
},
"checkpoint": {
"type": "dict",
"schema": {
"save_name": {"type": "string", "required": True, "nullable": True},
"save_epochs": {
"type": "integer",
"required": True,
"nullable": True,
},
},
},
},
},
"training": {
"type": "dict",
"schema": {
"epochs": {"type": "integer", "required": True, "nullable": False},
"batch_size": {"type": "integer", "required": True, "nullable": False},
"subsample": {"type": "integer", "required": True, "nullable": True},
},
},
}
validator = Validator(CONFIG_SCHEMA)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment