Esempio n. 1
0
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import redis

from dotenv import load_dotenv

from karrot.groups import themes
from config.options import get_options

load_dotenv()

options = get_options()

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Karrot constants

MODE = options['MODE']

if MODE not in ('dev', 'prod',):
    raise Exception('MODE must be one of dev|prod, not {}'.format(MODE))

is_dev = MODE == 'dev'

DEBUG = is_dev

# Generic
Esempio n. 2
0
def config():
    for key, value in get_options().items():
        print(key + '=' + (value if value else ''))
Esempio n. 3
0
import numpy as np
from config.options import get_options
from agent import Agent
from tqdm import trange
from model.config import build_conf

if __name__ == '__main__':
    args = get_options()
    epochs = args.epoch
    steps = args.step
    save_freq = args.save_frequency
    save_dir = args.full_saving_path
    batch_size = args.batch_size
    agent_conf = build_conf(args)
    agent_conf['memory']['capacity'] = 100000
    agent = Agent(agent_conf)
    epsilon = 1
    # We fill the memory in the while loop

    for w in trange(6, desc="Warmup"):
        agent.memory.reduce(100000)
        while not agent.memory.full_once:
            agent.run_episode(epsilon)
        for step in trange(600, desc="Step", leave=False):
            agent.training_step(1024)
        agent.validate()

    agent.memory.reduce(20000)
    while not agent.memory.full_once:
        agent.run_episode(epsilon)
    for epoch in trange(epochs, desc="Epoch"):