Esempio n. 1
0
# --- load data
# data_raw = json.load( open(f"../data/stats_raw_full.json", "r") )
data_raw = json.load(open(f"../data/{args.dataset}.json", "r"))

data, meta, meta_full = datalib.load_data(config.DATA_FILE, config.META_FILE)
config.init_dataset(meta_full)

label_id = meta_full['label']
label_type = meta_full['description'][label_id]['type']

print("config =", config)
print(
    f"Using dataset {meta_full['name']} with {meta_full['samples']} samples and {meta_full['classes']} classes."
)

data_trn, data_val, data_tst, shuffle_idx = datalib.split(
    data, config.DATASEED)

net = Net(meta)
env = SeqEnv(data_tst, meta)
agent = Agent(env, net, meta)

net.load(config.MODEL_FILE)

from pprint import pprint
# net.eval()
with torch.no_grad():
    step = 0
    tot_cst = 0
    all_samples = []
    step_dict = []
Esempio n. 2
0
if config.SEED:
    np.random.seed(config.SEED)
    random.seed(config.SEED)
    torch.manual_seed(config.SEED)
    torch.cuda.manual_seed(config.SEED)

# --- load data
data, meta, meta_full = datalib.load_data(config.DATA_FILE, config.META_FILE)
config.init_dataset(meta_full)

print("config =", config)
print(
    f"Using dataset {meta_full['name']} with {meta_full['samples']} samples and {meta_full['classes']} classes."
)

data_trn, data_val, data_tst = datalib.split(data, config.DATASEED)

net = Net(meta).to(config.DEVICE)
env = Env(data_trn, meta)
agent = Agent(env, net, meta)

log_trn = Log(data_trn, net, meta)
log_val = Log(data_val, net, meta)
log_tst = Log(data_tst, net, meta)

print(net)

fps = utils.Fps()
fps.start()