from config import setSeed, getConfig import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter from main.encoder import PixelEncoder from main.model import CURL from IPython import embed setSeed(2) assert len(sys.argv) == 2, "Indicate a configuration file like 'config_0.0'" conf = getConfig(sys.argv[1]) MINERL_GYM_ENV = os.getenv('MINERL_GYM_ENV', 'MineRLNavigate-v0') # MINERL_GYM_ENV = os.getenv('MINERL_GYM_ENV', 'MineRLTreechop-v0') MINERL_DATA_ROOT = os.getenv( 'MINERL_DATA_ROOT', '/home/usuaris/imatge/juan.jose.nieto/mineRL/data/') data = minerl.data.make(MINERL_GYM_ENV, data_dir=MINERL_DATA_ROOT, num_workers=1) feature_dim = conf['curl']['embedding_dim'] img_size = conf['curl']['img_size'] obs_shape = (3, img_size, img_size) batch_size = conf['batch_size']
from customLoader import MinecraftData from pprint import pprint from os.path import join from pathlib import Path from scipy.signal import savgol_filter from torchvision.utils import make_grid from torchvision.transforms import transforms from torch.utils.tensorboard import SummaryWriter from torch.utils.data import DataLoader from IPython import embed setSeed(0) assert len(sys.argv) == 2, "Indicate a configuration file like 'config_0.0'" conf = getConfig(sys.argv[1]) transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.5,0.5,0.5), (1.0,1.0,1.0)) ]) mrl_val = MinecraftData(conf['environment'], 'val', conf['split'], False, transform=transform) validation_loader = DataLoader(mrl_val, batch_size=16, shuffle=True) device = torch.device("cuda" if torch.cuda.is_available() else "cpu")