├── .gitignore
├── agent
├── Infer
│ ├── __pycache__
│ │ ├── repre_infer_hiprssm.cpython-37.pyc
│ │ ├── repre_infer_mts3.cpython-37.pyc
│ │ ├── repre_infer_mts3Simple.cpython-37.pyc
│ │ └── repre_infer_rnn.cpython-37.pyc
│ ├── repre_infer_acrkn.py
│ ├── repre_infer_hiprssm.py
│ ├── repre_infer_mts3.py
│ ├── repre_infer_mts3Simple.py
│ └── repre_infer_rnn.py
├── Learn
│ ├── __pycache__
│ │ ├── repre_learn_hiprssm.cpython-37.pyc
│ │ ├── repre_learn_mts3.cpython-37.pyc
│ │ ├── repre_learn_mts3Simple.cpython-37.pyc
│ │ └── repre_learn_rnn.cpython-37.pyc
│ ├── repre_learn_acrkn.py
│ ├── repre_learn_hiprssm.py
│ ├── repre_learn_mts3.py
│ ├── repre_learn_mts3Simple.py
│ └── repre_learn_rnn.py
└── worldModels
│ ├── Decoders
│ ├── __pycache__
│ │ └── propDecoder.cpython-37.pyc
│ └── propDecoder.py
│ ├── MTS3.py
│ ├── MTS3Simple.py
│ ├── RKN.py
│ ├── RNN.py
│ ├── SensorEncoders
│ ├── __pycache__
│ │ └── propEncoder.cpython-37.pyc
│ └── propEncoder.py
│ ├── __pycache__
│ ├── MTS3.cpython-37.pyc
│ ├── MTS3Simple.cpython-37.pyc
│ ├── MTS3_fast.cpython-37.pyc
│ ├── MTS3_v2.cpython-37.pyc
│ ├── RNN.cpython-37.pyc
│ ├── acRKN.cpython-37.pyc
│ └── hipRSSM.cpython-37.pyc
│ ├── acRKN.py
│ ├── gaussianTransformations
│ ├── __pycache__
│ │ ├── gaussian_conditioning.cpython-37.pyc
│ │ └── gaussian_marginalization.cpython-37.pyc
│ ├── gaussian_conditioning.py
│ └── gaussian_marginalization.py
│ ├── hipRSSM.py
│ └── readme.md
├── dataFolder
├── __pycache__
│ ├── cheetahData.cpython-37.pyc
│ ├── dataDpssm.cpython-37.pyc
│ ├── dataDpssmVar.cpython-37.pyc
│ ├── excavatorData.cpython-37.pyc
│ ├── excavatorDataVar.cpython-37.pyc
│ ├── fkDataDpssm.cpython-37.pyc
│ ├── mazeData.cpython-37.pyc
│ ├── mazeDataDpssm.cpython-37.pyc
│ ├── mobileData.cpython-37.pyc
│ └── mobileDataDpssm_v1.cpython-37.pyc
└── mts3_datasets_processed
│ └── readme.md
├── experiments
├── __pycache__
│ ├── exp_prediction_acrkn.cpython-37.pyc
│ ├── exp_prediction_hiprssm.cpython-37.pyc
│ ├── exp_prediction_mts3.cpython-37.pyc
│ ├── exp_prediction_mts3_v2.cpython-37.pyc
│ ├── exp_prediction_rnn.cpython-37.pyc
│ └── exp_simple_prediction_mts3.cpython-37.pyc
├── exp_prediction_acrkn.py
├── exp_prediction_hiprssm.py
├── exp_prediction_mts3.py
├── exp_prediction_rnn.py
├── exp_simple_prediction_mts3.py
├── frankaKitchen
│ ├── acrkn_exp.py
│ ├── bash_scripts
│ │ ├── test.sh
│ │ └── test_rkn.sh
│ ├── conf
│ │ ├── config.yaml
│ │ ├── model
│ │ │ ├── data
│ │ │ │ ├── data_complete.yaml
│ │ │ │ ├── test
│ │ │ │ │ ├── data_complete.yaml
│ │ │ │ │ ├── data_complete_1.yaml
│ │ │ │ │ ├── data_complete_10.yaml
│ │ │ │ │ ├── data_complete_2.yaml
│ │ │ │ │ ├── data_complete_3.yaml
│ │ │ │ │ ├── data_complete_30.yaml
│ │ │ │ │ └── data_complete_5.yaml
│ │ │ │ └── train
│ │ │ │ │ ├── data_complete.yaml
│ │ │ │ │ ├── data_complete_1.yaml
│ │ │ │ │ ├── data_complete_10.yaml
│ │ │ │ │ ├── data_complete_2.yaml
│ │ │ │ │ ├── data_complete_3.yaml
│ │ │ │ │ ├── data_complete_30.yaml
│ │ │ │ │ └── data_complete_5.yaml
│ │ │ ├── default_acrkn.yaml
│ │ │ ├── default_gru.yaml
│ │ │ ├── default_hiprssm.yaml
│ │ │ ├── default_lstm.yaml
│ │ │ ├── default_mts3.yaml
│ │ │ └── learn
│ │ │ │ ├── default.yaml
│ │ │ │ └── default_rnn.yaml
│ │ └── platform
│ │ │ ├── horeka.yaml
│ │ │ └── local.yaml
│ ├── hiprssm_exp.py
│ ├── mts3_exp.py
│ └── rnn_exp.py
├── halfCheetah
│ ├── acrkn_exp.py
│ ├── bash_scripts
│ │ ├── test.sh
│ │ └── test_rkn.sh
│ ├── conf
│ │ ├── config.yaml
│ │ ├── model
│ │ │ ├── data
│ │ │ │ ├── data_d4rl.yaml
│ │ │ │ ├── test
│ │ │ │ │ ├── data1_1.yaml
│ │ │ │ │ ├── data1_1_hip.yaml
│ │ │ │ │ ├── data240.yaml
│ │ │ │ │ ├── data2_1.yaml
│ │ │ │ │ ├── data2_1_hip.yaml
│ │ │ │ │ ├── data31_30_12.yaml
│ │ │ │ │ ├── data3_1.yaml
│ │ │ │ │ ├── data3_1_hip.yaml
│ │ │ │ │ ├── data3_3.yaml
│ │ │ │ │ ├── data3_3_hip.yaml
│ │ │ │ │ ├── data500.yaml
│ │ │ │ │ ├── data_0.yaml
│ │ │ │ │ ├── data_3.yaml
│ │ │ │ │ └── data_d4rl.yaml
│ │ │ │ └── train
│ │ │ │ │ ├── data1_1.yaml
│ │ │ │ │ ├── data1_1_hip.yaml
│ │ │ │ │ ├── data240.yaml
│ │ │ │ │ ├── data250.yaml
│ │ │ │ │ ├── data2_1.yaml
│ │ │ │ │ ├── data2_1_hip.yaml
│ │ │ │ │ ├── data31_30_12.yaml
│ │ │ │ │ ├── data3_1.yaml
│ │ │ │ │ ├── data3_1_hip.yaml
│ │ │ │ │ ├── data3_3.yaml
│ │ │ │ │ ├── data3_3_hip.yaml
│ │ │ │ │ ├── data500.yaml
│ │ │ │ │ ├── data_0.yaml
│ │ │ │ │ ├── data_3.yaml
│ │ │ │ │ └── data_d4rl.yaml
│ │ │ ├── default_acrkn.yaml
│ │ │ ├── default_gru.yaml
│ │ │ ├── default_hiprssm.yaml
│ │ │ ├── default_lstm.yaml
│ │ │ ├── default_mts3.yaml
│ │ │ └── learn
│ │ │ │ ├── default.yaml
│ │ │ │ ├── default_acrkn.yaml
│ │ │ │ └── default_rnn.yaml
│ │ └── platform
│ │ │ ├── horeka.yaml
│ │ │ └── local.yaml
│ ├── hiprssm_exp.py
│ ├── mts3_exp.py
│ └── rnn_exp.py
├── maze2d
│ ├── acrkn_exp.py
│ ├── bash_scripts
│ │ ├── test.sh
│ │ └── test_rkn.sh
│ ├── conf
│ │ ├── config.yaml
│ │ ├── model
│ │ │ ├── data
│ │ │ │ └── data_medium.yaml
│ │ │ ├── default_acrkn.yaml
│ │ │ ├── default_gru.yaml
│ │ │ ├── default_hiprssm.yaml
│ │ │ ├── default_lstm.yaml
│ │ │ ├── default_mts3.yaml
│ │ │ └── learn
│ │ │ │ ├── default.yaml
│ │ │ │ ├── default_acrkn.yaml
│ │ │ │ └── default_rnn.yaml
│ │ └── platform
│ │ │ ├── horeka.yaml
│ │ │ └── local.yaml
│ ├── hiprssm_exp.py
│ ├── mts3_exp.py
│ └── rnn_exp.py
├── mobileRobot
│ ├── acrkn_exp.py
│ ├── bash_scripts
│ │ ├── test.sh
│ │ └── test_rkn.sh
│ ├── conf
│ │ ├── config.yaml
│ │ ├── model
│ │ │ ├── data
│ │ │ │ └── dataSinMixLong.yaml
│ │ │ ├── default_acrkn.yaml
│ │ │ ├── default_gru.yaml
│ │ │ ├── default_hiprssm.yaml
│ │ │ ├── default_lstm.yaml
│ │ │ ├── default_mts3.yaml
│ │ │ └── learn
│ │ │ │ ├── default.yaml
│ │ │ │ └── default_acrkn.yaml
│ │ └── platform
│ │ │ ├── bwuni-cpu.yaml
│ │ │ ├── bwuni-gpu.yaml
│ │ │ ├── horeka-acc.yaml
│ │ │ ├── horeka-amd.yaml
│ │ │ ├── horeka.yaml
│ │ │ ├── kluster.yaml
│ │ │ └── local.yaml
│ ├── hiprssm_exp.py
│ ├── mts3_exp.py
│ ├── mts3_simple_exp.py
│ └── rnn_exp.py
└── readme.md
├── images
├── 2023-07-14-13-54-04.png
├── acrkn.png
├── gclayer.png
├── gclayer2.png
├── gplayer.png
├── hiprssm4.png
├── mean-cov.jpg
├── mean_cov5.jpg
├── meancov1.jpg
├── mts3_readme.jpg
├── mts3arch.png
└── pgm_mts3.png
├── logs
├── latent_plots
│ └── readme.md
├── output
│ ├── plots
│ │ └── readme.md
│ └── readme.md
├── plotMetrics.py
└── plotTrajectory.py
├── main.py
├── readme.md
├── requirements.txt
└── utils
├── Losses.py
├── PositionEmbedding.py
├── __init__.py
├── __pycache__
├── ConfigDict.cpython-37.pyc
├── Losses.cpython-37.pyc
├── PositionEmbedding.cpython-37.pyc
├── __init__.cpython-36.pyc
├── __init__.cpython-37.pyc
├── __init__.cpython-38.pyc
├── dataProcess.cpython-37.pyc
├── dataProcess.cpython-38.pyc
├── latentVis.cpython-37.pyc
├── metrics.cpython-37.pyc
├── metrics.cpython-38.pyc
├── multistepRecurrent.cpython-37.pyc
├── plotTrajectory.cpython-37.pyc
├── serializable.cpython-36.pyc
├── serializable.cpython-37.pyc
├── serializable.cpython-38.pyc
├── tensor_utils.cpython-37.pyc
├── utils.cpython-36.pyc
├── utils.cpython-37.pyc
├── utils.cpython-38.pyc
└── x_ai_tools.cpython-37.pyc
├── dataProcess.py
├── metrics.py
├── plotTrajectory.py
├── serializable.py
├── tensor_utils.py
├── utils.py
└── x_ai_tools.py
/.gitignore:
--------------------------------------------------------------------------------
1 | ### add folder experiments/mobileRobot/conf/data to gitignore file below this line
2 | /experiments/mobileRobot/conf/data/
3 | /experiments/frankaKitchen/conf/data/
4 | /sweep_dir/
5 | /experiments/hydraulics/
6 | *.pickle
7 | *.pkl
8 | /outputs/
9 | *.json
10 | *.log
11 | *.h5
12 | *.npz
13 | *.ckpt
14 | *.hdf5
15 | *.wandb
16 | *.out
17 | /.vscode
18 | /.idea
--------------------------------------------------------------------------------
/agent/Infer/__pycache__/repre_infer_hiprssm.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/Infer/__pycache__/repre_infer_hiprssm.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/Infer/__pycache__/repre_infer_mts3.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/Infer/__pycache__/repre_infer_mts3.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/Infer/__pycache__/repre_infer_mts3Simple.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/Infer/__pycache__/repre_infer_mts3Simple.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/Infer/__pycache__/repre_infer_rnn.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/Infer/__pycache__/repre_infer_rnn.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/Learn/__pycache__/repre_learn_hiprssm.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/Learn/__pycache__/repre_learn_hiprssm.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/Learn/__pycache__/repre_learn_mts3.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/Learn/__pycache__/repre_learn_mts3.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/Learn/__pycache__/repre_learn_mts3Simple.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/Learn/__pycache__/repre_learn_mts3Simple.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/Learn/__pycache__/repre_learn_rnn.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/Learn/__pycache__/repre_learn_rnn.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/worldModels/Decoders/__pycache__/propDecoder.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/worldModels/Decoders/__pycache__/propDecoder.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/worldModels/RNN.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import numpy as np
3 | from utils.TimeDistributed import TimeDistributed
4 | from agent.worldModels.SensorEncoders.propEncoder import EncoderSimple
5 | from agent.worldModels.Decoders.propDecoder import SimpleDecoder
6 | from typing import Tuple
7 | optim = torch.optim
8 | nn = torch.nn
9 |
10 |
11 | class RNNBaseline(nn.Module):
12 | def __init__(self, input_shape=None, action_dim=None, config=None, use_cuda_if_available: bool = True):
13 | """
14 | TODO: Gradient Clipping?
15 | :param input_shape: shape of the input
16 | :param action_dim: dimension of the action space
17 | :param config: Config Dict
18 | :param use_cuda_if_available: use cuda if available
19 | """
20 | super(RNNBaseline, self).__init__()
21 | self._device = torch.device("cuda" if torch.cuda.is_available() and use_cuda_if_available else "cpu")
22 | if config == None:
23 | raise ValueError("config cannot be None, pass an omegaConf File")
24 | else:
25 | self.c = config
26 |
27 | self._obs_shape = input_shape
28 | self._action_dim = action_dim
29 | self._lod = self.c.rnn.latent_obs_dim
30 | self._lsd = 2 * self._lod
31 |
32 | # parameters
33 | self._enc_out_normalization = self.c.rnn.enc_out_norm
34 |
35 | # main model
36 | obs_enc = EncoderSimple(self._obs_shape[-1], self._lod, self.c.rnn.obs_encoder)
37 | act_enc = EncoderSimple(self._action_dim, self._lod, self.c.rnn.act_encoder)
38 | enc = EncoderSimple(2*self._lod, self._lsd, self.c.rnn.encoder)
39 | self._obs_enc = obs_enc.to(self._device)
40 | self._act_enc = act_enc.to(self._device)
41 | self._enc = enc.to(self._device)
42 |
43 | if self.c.rnn.type.lower() == 'gru':
44 | self._lstm_layer = nn.GRU(input_size= 2 * self._lod, hidden_size=5 * self._lod, batch_first=True).to(self._device)
45 | else:
46 | self._lstm_layer = nn.LSTM(input_size=2 * self._lod, hidden_size=5 * self._lod, batch_first=True).to(self._device)
47 |
48 | obsDec = SimpleDecoder(latent_state_dim = 5* self._lod, out_dim = self._obs_shape[-1], config = self.c.rnn.obs_decoder)
49 | self._dec = obsDec.to(self._device)
50 |
51 | self._shuffle_rng = np.random.RandomState(42) # rng for shuffling batches
52 |
53 | def _build_dec_hidden_layers(self) -> Tuple[nn.ModuleList, int]:
54 | """
55 | Builds hidden layers for mean decoder
56 | :return: nn.ModuleList of hidden Layers, size of output of last layer
57 | """
58 | raise NotImplementedError
59 |
60 |
61 | def forward(self, obs_batch: torch.Tensor, act_batch: torch.Tensor, obs_valid_batch: torch.Tensor) -> Tuple[float, float]:
62 | """Forward Pass oF RNN Baseline
63 | :param obs_batch: batch of observation sequences
64 | :param act_batch: batch of action sequences
65 | :param obs_valid_batch: batch of observation valid flag sequences
66 | :return: mean and variance
67 | """
68 | # here masked values are set to zero. You can also put an unrealistic value like a negative number.
69 | obs_masked_batch = obs_batch * obs_valid_batch
70 | w_obs = self._obs_enc(obs_masked_batch)
71 | w_obs = w_obs
72 | act_obs = self._act_enc(act_batch)
73 | input_batch = torch.cat([w_obs,act_obs], dim=-1)
74 | w = self._enc(input_batch)
75 | z, y = self._lstm_layer(w)
76 | out_mean, out_var = self._dec(z)
77 | return out_mean, out_var
--------------------------------------------------------------------------------
/agent/worldModels/SensorEncoders/__pycache__/propEncoder.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/worldModels/SensorEncoders/__pycache__/propEncoder.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/worldModels/__pycache__/MTS3.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/worldModels/__pycache__/MTS3.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/worldModels/__pycache__/MTS3Simple.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/worldModels/__pycache__/MTS3Simple.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/worldModels/__pycache__/MTS3_fast.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/worldModels/__pycache__/MTS3_fast.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/worldModels/__pycache__/MTS3_v2.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/worldModels/__pycache__/MTS3_v2.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/worldModels/__pycache__/RNN.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/worldModels/__pycache__/RNN.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/worldModels/__pycache__/acRKN.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/worldModels/__pycache__/acRKN.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/worldModels/__pycache__/hipRSSM.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/worldModels/__pycache__/hipRSSM.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/worldModels/acRKN.py:
--------------------------------------------------------------------------------
1 | # TODO: collect valid flags too ??
2 | # TODO: go through the code once again
3 | # TODO: check if update and marginalization is correct
4 |
5 | import torch
6 | from agent.worldModels.SensorEncoders.propEncoder import Encoder
7 | from agent.worldModels.gaussianTransformations.gaussian_marginalization import Predict
8 | from agent.worldModels.gaussianTransformations.gaussian_conditioning import Update
9 | from agent.worldModels.Decoders.propDecoder import SplitDiagGaussianDecoder
10 |
11 | nn = torch.nn
12 |
13 | '''
14 | Tip: in config self.ltd = lod
15 | in context_predict ltd is doubled
16 | in task_predict ltd is considered lod and lsd is doubled inside
17 | '''
18 | class acRKN(nn.Module):
19 | """
20 | MTS3 model
21 | Inference happen in such a way that first episode is used for getting an intial task posterioer and then the rest of the episodes are used for prediction by the worker
22 | Maybe redo this logic based on original implementation or use a different method that helps control too ??
23 | """
24 |
25 | def __init__(self, input_shape=None, action_dim=None, config=None, use_cuda_if_available: bool = True):
26 | """
27 | @param obs_dim: dimension of observations to train on
28 | @param action_dim: dimension of control signals
29 | @param inp_shape: shape of the input observations
30 | @param config: config dict
31 | @param dtype:
32 | @param use_cuda_if_available:
33 | """
34 | super(acRKN, self).__init__()
35 | if config == None:
36 | raise ValueError("config cannot be None, pass an omegaConf File")
37 | else:
38 | self.c = config
39 | self._device = torch.device("cuda" if torch.cuda.is_available() and use_cuda_if_available else "cpu")
40 | self._obs_shape = input_shape
41 | self._action_dim = action_dim
42 | self._lod = self.c.acrkn.latent_obs_dim
43 | self._lsd = 2*self._lod
44 |
45 | self._pixel_obs = self.c.acrkn.pixel_obs ##TODO: config
46 | self._decode_reward = self.c.acrkn.decode.reward ##TODO: config and it basically initializes the reward decoder
47 | self._decode_obs = self.c.acrkn.decode.obs ##TODO: config and it basically initializes the obs decoder
48 |
49 |
50 |
51 | ### Define the encoder and decoder
52 | obsEnc = Encoder(self._obs_shape[-1], self._lod, self.c.acrkn.worker.obs_encoder) ## TODO: config
53 | self._obsEnc = obsEnc.to(self._device)
54 |
55 | obsDec = SplitDiagGaussianDecoder(latent_obs_dim=self._lod, out_dim=self._obs_shape[-1], config=self.c.acrkn.worker.obs_decoder) ## TODO: config
56 | self._obsDec = obsDec.to(self._device)
57 |
58 | if self._decode_reward:
59 | rewardDec = SplitDiagGaussianDecoder(latent_obs_dim=self._lod, out_dim=1, config=self.c.acrkn.worker.reward_decoder) ## TODO: config
60 | self._rewardDec = rewardDec.to(self._device)
61 |
62 |
63 | ### Define the gaussian layers for both levels
64 | self._state_predict = Predict(latent_obs_dim=self._lod, act_dim=self._action_dim, hierarchy_type = "ACRKN", config=self.c.acrkn.worker) ## initiate worker marginalization layer for state prediction
65 | self._obsUpdate = Update(latent_obs_dim=self._lod, memory = True, config = self.c) ## memory is true
66 |
67 | def _intialize_mean_covar(self, batch_size, learn=False):
68 | if learn:
69 | pass
70 |
71 | else:
72 | init_state_covar_ul = self.c.acrkn.initial_state_covar * torch.ones(batch_size, self._lsd)
73 |
74 | initial_mean = torch.zeros(batch_size, self._lsd).to(self._device)
75 | icu = init_state_covar_ul[:, :self._lod].to(self._device)
76 | icl = init_state_covar_ul[:, self._lod:].to(self._device)
77 | ics = torch.ones(1, self._lod).to(self._device)
78 |
79 | initial_cov = [icu, icl, ics]
80 |
81 | return initial_mean, initial_cov
82 |
83 | def forward(self, obs_seqs, action_seqs, obs_valid_seqs, decode_obs=True, decode_reward=False, train=False):
84 | '''
85 | obs_seqs: sequences of timeseries of observations (batch x time x obs_dim)
86 | action_seqs: sequences of timeseries of actions (batch x time x obs_dim)
87 | obs_valid_seqs: sequences of timeseries of actions (batch x time)
88 | task_valid_seqs: sequences of timeseries of actions (batch x task)
89 | '''
90 | ##################################### Only Worker (with no task conditioning) ############################################
91 | ### using the task prior, predict the observation mean and covariance for fine time scale / worker
92 | ### create a meta_list of prior and posterior states
93 | num_episodes = 1
94 |
95 | state_prior_mean_init, state_prior_cov_init = self._intialize_mean_covar(obs_seqs.shape[0], learn=False)
96 |
97 | for k in range(0,num_episodes):
98 | if k==0:
99 | state_prior_mean = state_prior_mean_init
100 | state_prior_cov = state_prior_cov_init
101 | ### create list of state mean and covariance
102 | prior_state_mean_list = []
103 | prior_state_cov_list = []
104 | post_state_mean_list = []
105 | post_state_cov_list = []
106 |
107 | for t in range(obs_seqs.shape[1]):
108 | ### encode the observation (no time embedding)
109 | current_obs = obs_seqs[:, t, :]
110 |
111 | ## expand dims to make it compatible with the encoder
112 | current_obs = torch.unsqueeze(current_obs, dim=1)
113 | obs_mean, obs_var = self._obsEnc(current_obs)
114 |
115 | ### update the state posterior
116 | current_obs_valid = obs_valid_seqs[:, t, :]
117 |
118 | ## expand dims to make it compatible with the encoder
119 | current_obs_valid = torch.unsqueeze(current_obs_valid, dim=1)
120 | state_post_mean, state_post_cov = self._obsUpdate(state_prior_mean, state_prior_cov, obs_mean, obs_var, current_obs_valid)
121 |
122 | ### predict the next state mean and covariance using the marginalization layer for ACRKN
123 | current_act = action_seqs[:, t, :]
124 | mean_list_causal_factors = [state_post_mean, current_act]
125 | cov_list_causal_factors = [state_post_cov]
126 | state_next_mean, state_next_cov = self._state_predict(mean_list_causal_factors, cov_list_causal_factors)
127 |
128 | ### update the state prior
129 | state_prior_mean, state_prior_cov = state_next_mean, state_next_cov ### this step also makes sure every episode
130 | ### starts with the prior of the previous episode
131 |
132 | ### concat
133 | ### append the state mean and covariance to the list
134 | prior_state_mean_list.append(state_prior_mean)
135 | prior_state_cov_list.append(torch.cat(state_prior_cov, dim=-1))
136 | post_state_mean_list.append(state_post_mean)
137 | post_state_cov_list.append(torch.cat(state_post_cov, dim=-1))
138 |
139 | ## detach the state prior mean and covariance to make sure the next episode starts with the prior of the previous episode
140 | state_prior_mean = state_prior_mean.detach()
141 | state_prior_cov = [cov.detach() for cov in state_prior_cov]
142 |
143 | ### stack the list to get the final tensors
144 | prior_state_means = torch.stack(prior_state_mean_list, dim=1)
145 | prior_state_covs = torch.stack(prior_state_cov_list, dim=1)
146 |
147 | ### decode the state to get the observation mean and covariance ##TODO: do it here ?? or outside ???
148 | if self._decode_obs:
149 | pred_obs_means, pred_obs_covs = self._obsDec(prior_state_means, prior_state_covs)
150 | if self._decode_reward:
151 | pred_reward_means, pred_reward_covs = self._rewardDec(prior_state_means, prior_state_covs)
152 |
153 | return pred_obs_means, pred_obs_covs
154 |
--------------------------------------------------------------------------------
/agent/worldModels/gaussianTransformations/__pycache__/gaussian_conditioning.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/worldModels/gaussianTransformations/__pycache__/gaussian_conditioning.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/worldModels/gaussianTransformations/__pycache__/gaussian_marginalization.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/agent/worldModels/gaussianTransformations/__pycache__/gaussian_marginalization.cpython-37.pyc
--------------------------------------------------------------------------------
/agent/worldModels/readme.md:
--------------------------------------------------------------------------------
1 | # Papers and Models
2 |
3 | This repository contains the implemenation of several projects (papers and associated models) related to MTS3 which were also used as basleines.
4 | This document contains a brief overview of the history of MTS3-related work and how they relate to each other.
5 |
6 |
7 | ## (Action Conditional) Recurrent Kalman Networks (CoRL 2020)
8 |
9 |
10 | Figure: PGM of AcRKN with principled action conditioning.
11 |
12 |
13 |
14 | > **Action-Conditional Recurrent Kalman Networks For Forward and Inverse Dynamics Learning**\
15 | > Vaisakh Shaj, Philipp Becker, Dieter Buchler, Harit Pandya, Niels van Duijkeren, C. James Taylor, Marc Hanheide, Gerhard Neumann \
16 | > Paper: https://arxiv.org/abs/2010.10201
17 |
18 | > Ac-RKN was motivated by extending the previous ICML 2019 work [RKN](https://arxiv.org/abs/1905.07357) from the same lab and coauthors, to action-conditional settings, which is critical for learning World Models.
19 | > The paper primarily focused on modelling real robot dynamics including the ones with electric, pneumatic and hydraulic actuators.
20 |
21 | ## Hidden Parameter State Space Models (ICLR 2022)
22 |
23 |
24 | Figure: HiP-SSM models a set of SSMs for each value of latent varaible theta.
25 |
26 |
27 |
28 | > **Hidden Parameter Recurrent State Space Models For Changing Dynamics Scenarios**\
29 | > Vaisakh Shaj, Dieter Buchler, Rohit Sonker, Philipp Becker, Gerhard Neumann\
30 | > Paper: https://arxiv.org/abs/2206.14697
31 |
32 | > HiP-RSSM builds upon Ac-RKN to modelling Non-Stationary/Changing Dynamics with a hierarchical latent task variable. You can think of it as performing meta-learning on Kalman Filters.
33 |
34 | ## Multi Time Scale World Models (Neurips 2023 - Spotlight)
35 |
36 |
37 |
38 | Figure: PGM of a 2-Level MTS3
39 |
40 |
41 |
42 | > **Multi Time Scale World Models**\
43 | > Vaisakh Shaj, Saleh Gholam Zadeh, Ozan Demir, Luiz Ricardo Douat, Gerhard Neumann\
44 | > Paper: https://arxiv.org/abs/2310.18534
45 |
46 | > Extending the concept of latent task as a form of abstraction, MTS3 propose a formalism for learning world models at multiple temporal abstractions. This important for long horizon predicitons (higher abstractions predict long term trends while lower abstractions predict short term dynamics) and for learning hierarchical policies.
47 |
48 |
49 | # Citations
50 |
51 | If you use this codebase, or otherwise found our work valuable, please cite the relevant papers.
52 | ```
53 | @article{shaj2023multi,
54 | title={Multi Time Scale World Models},
55 | author={Shaj, Vaisakh and Zadeh, Saleh Gholam and Demir, Ozan and Douat, Luiz Ricardo and Neumann, Gerhard},
56 | journal={arXiv preprint arXiv:2310.18534},
57 | year={2023}
58 | }
59 | @article{shaj2022hidden,
60 | title={Hidden parameter recurrent state space models for changing dynamics scenarios},
61 | author={Shaj, Vaisakh and Buchler, Dieter and Sonker, Rohit and Becker, Philipp and Neumann, Gerhard},
62 | journal={arXiv preprint arXiv:2206.14697},
63 | year={2022}
64 | }
65 | @inproceedings{shaj2021action,
66 | title={Action-conditional recurrent kalman networks for forward and inverse dynamics learning},
67 | author={Shaj, Vaisakh and Becker, Philipp and B{\"u}chler, Dieter and Pandya, Harit and van Duijkeren, Niels and Taylor, C James and Hanheide, Marc and Neumann, Gerhard},
68 | booktitle={Conference on Robot Learning},
69 | pages={765--781},
70 | year={2021},
71 | organization={PMLR}
72 | }
73 | @inproceedings{becker2019recurrent,
74 | title={Recurrent kalman networks: Factorized inference in high-dimensional deep feature spaces},
75 | author={Becker, Philipp and Pandya, Harit and Gebhardt, Gregor and Zhao, Cheng and Taylor, C James and Neumann, Gerhard},
76 | booktitle={International conference on machine learning},
77 | pages={544--552},
78 | year={2019},
79 | organization={PMLR}
80 | }
81 | ```
82 |
--------------------------------------------------------------------------------
/dataFolder/__pycache__/cheetahData.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/dataFolder/__pycache__/cheetahData.cpython-37.pyc
--------------------------------------------------------------------------------
/dataFolder/__pycache__/dataDpssm.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/dataFolder/__pycache__/dataDpssm.cpython-37.pyc
--------------------------------------------------------------------------------
/dataFolder/__pycache__/dataDpssmVar.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/dataFolder/__pycache__/dataDpssmVar.cpython-37.pyc
--------------------------------------------------------------------------------
/dataFolder/__pycache__/excavatorData.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/dataFolder/__pycache__/excavatorData.cpython-37.pyc
--------------------------------------------------------------------------------
/dataFolder/__pycache__/excavatorDataVar.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/dataFolder/__pycache__/excavatorDataVar.cpython-37.pyc
--------------------------------------------------------------------------------
/dataFolder/__pycache__/fkDataDpssm.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/dataFolder/__pycache__/fkDataDpssm.cpython-37.pyc
--------------------------------------------------------------------------------
/dataFolder/__pycache__/mazeData.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/dataFolder/__pycache__/mazeData.cpython-37.pyc
--------------------------------------------------------------------------------
/dataFolder/__pycache__/mazeDataDpssm.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/dataFolder/__pycache__/mazeDataDpssm.cpython-37.pyc
--------------------------------------------------------------------------------
/dataFolder/__pycache__/mobileData.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/dataFolder/__pycache__/mobileData.cpython-37.pyc
--------------------------------------------------------------------------------
/dataFolder/__pycache__/mobileDataDpssm_v1.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/dataFolder/__pycache__/mobileDataDpssm_v1.cpython-37.pyc
--------------------------------------------------------------------------------
/dataFolder/mts3_datasets_processed/readme.md:
--------------------------------------------------------------------------------
1 | The datasets can be downloaded from the following urls. Its automatically downloaded when running exps, if not
2 | already present.
3 |
4 | Mobile Robot: https://drive.google.com/file/d/1ShZ_LyLGkWimboJv5RRk8M4yvrT7AUYY/view?usp=drive_link
5 |
6 | Maze2d(medium): https://drive.google.com/file/d/1fwrLrV_28832OYat4YpWuNl51MEXbKlq/view?usp=drive_link
7 |
8 | HalfCheetah: https://drive.google.com/file/d/1MuJBYSNN3D6BRfGp0Eu7Hbz1roKOzcxN/view?usp=drive_link
9 |
10 | FrankaKitchen: https://drive.google.com/file/d/1DDUpJdHUec_4WsMgO9B7bpMSkbhSwV1X/view?usp=drive_link
11 |
12 | **Important Note:** All datasets are normalized to mean zero std one. We also provide the normalization constants with the datasets. The normalization constants are stored in the `normalizer` key in the data dictionary.
13 |
14 | Use the following script to load the data.
15 |
16 | ```python
17 | import pickle
18 | ##print all shapes
19 | with open(data_path, 'rb') as f:
20 | data_dict = pickle.load(f)
21 | print("Train Obs Shape", data_dict['train_obs'].shape)
22 | print("Train Act Shape", data_dict['train_act'].shape)
23 | print("Train Targets Shape", data_dict['train_targets'].shape)
24 | print("Test Obs Shape", data_dict['test_obs'].shape)
25 | print("Test Act Shape", data_dict['test_act'].shape)
26 | print("Test Targets Shape", data_dict['test_targets'].shape)
27 | print("Normalizer", data_dict['normalizer'])
28 | ```
--------------------------------------------------------------------------------
/experiments/__pycache__/exp_prediction_acrkn.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/experiments/__pycache__/exp_prediction_acrkn.cpython-37.pyc
--------------------------------------------------------------------------------
/experiments/__pycache__/exp_prediction_hiprssm.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/experiments/__pycache__/exp_prediction_hiprssm.cpython-37.pyc
--------------------------------------------------------------------------------
/experiments/__pycache__/exp_prediction_mts3.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/experiments/__pycache__/exp_prediction_mts3.cpython-37.pyc
--------------------------------------------------------------------------------
/experiments/__pycache__/exp_prediction_mts3_v2.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/experiments/__pycache__/exp_prediction_mts3_v2.cpython-37.pyc
--------------------------------------------------------------------------------
/experiments/__pycache__/exp_prediction_rnn.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/experiments/__pycache__/exp_prediction_rnn.cpython-37.pyc
--------------------------------------------------------------------------------
/experiments/__pycache__/exp_simple_prediction_mts3.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/experiments/__pycache__/exp_simple_prediction_mts3.cpython-37.pyc
--------------------------------------------------------------------------------
/experiments/frankaKitchen/acrkn_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import numpy as np
8 | import torch
9 | import wandb
10 | import pickle
11 | import json
12 | import gdown
13 |
14 | from experiments.exp_prediction_acrkn import Experiment
15 | from agent.worldModels import MTS3
16 | from hydra.utils import get_original_cwd, to_absolute_path
17 |
18 |
19 | nn = torch.nn
20 |
21 | @hydra.main(config_path='conf',config_name="config")
22 | def my_app(cfg)->OmegaConf:
23 | global config
24 | model_cfg = cfg
25 | exp = Experiment(model_cfg)
26 |
27 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
28 | ### train the model
29 | mts3_model, wandb_run, save_path = exp._train_world_model(train_obs, train_act, train_targets, test_obs, test_act, test_targets)
30 | ### test the model
31 | #TODO: normalizer format specify
32 | exp._test_world_model(test_obs, test_act, test_targets, normalizer, mts3_model, wandb_run, save_path)
33 |
34 |
35 | class Experiment(Experiment):
36 | def __init__(self, cfg):
37 | super(Experiment, self).__init__(cfg)
38 |
39 | def _load_save_train_test_data(self):
40 | """
41 | write a function to load the data and return the train and test data
42 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
43 | """
44 | ## load the data from pickle and if not present download from the url
45 | if not os.path.exists(get_original_cwd() + self._data_cfg.save_path):
46 | print("..........Data Not Found...........Downloading from URL")
47 | ### download the data from url
48 | url = self._data_cfg.url
49 | output = get_original_cwd() + self._data_cfg.save_path
50 | gdown.download(url, output, quiet=False)
51 | else:
52 | print("..........Data Found...........Loading from local")
53 | with open(get_original_cwd() + self._data_cfg.save_path, 'rb') as f:
54 | data_dict = pickle.load(f)
55 | print("Train Obs Shape", data_dict['train_obs'].shape)
56 | print("Train Act Shape", data_dict['train_act'].shape)
57 | print("Train Targets Shape", data_dict['train_targets'].shape)
58 | print("Test Obs Shape", data_dict['test_obs'].shape)
59 | print("Test Act Shape", data_dict['test_act'].shape)
60 | print("Test Targets Shape", data_dict['test_targets'].shape)
61 | print("Normalizer", data_dict['normalizer'])
62 | return data_dict
63 |
64 | def _get_data_set(self):
65 | """
66 | write a function to load the data and return the train and test data
67 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
68 | """
69 | ### load or generate data
70 | data_dict = self._load_save_train_test_data()
71 |
72 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
73 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
74 |
75 |
76 | def main():
77 | my_app()
78 |
79 |
80 |
81 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
82 | if __name__ == '__main__':
83 | main()
--------------------------------------------------------------------------------
/experiments/frankaKitchen/bash_scripts/test.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/experiments/frankaKitchen/bash_scripts/test.sh
--------------------------------------------------------------------------------
/experiments/frankaKitchen/bash_scripts/test_rkn.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/experiments/frankaKitchen/bash_scripts/test_rkn.sh
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/config.yaml:
--------------------------------------------------------------------------------
1 | hydra:
2 | mode: RUN
3 | sweep:
4 | dir: ./sweep_dir
5 |
6 |
7 | defaults:
8 | - model: default_mts3
9 | - platform: local
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/data/data_complete.yaml:
--------------------------------------------------------------------------------
1 | type: 'complete'
2 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
3 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
4 | episode_length: 15 #window length for a particular instance of hip-rssm
5 | num_episodes: 12 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
6 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
7 | load: True
8 | save: False
9 | standardize: True
10 | split:
11 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
12 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
13 | shuffle_split: 0.8
14 | save_path: "/dataFolder/mts3_datasets_processed/kitchenData.pkl"
15 | url: "https://drive.google.com/uc?id=1DDUpJdHUec_4WsMgO9B7bpMSkbhSwV1X"
16 | trajPerTask: 10
17 | downsample: 1
18 | episodic: False
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/data/test/data_complete.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.85
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: 'complete'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 12 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: True
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/frankaKitchen/conf/model/data/completeKitchen.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/data/test/data_complete_1.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.65
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: 'complete'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 1 #window length for a particular instance of hip-rssm
9 | num_episodes: 180 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/frankaKitchen/conf_dp/data/completeKitchen.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/data/test/data_complete_10.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.65
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: 'complete'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 10 #window length for a particular instance of hip-rssm
9 | num_episodes: 18 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/frankaKitchen/conf_dp/data/completeKitchen.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/data/test/data_complete_2.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.65
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: 'complete'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 2 #window length for a particular instance of hip-rssm
9 | num_episodes: 90 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/frankaKitchen/conf_dp/data/completeKitchen.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/data/test/data_complete_3.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.65
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: 'complete'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 3 #window length for a particular instance of hip-rssm
9 | num_episodes: 60 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/frankaKitchen/conf_dp/data/completeKitchen.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/data/test/data_complete_30.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.65
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: 'complete'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 30 #window length for a particular instance of hip-rssm
9 | num_episodes: 6 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/frankaKitchen/conf_dp/data/completeKitchen.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/data/test/data_complete_5.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.65
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: 'complete'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 5 #window length for a particular instance of hip-rssm
9 | num_episodes: 36 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/frankaKitchen/conf_dp/data/completeKitchen.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/data/train/data_complete.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.65
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: 'complete'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 12 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/frankaKitchen/conf/model/data/kitchenNeuripsData.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/data/train/data_complete_1.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.65
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: 'complete'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 1 #window length for a particular instance of hip-rssm
9 | num_episodes: 180 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/frankaKitchen/conf_dp/data/completeKitchen.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/data/train/data_complete_10.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.65
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: 'complete'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 10 #window length for a particular instance of hip-rssm
9 | num_episodes: 18 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/frankaKitchen/conf_dp/data/completeKitchen.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/data/train/data_complete_2.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.65
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: 'complete'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 2 #window length for a particular instance of hip-rssm
9 | num_episodes: 90 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/frankaKitchen/conf_dp/data/completeKitchen.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/data/train/data_complete_3.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.65
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: 'complete'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 3 #window length for a particular instance of hip-rssm
9 | num_episodes: 60 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/frankaKitchen/conf_dp/data/completeKitchen.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/data/train/data_complete_30.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.65
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: 'complete'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 30 #window length for a particular instance of hip-rssm
9 | num_episodes: 6 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/frankaKitchen/conf_dp/data/completeKitchen.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/data/train/data_complete_5.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.65
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: 'complete'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 5 #window length for a particular instance of hip-rssm
9 | num_episodes: 36 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/frankaKitchen/conf_dp/data/completeKitchen.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/default_acrkn.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default_rnn
3 | - data: data_complete
4 |
5 | wandb:
6 | log: True
7 | project_name: 'cameraFrankaKitchen'
8 | exp_name: 'acrkn'
9 | sweep: False
10 | sweep_id: null
11 |
12 | acrkn:
13 | latent_obs_dim: 30 #for contextual rssm
14 | pixel_obs: False
15 | initial_state_covar: 10 ## for both hierarchies same (chaneg later ??)
16 |
17 | worker:
18 | addIdentity: True
19 | bandwidth: 3
20 | decode_var: True
21 | obs_encoder:
22 | hidden_units_list: [ 120 ]
23 | out_norm: 'post'
24 | variance_activation: 'softplus'
25 | trans_net_hidden_units: [ ]
26 | control_net_hidden_units: [ 120 ]
27 | process_noise_hidden_units: [ 30 ]
28 | trans_net_hidden_activation: "Tanh"
29 | control_net_hidden_activation: 'ReLU'
30 | process_noise_hidden_activation: 'ReLU'
31 | task_net_hidden_activation: 'ReLU'
32 | learn_trans_covar: True
33 | decoder_conditioning: False
34 | multi_gaussian_l_transform: False
35 | trans_covar: 0.1
36 | learn_initial_state_covar: False
37 | initial_state_covar: 10
38 | clip_gradients: True
39 | obs_decoder:
40 | hidden_units_list: [ 240 ]
41 | out_norm: 'post'
42 | variance_activation: 'softplus'
43 |
44 | decode:
45 | reward: False
46 | obs: True
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/default_gru.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default_rnn
3 | - data: data_complete
4 |
5 | wandb:
6 | log: True
7 | project_name: 'cameraFrankaKitchen'
8 | exp_name: 'gru'
9 | sweep: False
10 | sweep_id: null
11 |
12 | rnn:
13 | type: 'gru'
14 | latent_obs_dim: 30 #for contextual rssm
15 | pixel_obs: False
16 | decode_var: True
17 | enc_out_norm: True
18 | obs_encoder:
19 | hidden_units_list: [ 120 ]
20 | out_norm: 'post'
21 | variance_activation: 'softplus'
22 | act_encoder:
23 | hidden_units_list: [ 120 ]
24 | out_norm: 'post'
25 | variance_activation: 'softplus'
26 | encoder:
27 | hidden_units_list: [ 120 ]
28 | out_norm: 'post'
29 | variance_activation: 'softplus'
30 | obs_decoder:
31 | hidden_units_list: [ 240 ]
32 | out_norm: 'post'
33 | variance_activation: 'softplus'
34 |
35 | decode:
36 | reward: False
37 | obs: True
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/default_hiprssm.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default_rnn
3 | - data: data_complete
4 |
5 | wandb:
6 | log: True
7 | project_name: 'cameraFrankaKitchen'
8 | exp_name: 'hiprssm'
9 | sweep: False
10 | sweep_id: null
11 |
12 | hiprssm:
13 | context_len: 75
14 | clip_gradients: True
15 | latent_obs_dim: 30 #for contextual rssm
16 | pixel_obs: False
17 | initial_state_covar: 10 ## (change later ??)
18 | initial_task_covar: 1 ## (change later ??)
19 |
20 | worker:
21 | addIdentity: True
22 | bandwidth: 3
23 | decode_var: True
24 | obs_encoder:
25 | hidden_units_list: [ 120 ]
26 | out_norm: 'post'
27 | variance_activation: 'softplus'
28 | task_encoder:
29 | hidden_units_list: [ 240 ]
30 | out_norm: 'post'
31 | variance_activation: 'softplus'
32 | trans_net_hidden_units: [ ]
33 | control_net_hidden_units: [ 120 ]
34 | process_noise_hidden_units: [ 30 ]
35 | trans_net_hidden_activation: "Tanh"
36 | control_net_hidden_activation: 'ReLU'
37 | process_noise_hidden_activation: 'ReLU'
38 | task_net_hidden_activation: 'ReLU'
39 | learn_trans_covar: True
40 | decoder_conditioning: False
41 | multi_gaussian_l_transform: False
42 | trans_covar: 0.1
43 | learn_initial_state_covar: False
44 | initial_state_covar: 10
45 | clip_gradients: True
46 | obs_decoder:
47 | hidden_units_list: [ 240 ]
48 | out_norm: 'post'
49 | variance_activation: 'softplus'
50 |
51 | decode:
52 | reward: False
53 | obs: True
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/default_lstm.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default_rnn
3 | - data: data_complete
4 |
5 | wandb:
6 | log: True
7 | project_name: 'cameraFrankaKitchen'
8 | exp_name: 'lstm'
9 | sweep: False
10 | sweep_id: null
11 |
12 | rnn:
13 | type: 'lstm'
14 | latent_obs_dim: 30 #for contextual rssm
15 | pixel_obs: False
16 | decode_var: True
17 | enc_out_norm: True
18 | obs_encoder:
19 | hidden_units_list: [ 120 ]
20 | out_norm: 'post'
21 | variance_activation: 'softplus'
22 | act_encoder:
23 | hidden_units_list: [ 120 ]
24 | out_norm: 'post'
25 | variance_activation: 'softplus'
26 | encoder:
27 | hidden_units_list: [ 120 ]
28 | out_norm: 'post'
29 | variance_activation: 'softplus'
30 | obs_decoder:
31 | hidden_units_list: [ 240 ]
32 | out_norm: 'post'
33 | variance_activation: 'softplus'
34 |
35 | decode:
36 | reward: False
37 | obs: True
38 |
39 |
40 |
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/default_mts3.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default
3 | - data: data_complete
4 |
5 | wandb:
6 | log: True
7 | project_name: 'cameraFrankaKitchen'
8 | exp_name: 'mts3_new'
9 | sweep: False
10 | sweep_id: null
11 |
12 | mts3:
13 | latent_obs_dim: 30 #for contextual rssm
14 | pixel_obs: False
15 | time_scale_multiplier: 15
16 | initial_state_covar: 10 ## for both hierarchies same (chaneg later ??)
17 | manager:
18 | bandwidth: 3
19 | process_noise_hidden_units: [ 30 ]
20 | trans_net_hidden_activation: "Tanh"
21 | process_noise_hidden_activation: 'ReLU'
22 | learn_trans_covar: True
23 | trans_covar: 0.1
24 | learn_initial_state_covar: False
25 | initial_state_covar: 10
26 | abstract_obs_encoder:
27 | hidden_units_list: [ 240 ]
28 | out_norm: 'none'
29 | variance_activation: 'softplus'
30 | learn_initial_state_covar: False
31 | initial_state_covar: 10
32 | state_abs: True
33 | time_embed:
34 | type: "time"
35 | dim: 1
36 | abstract_act_encoder:
37 | hidden_units_list: [ 240 ]
38 | aggregator: 'BA'
39 | out_norm: 'none'
40 | variance_activation: 'softplus'
41 | learn_initial_state_covar: False
42 | initial_state_covar: 10
43 | state_abs: True
44 | time_embed:
45 | type: "time"
46 | dim: 1
47 |
48 | worker:
49 | bandwidth: 3
50 | decode_var: True
51 | obs_encoder:
52 | hidden_units_list: [ 120 ]
53 | out_norm: 'none'
54 | variance_activation: 'softplus'
55 | trans_net_hidden_units: [ ]
56 | control_net_hidden_units: [ 120 ]
57 | task_net_hidden_units: [ 120 ]
58 | process_noise_hidden_units: [ 30 ]
59 | trans_net_hidden_activation: "Tanh"
60 | control_net_hidden_activation: 'ReLU'
61 | process_noise_hidden_activation: 'ReLU'
62 | task_net_hidden_activation: 'ReLU'
63 | learn_trans_covar: True
64 | trans_covar: 0.1
65 | learn_initial_state_covar: False
66 | initial_state_covar: 10
67 | obs_decoder:
68 | hidden_units_list: [ 240 ]
69 | variance_activation: 'softplus'
70 |
71 | decode:
72 | reward: False
73 | obs: True
74 |
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/learn/default.yaml:
--------------------------------------------------------------------------------
1 | name: "_default"
2 | model:
3 | load: False
4 | id: 2e4hzn33
5 | epochs: 750
6 | clip_gradients: True
7 | batch_size: 1000
8 | curriculum: True
9 | obs_imp: 0.15
10 | task_imp: 0.05
11 | max_curriculums: 7
12 | latent_visualization: False
13 | plot_traj: False
14 | lr: 0.003
15 | save_model: True
16 | loss: 'nll'
17 | data_parallel:
18 | enable: False
19 | device_ids:
20 | - 0
21 |
22 |
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/model/learn/default_rnn.yaml:
--------------------------------------------------------------------------------
1 | name: "_default"
2 | model:
3 | load: False
4 | id: 2e4hzn33
5 | epochs: 750
6 | clip_gradients: True
7 | batch_size: 1000
8 | obs_imp: 0.9
9 | latent_visualization: False
10 | plot_traj: False
11 | lr: 0.001
12 | save_model: True
13 | loss: 'nll'
14 | data_parallel:
15 | enable: False
16 | device_ids:
17 | - 0
18 |
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/platform/horeka.yaml:
--------------------------------------------------------------------------------
1 | # @package _global_
2 |
3 | defaults:
4 | - override /hydra/launcher: submitit_slurm
5 | - _self_
6 |
7 | hydra:
8 | mode: MULTIRUN # needed for launcher to be used
9 | launcher:
10 | # launcher/cluster specific options
11 | timeout_min: 1000
12 | partition: accelerated
13 | gres: gpu:4
14 | additional_parameters:
15 | output: /home/hk-project-robolrn/ft6900/Alr/MTS3/experiments/outputs/tb-%job-name.out
16 | error: /home/hk-project-robolrn/ft6900/Alr/MTS3/experiments/outputs/error-%job-name.out
17 |
18 | # clusterduck specific options
19 | parallel_runs_per_node: 4
20 | resources_config:
21 | cpu:
22 | cuda:
23 | stagger:
24 | delay: 5
25 | sweeper:
26 | params:
27 | +iteration: range(4)
--------------------------------------------------------------------------------
/experiments/frankaKitchen/conf/platform/local.yaml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/experiments/frankaKitchen/conf/platform/local.yaml
--------------------------------------------------------------------------------
/experiments/frankaKitchen/hiprssm_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import numpy as np
8 | import torch
9 | import wandb
10 | import pickle
11 | import gdown
12 |
13 | from experiments.exp_prediction_hiprssm import Experiment
14 | from agent.worldModels import MTS3
15 | from hydra.utils import get_original_cwd, to_absolute_path
16 |
17 |
18 | nn = torch.nn
19 |
20 | @hydra.main(config_path='conf',config_name="config")
21 | def my_app(cfg)->OmegaConf:
22 | global config
23 | model_cfg = cfg
24 | exp = Experiment(model_cfg)
25 |
26 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
27 | ### train the model
28 | mts3_model, wandb_run, save_path = exp._train_world_model(train_obs, train_act, train_targets, test_obs, test_act, test_targets)
29 | ### test the model
30 | #TODO: normalizer format specify
31 | exp._test_world_model(test_obs, test_act, test_targets, normalizer, mts3_model, wandb_run, save_path)
32 |
33 |
34 | class Experiment(Experiment):
35 | def __init__(self, cfg):
36 | super(Experiment, self).__init__(cfg)
37 |
38 | def _load_save_train_test_data(self):
39 | """
40 | write a function to load the data and return the train and test data
41 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
42 | """
43 | ## load the data from pickle and if not present download from the url
44 | if not os.path.exists(get_original_cwd() + self._data_cfg.save_path):
45 | print("..........Data Not Found...........Downloading from URL")
46 | ### download the data from url
47 | url = self._data_cfg.url
48 | output = get_original_cwd() + self._data_cfg.save_path
49 | gdown.download(url, output, quiet=False)
50 | else:
51 | print("..........Data Found...........Loading from local")
52 | with open(get_original_cwd() + self._data_cfg.save_path, 'rb') as f:
53 | data_dict = pickle.load(f)
54 | print("Train Obs Shape", data_dict['train_obs'].shape)
55 | print("Train Act Shape", data_dict['train_act'].shape)
56 | print("Train Targets Shape", data_dict['train_targets'].shape)
57 | print("Test Obs Shape", data_dict['test_obs'].shape)
58 | print("Test Act Shape", data_dict['test_act'].shape)
59 | print("Test Targets Shape", data_dict['test_targets'].shape)
60 | print("Normalizer", data_dict['normalizer'])
61 | return data_dict
62 |
63 | def _get_data_set(self):
64 | """
65 | write a function to load the data and return the train and test data
66 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
67 | """
68 | ### load or generate data
69 | data_dict = self._load_save_train_test_data()
70 |
71 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
72 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
73 |
74 |
75 | def main():
76 | my_app()
77 |
78 |
79 |
80 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
81 | if __name__ == '__main__':
82 | main()
--------------------------------------------------------------------------------
/experiments/frankaKitchen/mts3_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import numpy as np
8 | import torch
9 | import wandb
10 | import pickle
11 | import json
12 | import gdown
13 |
14 | from experiments.exp_prediction_mts3 import Experiment
15 | from agent.worldModels import MTS3
16 | from hydra.utils import get_original_cwd, to_absolute_path
17 |
18 |
19 | nn = torch.nn
20 |
21 | @hydra.main(config_path='conf',config_name="config")
22 | def my_app(cfg)->OmegaConf:
23 | global config
24 | model_cfg = cfg
25 | exp = Experiment(model_cfg)
26 |
27 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
28 | ### train the model
29 | mts3_model, wandb_run, save_path = exp._train_world_model(train_obs, train_act, train_targets, test_obs, test_act, test_targets)
30 | ### test the model
31 | #TODO: normalizer format specify
32 | exp._test_world_model(test_obs, test_act, test_targets, normalizer, mts3_model, wandb_run, save_path)
33 |
34 |
35 | class Experiment(Experiment):
36 | def __init__(self, cfg):
37 | super(Experiment, self).__init__(cfg)
38 |
39 | def _load_save_train_test_data(self):
40 | """
41 | write a function to load the data and return the train and test data
42 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
43 | """
44 | ## load the data from pickle and if not present download from the url
45 | if not os.path.exists(get_original_cwd() + self._data_cfg.save_path):
46 | print("..........Data Not Found...........Downloading from URL")
47 | ### download the data from url
48 | url = self._data_cfg.url
49 | output = get_original_cwd() + self._data_cfg.save_path
50 | gdown.download(url, output, quiet=False)
51 | else:
52 | print("..........Data Found...........Loading from local")
53 | with open(get_original_cwd() + self._data_cfg.save_path, 'rb') as f:
54 | data_dict = pickle.load(f)
55 | print("Train Obs Shape", data_dict['train_obs'].shape)
56 | print("Train Act Shape", data_dict['train_act'].shape)
57 | print("Train Targets Shape", data_dict['train_targets'].shape)
58 | print("Test Obs Shape", data_dict['test_obs'].shape)
59 | print("Test Act Shape", data_dict['test_act'].shape)
60 | print("Test Targets Shape", data_dict['test_targets'].shape)
61 | print("Normalizer", data_dict['normalizer'])
62 | return data_dict
63 |
64 | def _get_data_set(self):
65 | """
66 | write a function to load the data and return the train and test data
67 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
68 | """
69 | ### load or generate data
70 | data_dict = self._load_save_train_test_data()
71 |
72 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
73 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
74 |
75 |
76 | def main():
77 | my_app()
78 |
79 |
80 |
81 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
82 | if __name__ == '__main__':
83 | main()
--------------------------------------------------------------------------------
/experiments/frankaKitchen/rnn_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import numpy as np
8 | import torch
9 | import wandb
10 | import pickle
11 | import gdown
12 |
13 | from experiments.exp_prediction_rnn import Experiment
14 | from agent.worldModels import MTS3
15 | from hydra.utils import get_original_cwd, to_absolute_path
16 |
17 |
18 | nn = torch.nn
19 |
20 | @hydra.main(config_path='conf',config_name="config")
21 | def my_app(cfg)->OmegaConf:
22 | global config
23 | model_cfg = cfg
24 | exp = Experiment(model_cfg)
25 |
26 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
27 | ### train the model
28 | mts3_model, wandb_run, save_path = exp._train_world_model(train_obs, train_act, train_targets, test_obs, test_act, test_targets)
29 | ### test the model
30 | #TODO: normalizer format specify
31 | exp._test_world_model(test_obs, test_act, test_targets, normalizer, mts3_model, wandb_run, save_path)
32 |
33 |
34 | class Experiment(Experiment):
35 | def __init__(self, cfg):
36 | super(Experiment, self).__init__(cfg)
37 |
38 | def _load_save_train_test_data(self):
39 | """
40 | write a function to load the data and return the train and test data
41 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
42 | """
43 | ## load the data from pickle and if not present download from the url
44 | if not os.path.exists(get_original_cwd() + self._data_cfg.save_path):
45 | print("..........Data Not Found...........Downloading from URL")
46 | ### download the data from url
47 | url = self._data_cfg.url
48 | output = get_original_cwd() + self._data_cfg.save_path
49 | gdown.download(url, output, quiet=False)
50 | else:
51 | print("..........Data Found...........Loading from local")
52 | with open(get_original_cwd() + self._data_cfg.save_path, 'rb') as f:
53 | data_dict = pickle.load(f)
54 | print("Train Obs Shape", data_dict['train_obs'].shape)
55 | print("Train Act Shape", data_dict['train_act'].shape)
56 | print("Train Targets Shape", data_dict['train_targets'].shape)
57 | print("Test Obs Shape", data_dict['test_obs'].shape)
58 | print("Test Act Shape", data_dict['test_act'].shape)
59 | print("Test Targets Shape", data_dict['test_targets'].shape)
60 | print("Normalizer", data_dict['normalizer'])
61 | return data_dict
62 |
63 | def _get_data_set(self):
64 | """
65 | write a function to load the data and return the train and test data
66 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
67 | """
68 | ### load or generate data
69 | data_dict = self._load_save_train_test_data()
70 |
71 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
72 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
73 |
74 |
75 | def main():
76 | my_app()
77 |
78 |
79 |
80 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
81 | if __name__ == '__main__':
82 | main()
--------------------------------------------------------------------------------
/experiments/halfCheetah/acrkn_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import numpy as np
8 | import torch
9 | import wandb
10 | import pickle
11 | import gdown
12 |
13 | from experiments.exp_prediction_acrkn import Experiment
14 | from hydra.utils import get_original_cwd
15 |
16 |
17 | nn = torch.nn
18 |
19 | @hydra.main(config_path='conf',config_name="config")
20 | def my_app(cfg)->OmegaConf:
21 | global config
22 | model_cfg = cfg
23 | exp = Experiment(model_cfg)
24 |
25 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
26 | ### train the model
27 | mts3_model, wandb_run, save_path = exp._train_world_model(train_obs, train_act, train_targets, test_obs, test_act, test_targets)
28 | ### test the model
29 | #TODO: normalizer format specify
30 | exp._test_world_model(test_obs, test_act, test_targets, normalizer, mts3_model, wandb_run, save_path)
31 |
32 |
33 | class Experiment(Experiment):
34 | def __init__(self, cfg):
35 | super(Experiment, self).__init__(cfg)
36 |
37 | def _load_save_train_test_data(self):
38 | """
39 | write a function to load the data and return the train and test data
40 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
41 | """
42 | ## load the data from pickle and if not present download from the url
43 | if not os.path.exists(get_original_cwd() + self._data_cfg.save_path):
44 | print("..........Data Not Found...........Downloading from URL")
45 | ### download the data from url
46 | url = self._data_cfg.url
47 | output = get_original_cwd() + self._data_cfg.save_path
48 | gdown.download(url, output, quiet=False)
49 | else:
50 | print("..........Data Found...........Loading from local")
51 | with open(get_original_cwd() + self._data_cfg.save_path, 'rb') as f:
52 | data_dict = pickle.load(f)
53 | print("Train Obs Shape", data_dict['train_obs'].shape)
54 | print("Train Act Shape", data_dict['train_act'].shape)
55 | print("Train Targets Shape", data_dict['train_targets'].shape)
56 | print("Test Obs Shape", data_dict['test_obs'].shape)
57 | print("Test Act Shape", data_dict['test_act'].shape)
58 | print("Test Targets Shape", data_dict['test_targets'].shape)
59 | print("Normalizer", data_dict['normalizer'])
60 | return data_dict
61 |
62 | def _get_data_set(self):
63 | """
64 | write a function to load the data and return the train and test data
65 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
66 | """
67 | ### load or generate data
68 | data_dict = self._load_save_train_test_data()
69 |
70 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
71 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
72 |
73 |
74 | def main():
75 | my_app()
76 |
77 |
78 |
79 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
80 | if __name__ == '__main__':
81 | main()
--------------------------------------------------------------------------------
/experiments/halfCheetah/bash_scripts/test.sh:
--------------------------------------------------------------------------------
1 | python experiments/halfCheetah/mts3_exp.py model=default_mts3 model.wandb.project_name='Test-HalfCheetah-NewCode' model.wandb.exp_name="MTS3" --multirun &
2 | python experiments/halfCheetah/mts3_exp.py model=default_mts3_NoI model.wandb.project_name='Test-HalfCheetah-NewCode' model.wandb.exp_name="MTS3-NoI" --multirun &
3 | python experiments/halfCheetah/acrkn_exp.py model=default_acrkn model.wandb.project_name='Test-HalfCheetah-NewCode' model.wandb.exp_name="acRKN" --multirun &
4 | python experiments/halfCheetah/hiprssm_exp.py model=default_hiprssm model.wandb.project_name='Test-HalfCheetah-NewCode' model.wandb.exp_name="HiP-RSSM" --multirun &
5 | python experiments/halfCheetah/rnn_exp.py model=default_lstm model.wandb.project_name='Test-HalfCheetah-NewCode' model.wandb.exp_name="LSTM" --multirun &
6 | python experiments/halfCheetah/rnn_exp.py model=default_gru model.wandb.project_name='Test-HalfCheetah-NewCode' model.wandb.exp_name="GRU" --multirun
7 |
--------------------------------------------------------------------------------
/experiments/halfCheetah/bash_scripts/test_rkn.sh:
--------------------------------------------------------------------------------
1 | python experiments/mobileRobot/acrkn_exp.py model=default_acrkn model.wandb.project_name='Test-Mobile-NewCode' model.wandb.exp_name="acRKN" --multirun
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/config.yaml:
--------------------------------------------------------------------------------
1 | hydra:
2 | mode: RUN
3 | sweep:
4 | dir: ./sweep_dir
5 |
6 |
7 | defaults:
8 | - model: default_mts3
9 | - platform: local
10 |
11 |
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/data_d4rl.yaml:
--------------------------------------------------------------------------------
1 | type: 'd4rl'
2 | num_training_sequences: 5000 #from a set of given collected train trajectories create this many sub-trajectories for training
3 | num_testing_sequences: 2000 #from a set of given collected test trajectories create this many sub-trajectories for testing
4 | episode_length: 15 #window length for a particular instance of hip-rssm
5 | num_episodes: 24 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
6 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
7 | load: True
8 | save: False
9 | standardize: True
10 | split:
11 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
12 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
13 | shuffle_split: 0.8
14 | save_path: "/dataFolder/mts3_datasets_processed/CheetahNeuripsData.pkl"
15 | url: "https://drive.google.com/uc?id=1MuJBYSNN3D6BRfGp0Eu7Hbz1roKOzcxN"
16 | trajPerTask: 10
17 | downsample: 1
18 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/test/data1_1.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.85
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '1_3'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 24 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: True
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/cheetahWind/conf_dp/data/New13-Test.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/test/data1_1_hip.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.85
2 | task_imp: 0.4
3 | multistep: True
4 | long_term_pred: 1
5 | type: '1_3'
6 | num_training_sequences: 3000 #from a set of given collected train trajectories create this many subtrajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many subtrajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 3 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/mobileRobot/conf_dp/data/sinMixLongTrain.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/test/data240.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.75
2 | task_imp: 0.10
3 | long_term_pred: 1
4 | terrain: 'both240'
5 | frequency: '240'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many subtrajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many subtrajectories for testing
8 | episode_length: 75 #window length for a particular instance of hip-rssm
9 | num_episodes: 6 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'delta' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: null
12 | save: 1
13 | standardize: True
14 | split:
15 | - [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,
16 | 79,91,92,93,94,95,96,97,98,99]
17 | - [30,31,32,33,34,35,36,37,38,39,40,80,81,82,83,84,85,86,87,88,89,90]
18 | shuffle_split: null
19 | file_name: 'MobileWindows'
20 | trajPerTask: 10
21 | downsample: 1
22 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/test/data2_1.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.9
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '2_3'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 24 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: True
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/cheetahWind/conf_dp/data/New23-Test.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/test/data2_1_hip.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.9
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '2_3'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 3 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/cheetahWind/conf_dp/data/New22-Testhip.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/test/data31_30_12.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.98
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '3_1'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 20 #window length for a particular instance of hip-rssm
9 | num_episodes: 12 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: True
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/cheetahWind/conf_dp/data/New33-30-12-Test.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/test/data3_1.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.85
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '3_1'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 24 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/cheetahWind/conf_dp/data/New31-Test.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/test/data3_1_hip.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.85
2 | task_imp: 0.4
3 | multistep: True
4 | long_term_pred: 1
5 | type: '3_1'
6 | num_training_sequences: 15000 #from a set of given collected train trajectories create this many subtrajectories for training
7 | num_testing_sequences: 5000 #from a set of given collected test trajectories create this many subtrajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 3 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/mobileRobot/conf_dp/data/sinMixLongTrain.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/test/data3_3.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.9
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '3_3'
6 | num_training_sequences: 600 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 100 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 24 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: True
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/mobileRobot/conf_dp/data/New33-Test.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/test/data3_3_hip.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.9
2 | task_imp: 0.4
3 | multistep: True
4 | long_term_pred: 1
5 | type: '3_3'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many subtrajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many subtrajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 3 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'delta' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/mobileRobot/conf_dp/data/sinMixLongTrain.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/test/data500.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.75
2 | task_imp: 0.10
3 | long_term_pred: 1
4 | terrain: 'both500'
5 | frequency: '500'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many subtrajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many subtrajectories for testing
8 | episode_length: 150 #window length for a particular instance of hip-rssm
9 | num_episodes: 6 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'delta' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: null
12 | save: 1
13 | standardize: True
14 | split:
15 | - [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,
16 | 79,91,92,93,94,95,96,97,98,99]
17 | - [30,31,32,33,34,35,36,37,38,39,40,80,81,82,83,84,85,86,87,88,89]
18 | shuffle_split: null
19 | file_name: 'MobileWindows'
20 | trajPerTask: 10
21 | downsample: 1
22 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/test/data_0.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.85
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '0'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 1000 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 24 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: True
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.7
18 | save_path: "/experiments/cheetahWind/conf_dp/data/0-Test.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/test/data_3.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.85
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '3'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 1000 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 24 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: True
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.7
18 | save_path: "/experiments/cheetahWind/conf_dp/data/3-Test.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/test/data_d4rl.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.85
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '3'
6 | num_training_sequences: 5000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 2000 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 24 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/cheetahWind/conf_dp/data/d4rl-1k.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/train/data1_1.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.85
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '1_3'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 24 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: True
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/cheetahWind/conf_dp/data/New13-Train.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/train/data1_1_hip.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.85
2 | task_imp: 0.4
3 | multistep: True
4 | long_term_pred: 1
5 | type: '1_3'
6 | num_training_sequences: 3000 #from a set of given collected train trajectories create this many subtrajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many subtrajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 3 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/mobileRobot/conf_dp/data/wind3_1Train.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/train/data240.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.75
2 | task_imp: 0.10
3 | long_term_pred: 1
4 | terrain: 'both240'
5 | frequency: '240'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many subtrajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many subtrajectories for testing
8 | episode_length: 75 #window length for a particular instance of hip-rssm
9 | num_episodes: 6 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'delta' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: null
12 | save: 1
13 | standardize: True
14 | split:
15 | - [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,
16 | 79,91,92,93,94,95,96,97,98,99]
17 | - [30,31,32,33,34,35,36,37,38,39,40,80,81,82,83,84,85,86,87,88,89,90]
18 | shuffle_split: null
19 | file_name: 'MobileWindows'
20 | trajPerTask: 10
21 | downsample: 1
22 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/train/data250.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.75
2 | task_imp: 0.10
3 | long_term_pred: 1
4 | terrain: 'both240'
5 | frequency: '240'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many subtrajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many subtrajectories for testing
8 | episode_length: 150 #window length for a particular instance of hip-rssm
9 | num_episodes: 6 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'delta' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: null
12 | save: 1
13 | standardize: True
14 | split:
15 | - [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,
16 | 79,91,92,93,94,95,96,97,98,99]
17 | - [30,31,32,33,34,35,36,37,38,39,40,80,81,82,83,84,85,86,87,88,89]
18 | shuffle_split: null
19 | file_name: 'MobileWindows'
20 | trajPerTask: 10
21 | downsample: 1
22 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/train/data2_1.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.9
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '2_3'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 24 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: True
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/cheetahWind/conf_dp/data/New23-Train.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/train/data2_1_hip.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.9
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '2_3'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 3 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/cheetahWind/conf_dp/data/New22-Trainhip.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/train/data31_30_12.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.98
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '3_1'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 20 #window length for a particular instance of hip-rssm
9 | num_episodes: 12 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: True
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/cheetahWind/conf_dp/data/New33-30-12-Train.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/train/data3_1.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.85
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '3_1'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 24 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: True
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/cheetahWind/conf_dp/data/New31-Train.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/train/data3_1_hip.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.5
2 | task_imp: 0.4
3 | multistep: True
4 | long_term_pred: 1
5 | type: '3_1'
6 | num_training_sequences: 15000 #from a set of given collected train trajectories create this many subtrajectories for training
7 | num_testing_sequences: 5000 #from a set of given collected test trajectories create this many subtrajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 3 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/mobileRobot/conf_dp/data/sinMixLongTrain.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/train/data3_3.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.9
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '3_3'
6 | num_training_sequences: 600 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 100 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 24 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: True
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/mobileRobot/conf_dp/data/New33-Train.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/train/data3_3_hip.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.9
2 | task_imp: 0.4
3 | multistep: True
4 | long_term_pred: 1
5 | type: '3_3'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many subtrajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many subtrajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 3 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'delta' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/mobileRobot/conf_dp/data/sinMixLongTrain.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/train/data500.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.75
2 | task_imp: 0.10
3 | long_term_pred: 1
4 | terrain: 'both500'
5 | frequency: '500'
6 | num_training_sequences: 1000 #from a set of given collected train trajectories create this many subtrajectories for training
7 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many subtrajectories for testing
8 | episode_length: 150 #window length for a particular instance of hip-rssm
9 | num_episodes: 6 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'delta' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: null
12 | save: 1
13 | standardize: True
14 | split:
15 | - [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,
16 | 79,91,92,93,94,95,96,97,98,99]
17 | - [30,31,32,33,34,35,36,37,38,39,40,80,81,82,83,84,85,86,87,88,89]
18 | shuffle_split: null
19 | file_name: 'MobileWindows'
20 | trajPerTask: 10
21 | downsample: 1
22 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/train/data_0.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.85
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '0'
6 | num_training_sequences: 2000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 1000 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 24 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: True
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.7
18 | save_path: "/experiments/cheetahWind/conf_dp/data/0-Train.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/train/data_3.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.85
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: '3'
6 | num_training_sequences: 5000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 2000 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 24 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: False
12 | save: True
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/cheetahWind/conf_dp/data/d4rl-2k.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/data/train/data_d4rl.yaml:
--------------------------------------------------------------------------------
1 | obs_imp: 0.65
2 | task_imp: 0.4
3 | multistep: False
4 | long_term_pred: 1
5 | type: 'd4rl'
6 | num_training_sequences: 5000 #from a set of given collected train trajectories create this many sub-trajectories for training
7 | num_testing_sequences: 2000 #from a set of given collected test trajectories create this many sub-trajectories for testing
8 | episode_length: 15 #window length for a particular instance of hip-rssm
9 | num_episodes: 24 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
10 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
11 | load: True
12 | save: False
13 | standardize: True
14 | split:
15 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
16 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
17 | shuffle_split: 0.8
18 | save_path: "/experiments/cheetahWind/conf_dp/data/CheetahNeuripsData.pkl"
19 | trajPerTask: 10
20 | downsample: 1
21 | episodic: False
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/default_acrkn.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default_acrkn
3 | - data: data_d4rl
4 |
5 | wandb:
6 | log: True
7 | project_name: 'debugMobileRobot'
8 | exp_name: 'acrkn'
9 | sweep: False
10 | sweep_id: null
11 |
12 | acrkn:
13 | latent_obs_dim: 30 #for contextual rssm
14 | pixel_obs: False
15 | initial_state_covar: 10 ## for both hierarchies same (chaneg later ??)
16 |
17 | worker:
18 | addIdentity: True
19 | bandwidth: 3
20 | decode_var: True
21 | obs_encoder:
22 | hidden_units_list: [ 120 ]
23 | out_norm: 'post'
24 | variance_activation: 'softplus'
25 | trans_net_hidden_units: [ ]
26 | control_net_hidden_units: [ 120 ]
27 | process_noise_hidden_units: [ 30 ]
28 | trans_net_hidden_activation: "Tanh"
29 | control_net_hidden_activation: 'ReLU'
30 | process_noise_hidden_activation: 'ReLU'
31 | task_net_hidden_activation: 'ReLU'
32 | learn_trans_covar: True
33 | decoder_conditioning: False
34 | multi_gaussian_l_transform: False
35 | trans_covar: 0.1
36 | learn_initial_state_covar: False
37 | initial_state_covar: 10
38 | clip_gradients: True
39 | obs_decoder:
40 | hidden_units_list: [ 240 ]
41 | out_norm: 'post'
42 | variance_activation: 'softplus'
43 |
44 | decode:
45 | reward: False
46 | obs: True
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/default_gru.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default_acrkn
3 | - data: data_d4rl
4 |
5 | wandb:
6 | log: True
7 | project_name: 'debugMobileRobot'
8 | exp_name: 'acrkn'
9 | sweep: False
10 | sweep_id: null
11 |
12 | rnn:
13 | type: 'gru'
14 | latent_obs_dim: 30 #for contextual rssm
15 | pixel_obs: False
16 | decode_var: True
17 | enc_out_norm: True
18 | obs_encoder:
19 | hidden_units_list: [ 240 ]
20 | out_norm: 'post'
21 | variance_activation: 'softplus'
22 | act_encoder:
23 | hidden_units_list: [ 120 ]
24 | out_norm: 'post'
25 | variance_activation: 'softplus'
26 | encoder:
27 | hidden_units_list: [ 120 ]
28 | out_norm: 'post'
29 | variance_activation: 'softplus'
30 | obs_decoder:
31 | hidden_units_list: [ 240 ]
32 | out_norm: 'post'
33 | variance_activation: 'softplus'
34 |
35 | decode:
36 | reward: False
37 | obs: True
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/default_hiprssm.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default_acrkn
3 | - data: data_d4rl
4 |
5 | wandb:
6 | log: True
7 | project_name: 'debugMobileRobot'
8 | exp_name: 'hiprssm'
9 | sweep: False
10 | sweep_id: null
11 |
12 | hiprssm:
13 | context_len: 30
14 | clip_gradients: True
15 | latent_obs_dim: 15 #for contextual rssm
16 | pixel_obs: False
17 | initial_state_covar: 10 ## (chaneg later ??)
18 | initial_task_covar: 1 ## (chaneg later ??)
19 |
20 | worker:
21 | addIdentity: True
22 | bandwidth: 3
23 | decode_var: True
24 | obs_encoder:
25 | hidden_units_list: [ 120 ]
26 | out_norm: 'post'
27 | variance_activation: 'softplus'
28 | task_encoder:
29 | hidden_units_list: [ 240 ]
30 | out_norm: 'post'
31 | variance_activation: 'softplus'
32 | trans_net_hidden_units: [ ]
33 | control_net_hidden_units: [ 120 ]
34 | process_noise_hidden_units: [ 30 ]
35 | trans_net_hidden_activation: "Tanh"
36 | control_net_hidden_activation: 'ReLU'
37 | process_noise_hidden_activation: 'ReLU'
38 | task_net_hidden_activation: 'ReLU'
39 | learn_trans_covar: True
40 | decoder_conditioning: False
41 | multi_gaussian_l_transform: False
42 | trans_covar: 0.1
43 | learn_initial_state_covar: False
44 | initial_state_covar: 10
45 | clip_gradients: True
46 | obs_decoder:
47 | hidden_units_list: [ 240 ]
48 | out_norm: 'post'
49 | variance_activation: 'softplus'
50 |
51 | decode:
52 | reward: False
53 | obs: True
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/default_lstm.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default_acrkn
3 | - data: data_d4rl
4 |
5 | wandb:
6 | log: True
7 | project_name: 'debugMobileRobot'
8 | exp_name: 'acrkn'
9 | sweep: False
10 | sweep_id: null
11 |
12 | rnn:
13 | type: 'lstm'
14 | latent_obs_dim: 30 #for contextual rssm
15 | pixel_obs: False
16 | decode_var: True
17 | enc_out_norm: True
18 | obs_encoder:
19 | hidden_units_list: [ 240 ]
20 | out_norm: 'post'
21 | variance_activation: 'softplus'
22 | act_encoder:
23 | hidden_units_list: [ 120 ]
24 | out_norm: 'post'
25 | variance_activation: 'softplus'
26 | encoder:
27 | hidden_units_list: [ 120 ]
28 | out_norm: 'post'
29 | variance_activation: 'softplus'
30 | obs_decoder:
31 | hidden_units_list: [ 240 ]
32 | out_norm: 'post'
33 | variance_activation: 'softplus'
34 |
35 | decode:
36 | reward: False
37 | obs: True
38 |
39 |
40 |
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/default_mts3.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default
3 | - data: data_d4rl
4 |
5 | wandb:
6 | log: True
7 | project_name: 'debugMobileRobot'
8 | exp_name: 'mts3_new'
9 | sweep: False
10 | sweep_id: null
11 |
12 | mts3:
13 | clip_gradients: True
14 | latent_obs_dim: 30 #for contextual rssm
15 | pixel_obs: False
16 | time_scale_multiplier: 15
17 | initial_state_covar: 10 ## for both hierarchies same (chaneg later ??)
18 | manager:
19 | bandwidth: 3
20 | process_noise_hidden_units: [ 30 ]
21 | trans_net_hidden_activation: "Tanh"
22 | process_noise_hidden_activation: 'ReLU'
23 | learn_trans_covar: True
24 | multi_gaussian_l_transform: False
25 | trans_covar: 0.1
26 | learn_initial_state_covar: False
27 | initial_state_covar: 10
28 | abstract_obs_encoder:
29 | hidden_units_list: [ 240 ]
30 | out_norm: 'none'
31 | variance_activation: 'softplus'
32 | learn_initial_state_covar: False
33 | initial_state_covar: 10
34 | state_abs: True
35 | time_embed:
36 | type: "time"
37 | dim: 1
38 | abstract_act_encoder:
39 | hidden_units_list: [ 240 ]
40 | aggregator: 'BA'
41 | out_norm: 'none'
42 | variance_activation: 'softplus'
43 | learn_initial_state_covar: False
44 | initial_state_covar: 10
45 | state_abs: True
46 | time_embed:
47 | type: "time"
48 | dim: 1
49 |
50 | worker:
51 | bandwidth: 3
52 | decode_var: True
53 | obs_encoder:
54 | hidden_units_list: [ 120 ]
55 | out_norm: 'none'
56 | variance_activation: 'softplus'
57 | trans_net_hidden_units: [ ]
58 | control_net_hidden_units: [ 120 ]
59 | task_net_hidden_units: [ 120 ]
60 | process_noise_hidden_units: [ 30 ]
61 | trans_net_hidden_activation: "Tanh"
62 | control_net_hidden_activation: 'ReLU'
63 | process_noise_hidden_activation: 'ReLU'
64 | task_net_hidden_activation: 'ReLU'
65 | learn_trans_covar: True
66 | trans_covar: 0.1
67 | learn_initial_state_covar: False
68 | initial_state_covar: 10
69 | clip_gradients: True
70 | obs_decoder:
71 | hidden_units_list: [ 240 ]
72 | variance_activation: 'softplus'
73 |
74 | decode:
75 | reward: False
76 | obs: True
77 |
78 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/learn/default.yaml:
--------------------------------------------------------------------------------
1 | name: "_default"
2 | model:
3 | load: False
4 | id: 2e4hzn33
5 | epochs: 1500
6 | clip_gradients: True
7 | batch_size: 1500
8 | curriculum: True
9 | obs_imp: 0.15
10 | task_imp: 0.05
11 | max_curriculums: 7
12 | latent_visualization: False
13 | plot_traj: False
14 | lr: 0.003
15 | save_model: True
16 | loss: 'nll'
17 | data_parallel:
18 | enable: False
19 | device_ids:
20 | - 0
21 |
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/learn/default_acrkn.yaml:
--------------------------------------------------------------------------------
1 | name: "_default"
2 | model:
3 | load: False
4 | id: 2e4hzn33
5 | epochs: 1500
6 | clip_gradients: True
7 | batch_size: 1000
8 | obs_imp: 0.9
9 | latent_visualization: False
10 | plot_traj: False
11 | lr: 0.001
12 | save_model: True
13 | loss: 'nll'
14 | data_parallel:
15 | enable: False
16 | device_ids:
17 | - 0
18 |
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/model/learn/default_rnn.yaml:
--------------------------------------------------------------------------------
1 | name: "_default"
2 | model:
3 | load: False
4 | id: 2e4hzn33
5 | epochs: 1500
6 | clip_gradients: True
7 | batch_size: 1000
8 | obs_imp: 0.9
9 | latent_visualization: False
10 | plot_traj: False
11 | lr: 0.001
12 | save_model: True
13 | loss: 'nll'
14 | data_parallel:
15 | enable: False
16 | device_ids:
17 | - 0
18 |
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/platform/horeka.yaml:
--------------------------------------------------------------------------------
1 | # @package _global_
2 |
3 | defaults:
4 | - override /hydra/launcher: clusterduck_slurm
5 | - _self_
6 |
7 | hydra:
8 | mode: MULTIRUN # needed for launcher to be used
9 | launcher:
10 | # launcher/cluster specific options
11 | timeout_min: 1000
12 | partition: accelerated
13 | gres: gpu:4
14 | additional_parameters:
15 | output: /home/hk-project-robolrn/ft6900/Alr/MTS3/experiments/outputs/tb-%job-name.out
16 | error: /home/hk-project-robolrn/ft6900/Alr/MTS3/experiments/outputs/error-%job-name.out
17 |
18 | # clusterduck specific options
19 | parallel_runs_per_node: 4
20 | resources_config:
21 | cpu:
22 | cuda:
23 | stagger:
24 | delay: 5
25 | sweeper:
26 | params:
27 | +iteration: range(4)
--------------------------------------------------------------------------------
/experiments/halfCheetah/conf/platform/local.yaml:
--------------------------------------------------------------------------------
1 | # @package _global_
2 |
3 | defaults:
4 | - _self_
5 |
6 | hydra:
7 | mode: RUN # needed for launcher to be used
8 |
--------------------------------------------------------------------------------
/experiments/halfCheetah/hiprssm_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import numpy as np
8 | import torch
9 | import wandb
10 | import pickle
11 | import gdown
12 |
13 | from experiments.exp_prediction_hiprssm import Experiment
14 | from hydra.utils import get_original_cwd
15 |
16 |
17 | nn = torch.nn
18 |
19 | @hydra.main(config_path='conf',config_name="config")
20 | def my_app(cfg)->OmegaConf:
21 | global config
22 | model_cfg = cfg
23 | exp = Experiment(model_cfg)
24 |
25 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
26 | ### train the model
27 | mts3_model, wandb_run, save_path = exp._train_world_model(train_obs, train_act, train_targets, test_obs, test_act, test_targets)
28 | ### test the model
29 | #TODO: normalizer format specify
30 | exp._test_world_model(test_obs, test_act, test_targets, normalizer, mts3_model, wandb_run, save_path)
31 |
32 |
33 | class Experiment(Experiment):
34 | def __init__(self, cfg):
35 | super(Experiment, self).__init__(cfg)
36 |
37 | def _load_save_train_test_data(self):
38 | """
39 | write a function to load the data and return the train and test data
40 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
41 | """
42 | ## load the data from pickle and if not present download from the url
43 | if not os.path.exists(get_original_cwd() + self._data_cfg.save_path):
44 | print("..........Data Not Found...........Downloading from URL")
45 | ### download the data from url
46 | url = self._data_cfg.url
47 | output = get_original_cwd() + self._data_cfg.save_path
48 | gdown.download(url, output, quiet=False)
49 | else:
50 | print("..........Data Found...........Loading from local")
51 | with open(get_original_cwd() + self._data_cfg.save_path, 'rb') as f:
52 | data_dict = pickle.load(f)
53 | print("Train Obs Shape", data_dict['train_obs'].shape)
54 | print("Train Act Shape", data_dict['train_act'].shape)
55 | print("Train Targets Shape", data_dict['train_targets'].shape)
56 | print("Test Obs Shape", data_dict['test_obs'].shape)
57 | print("Test Act Shape", data_dict['test_act'].shape)
58 | print("Test Targets Shape", data_dict['test_targets'].shape)
59 | print("Normalizer", data_dict['normalizer'])
60 | return data_dict
61 |
62 | def _get_data_set(self):
63 | """
64 | write a function to load the data and return the train and test data
65 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
66 | """
67 | ### load or generate data
68 | data_dict = self._load_save_train_test_data()
69 |
70 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
71 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
72 |
73 |
74 | def main():
75 | my_app()
76 |
77 |
78 |
79 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
80 | if __name__ == '__main__':
81 | main()
--------------------------------------------------------------------------------
/experiments/halfCheetah/mts3_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import torch
8 | import pickle
9 | import gdown
10 |
11 | from experiments.exp_prediction_mts3 import Experiment
12 | from hydra.utils import get_original_cwd
13 |
14 |
15 | nn = torch.nn
16 |
17 | @hydra.main(config_path='conf',config_name="config")
18 | def my_app(cfg)->OmegaConf:
19 | global config
20 | model_cfg = cfg
21 | exp = Experiment(model_cfg)
22 |
23 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
24 | ### train the model
25 | mts3_model, wandb_run, save_path = exp._train_world_model(train_obs, train_act, train_targets, test_obs, test_act, test_targets)
26 | ### test the model
27 | #TODO: normalizer format specify
28 | exp._test_world_model(test_obs, test_act, test_targets, normalizer, mts3_model, wandb_run, save_path)
29 |
30 |
31 | class Experiment(Experiment):
32 | def __init__(self, cfg):
33 | super(Experiment, self).__init__(cfg)
34 |
35 | def _load_save_train_test_data(self):
36 | """
37 | write a function to load the data and return the train and test data
38 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
39 | """
40 | ## load the data from pickle and if not present download from the url
41 | if not os.path.exists(get_original_cwd() + self._data_cfg.save_path):
42 | print("..........Data Not Found...........Downloading from URL")
43 | ### download the data from url
44 | url = self._data_cfg.url
45 | output = get_original_cwd() + self._data_cfg.save_path
46 | gdown.download(url, output, quiet=False)
47 | else:
48 | print("..........Data Found...........Loading from local")
49 | with open(get_original_cwd() + self._data_cfg.save_path, 'rb') as f:
50 | data_dict = pickle.load(f)
51 | print("Train Obs Shape", data_dict['train_obs'].shape)
52 | print("Train Act Shape", data_dict['train_act'].shape)
53 | print("Train Targets Shape", data_dict['train_targets'].shape)
54 | print("Test Obs Shape", data_dict['test_obs'].shape)
55 | print("Test Act Shape", data_dict['test_act'].shape)
56 | print("Test Targets Shape", data_dict['test_targets'].shape)
57 | print("Normalizer", data_dict['normalizer'])
58 | return data_dict
59 |
60 | def _get_data_set(self):
61 | """
62 | write a function to load the data and return the train and test data
63 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
64 | """
65 | ### load or generate data
66 | data_dict = self._load_save_train_test_data()
67 |
68 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
69 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
70 |
71 |
72 | def main():
73 | my_app()
74 |
75 |
76 |
77 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
78 | if __name__ == '__main__':
79 | main()
--------------------------------------------------------------------------------
/experiments/halfCheetah/rnn_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import numpy as np
8 | import torch
9 | import wandb
10 | import pickle
11 | import gdown
12 |
13 | from experiments.exp_prediction_rnn import Experiment
14 | from hydra.utils import get_original_cwd
15 |
16 |
17 | nn = torch.nn
18 |
19 | @hydra.main(config_path='conf',config_name="config")
20 | def my_app(cfg)->OmegaConf:
21 | global config
22 | model_cfg = cfg
23 | exp = Experiment(model_cfg)
24 |
25 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
26 | ### train the model
27 | mts3_model, wandb_run, save_path = exp._train_world_model(train_obs, train_act, train_targets, test_obs, test_act, test_targets)
28 | ### test the model
29 | #TODO: normalizer format specify
30 | exp._test_world_model(test_obs, test_act, test_targets, normalizer, mts3_model, wandb_run, save_path)
31 |
32 |
33 | class Experiment(Experiment):
34 | def __init__(self, cfg):
35 | super(Experiment, self).__init__(cfg)
36 |
37 | def _load_save_train_test_data(self):
38 | """
39 | write a function to load the data and return the train and test data
40 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
41 | """
42 | ## load the data from pickle and if not present download from the url
43 | if not os.path.exists(get_original_cwd() + self._data_cfg.save_path):
44 | print("..........Data Not Found...........Downloading from URL")
45 | ### download the data from url
46 | url = self._data_cfg.url
47 | output = get_original_cwd() + self._data_cfg.save_path
48 | gdown.download(url, output, quiet=False)
49 | else:
50 | print("..........Data Found...........Loading from local")
51 | with open(get_original_cwd() + self._data_cfg.save_path, 'rb') as f:
52 | data_dict = pickle.load(f)
53 | print("Train Obs Shape", data_dict['train_obs'].shape)
54 | print("Train Act Shape", data_dict['train_act'].shape)
55 | print("Train Targets Shape", data_dict['train_targets'].shape)
56 | print("Test Obs Shape", data_dict['test_obs'].shape)
57 | print("Test Act Shape", data_dict['test_act'].shape)
58 | print("Test Targets Shape", data_dict['test_targets'].shape)
59 | print("Normalizer", data_dict['normalizer'])
60 | return data_dict
61 |
62 | def _get_data_set(self):
63 | """
64 | write a function to load the data and return the train and test data
65 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
66 | """
67 | ### load or generate data
68 | data_dict = self._load_save_train_test_data()
69 |
70 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
71 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
72 |
73 |
74 | def main():
75 | my_app()
76 |
77 |
78 |
79 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
80 | if __name__ == '__main__':
81 | main()
--------------------------------------------------------------------------------
/experiments/maze2d/acrkn_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import numpy as np
8 | import torch
9 | import wandb
10 | import pickle
11 | import gdown
12 |
13 | from experiments.exp_prediction_acrkn import Experiment
14 | from hydra.utils import get_original_cwd
15 |
16 |
17 | nn = torch.nn
18 |
19 | @hydra.main(config_path='conf',config_name="config")
20 | def my_app(cfg)->OmegaConf:
21 | global config
22 | model_cfg = cfg
23 | exp = Experiment(model_cfg)
24 |
25 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
26 | ### train the model
27 | mts3_model, wandb_run, save_path = exp._train_world_model(train_obs, train_act, train_targets, test_obs, test_act, test_targets)
28 | ### test the model
29 | #TODO: normalizer format specify
30 | exp._test_world_model(test_obs, test_act, test_targets, normalizer, mts3_model, wandb_run, save_path)
31 |
32 |
33 | class Experiment(Experiment):
34 | def __init__(self, cfg):
35 | super(Experiment, self).__init__(cfg)
36 |
37 | def _load_save_train_test_data(self):
38 | """
39 | write a function to load the data and return the train and test data
40 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
41 | """
42 | ## load the data from pickle and if not present download from the url
43 | if not os.path.exists(get_original_cwd() + self._data_cfg.save_path):
44 | print("..........Data Not Found...........Downloading from URL")
45 | ### download the data from url
46 | url = self._data_cfg.url
47 | output = get_original_cwd() + self._data_cfg.save_path
48 | gdown.download(url, output, quiet=False)
49 | else:
50 | print("..........Data Found...........Loading from local")
51 | with open(get_original_cwd() + self._data_cfg.save_path, 'rb') as f:
52 | data_dict = pickle.load(f)
53 | print("Train Obs Shape", data_dict['train_obs'].shape)
54 | print("Train Act Shape", data_dict['train_act'].shape)
55 | print("Train Targets Shape", data_dict['train_targets'].shape)
56 | print("Test Obs Shape", data_dict['test_obs'].shape)
57 | print("Test Act Shape", data_dict['test_act'].shape)
58 | print("Test Targets Shape", data_dict['test_targets'].shape)
59 | print("Normalizer", data_dict['normalizer'])
60 | return data_dict
61 |
62 | def _get_data_set(self):
63 | """
64 | write a function to load the data and return the train and test data
65 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
66 | """
67 | ### load or generate data
68 | data_dict = self._load_save_train_test_data()
69 |
70 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
71 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
72 |
73 |
74 | def main():
75 | my_app()
76 |
77 |
78 |
79 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
80 | if __name__ == '__main__':
81 | main()
--------------------------------------------------------------------------------
/experiments/maze2d/bash_scripts/test.sh:
--------------------------------------------------------------------------------
1 | #python experiments/maze2d/mts3_exp.py model=default_mts3 model.wandb.project_name='Test-Maze2d-NewCode' model.wandb.exp_name="MTS3" --multirun &
2 | python experiments/maze2d/mts3_exp.py model=default_mts3_NoI model.wandb.project_name='Test-Maze2d-NewCode' model.wandb.exp_name="MTS3-NoI" --multirun &
3 | python experiments/maze2d/acrkn_exp.py model=default_acrkn model.wandb.project_name='Test-Maze2d-NewCode' model.wandb.exp_name="acRKN" --multirun &
4 | python experiments/maze2d/hiprssm_exp.py model=default_hiprssm model.wandb.project_name='Test-Maze2d-NewCode' model.wandb.exp_name="HiP-RSSM" --multirun &
5 | python experiments/maze2d/rnn_exp.py model=default_lstm model.wandb.project_name='Test-Maze2d-NewCode' model.wandb.exp_name="LSTM" --multirun &
6 | python experiments/maze2d/rnn_exp.py model=default_gru model.wandb.project_name='Test-Maze2d-NewCode' model.wandb.exp_name="GRU" --multirun
7 |
--------------------------------------------------------------------------------
/experiments/maze2d/bash_scripts/test_rkn.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/experiments/maze2d/bash_scripts/test_rkn.sh
--------------------------------------------------------------------------------
/experiments/maze2d/conf/config.yaml:
--------------------------------------------------------------------------------
1 | hydra:
2 | mode: RUN
3 | sweep:
4 | dir: ./sweep_dir
5 |
6 |
7 | defaults:
8 | - model: default_mts3
9 | - platform: local
10 |
11 |
--------------------------------------------------------------------------------
/experiments/maze2d/conf/model/data/data_medium.yaml:
--------------------------------------------------------------------------------
1 | type: 'medium'
2 | num_training_sequences: 30000 #from a set of given collected train trajectories create this many sub-trajectories for training
3 | num_testing_sequences: 10000 #from a set of given collected test trajectories create this many sub-trajectories for testing
4 | episode_length: 30 #window length for a particular instance of hip-rssm
5 | num_episodes: 15 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
6 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
7 | load: True
8 | save: False
9 | standardize: True
10 | shuffle_split: 0.8
11 | save_path: "/dataFolder/mts3_datasets_processed/mediumMaze.pkl"
12 | url: "https://drive.google.com/uc?id=1fwrLrV_28832OYat4YpWuNl51MEXbKlq"
13 | trajPerTask: 10
14 | downsample: 1
15 | episodic: False
16 |
--------------------------------------------------------------------------------
/experiments/maze2d/conf/model/default_acrkn.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default_acrkn
3 | - data: data_medium
4 |
5 | wandb:
6 | log: True
7 | project_name: 'debugMaze'
8 | exp_name: 'acrkn'
9 | sweep: False
10 | sweep_id: null
11 |
12 | acrkn:
13 | latent_obs_dim: 30 #for contextual rssm
14 | pixel_obs: False
15 | initial_state_covar: 10 ## for both hierarchies same (chaneg later ??)
16 |
17 | worker:
18 | addIdentity: True
19 | bandwidth: 3
20 | decode_var: True
21 | obs_encoder:
22 | hidden_units_list: [ 120 ]
23 | out_norm: 'post'
24 | variance_activation: 'softplus'
25 | trans_net_hidden_units: [ ]
26 | control_net_hidden_units: [ 120 ]
27 | process_noise_hidden_units: [ 30 ]
28 | trans_net_hidden_activation: "Tanh"
29 | control_net_hidden_activation: 'ReLU'
30 | process_noise_hidden_activation: 'ReLU'
31 | task_net_hidden_activation: 'ReLU'
32 | learn_trans_covar: True
33 | decoder_conditioning: False
34 | multi_gaussian_l_transform: False
35 | trans_covar: 0.1
36 | learn_initial_state_covar: False
37 | initial_state_covar: 10
38 | clip_gradients: True
39 | obs_decoder:
40 | hidden_units_list: [ 240 ]
41 | out_norm: 'post'
42 | variance_activation: 'softplus'
43 |
44 | decode:
45 | reward: False
46 | obs: True
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/experiments/maze2d/conf/model/default_gru.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default_acrkn
3 | - data: data_medium
4 | wandb:
5 | log: True
6 | project_name: 'debugMaze'
7 | exp_name: 'acrkn'
8 | sweep: False
9 | sweep_id: null
10 |
11 | rnn:
12 | type: 'gru'
13 | latent_obs_dim: 30 #for contextual rssm
14 | pixel_obs: False
15 | decode_var: True
16 | enc_out_norm: True
17 | obs_encoder:
18 | hidden_units_list: [ 120 ]
19 | out_norm: 'post'
20 | variance_activation: 'softplus'
21 | act_encoder:
22 | hidden_units_list: [ 120 ]
23 | out_norm: 'post'
24 | variance_activation: 'softplus'
25 | encoder:
26 | hidden_units_list: [ 120 ]
27 | out_norm: 'post'
28 | variance_activation: 'softplus'
29 | obs_decoder:
30 | hidden_units_list: [ 240 ]
31 | out_norm: 'post'
32 | variance_activation: 'softplus'
33 |
34 | decode:
35 | reward: False
36 | obs: True
37 |
--------------------------------------------------------------------------------
/experiments/maze2d/conf/model/default_hiprssm.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default_acrkn
3 | - data: data_medium
4 |
5 | wandb:
6 | log: True
7 | project_name: 'debugMaze'
8 | exp_name: 'hiprssm'
9 | sweep: False
10 | sweep_id: null
11 |
12 | hiprssm:
13 | context_len: 30
14 | clip_gradients: True
15 | latent_obs_dim: 30 #for contextual rssm
16 | pixel_obs: False
17 | initial_state_covar: 10 ## (chaneg later ??)
18 | initial_task_covar: 1 ## (chaneg later ??)
19 |
20 | worker:
21 | addIdentity: True
22 | bandwidth: 3
23 | decode_var: True
24 | obs_encoder:
25 | hidden_units_list: [ 120 ]
26 | out_norm: 'post'
27 | variance_activation: 'softplus'
28 | task_encoder:
29 | hidden_units_list: [ 240 ]
30 | out_norm: 'post'
31 | variance_activation: 'softplus'
32 | trans_net_hidden_units: [ ]
33 | control_net_hidden_units: [ 120 ]
34 | process_noise_hidden_units: [ 30 ]
35 | trans_net_hidden_activation: "Tanh"
36 | control_net_hidden_activation: 'ReLU'
37 | process_noise_hidden_activation: 'ReLU'
38 | task_net_hidden_activation: 'ReLU'
39 | learn_trans_covar: True
40 | decoder_conditioning: False
41 | multi_gaussian_l_transform: False
42 | trans_covar: 0.1
43 | learn_initial_state_covar: False
44 | initial_state_covar: 10
45 | clip_gradients: True
46 | obs_decoder:
47 | hidden_units_list: [ 240 ]
48 | out_norm: 'post'
49 | variance_activation: 'softplus'
50 |
51 | decode:
52 | reward: False
53 | obs: True
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/experiments/maze2d/conf/model/default_lstm.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default_acrkn
3 | - data: data_medium
4 |
5 | wandb:
6 | log: True
7 | project_name: 'debugMaze'
8 | exp_name: 'acrkn'
9 | sweep: False
10 | sweep_id: null
11 |
12 | rnn:
13 | type: 'lstm'
14 | latent_obs_dim: 30 #for contextual rssm
15 | pixel_obs: False
16 | decode_var: True
17 | enc_out_norm: True
18 | obs_encoder:
19 | hidden_units_list: [ 120 ]
20 | out_norm: 'post'
21 | variance_activation: 'softplus'
22 | act_encoder:
23 | hidden_units_list: [ 120 ]
24 | out_norm: 'post'
25 | variance_activation: 'softplus'
26 | encoder:
27 | hidden_units_list: [ 120 ]
28 | out_norm: 'post'
29 | variance_activation: 'softplus'
30 | obs_decoder:
31 | hidden_units_list: [ 240 ]
32 | out_norm: 'post'
33 | variance_activation: 'softplus'
34 |
35 | decode:
36 | reward: False
37 | obs: True
38 |
39 |
40 |
--------------------------------------------------------------------------------
/experiments/maze2d/conf/model/default_mts3.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default
3 | - data: data_medium
4 |
5 | wandb:
6 | log: True
7 | project_name: 'debugMaze'
8 | exp_name: 'mts3_new'
9 | sweep: False
10 | sweep_id: null
11 |
12 | mts3:
13 | latent_obs_dim: 30 #for contextual rssm
14 | pixel_obs: False
15 | time_scale_multiplier: 30
16 | initial_state_covar: 10 ## for both hierarchies same (chaneg later ??)
17 | manager:
18 | bandwidth: 3
19 | process_noise_hidden_units: [ 30 ]
20 | trans_net_hidden_activation: "Tanh"
21 | process_noise_hidden_activation: 'ReLU'
22 | learn_trans_covar: True
23 | multi_gaussian_l_transform: False
24 | trans_covar: 0.1
25 | learn_initial_state_covar: False
26 | initial_state_covar: 10
27 | abstract_obs_encoder:
28 | hidden_units_list: [ 240 ]
29 | out_norm: 'none'
30 | variance_activation: 'softplus'
31 | learn_initial_state_covar: False
32 | initial_state_covar: 10
33 | state_abs: True
34 | time_embed:
35 | type: "time"
36 | dim: 1
37 | abstract_act_encoder:
38 | hidden_units_list: [ 240 ]
39 | aggregator: 'BA'
40 | out_norm: 'none'
41 | variance_activation: 'softplus'
42 | learn_initial_state_covar: False
43 | initial_state_covar: 10
44 | state_abs: True
45 | time_embed:
46 | type: "time"
47 | dim: 1
48 |
49 | worker:
50 | bandwidth: 3
51 | decode_var: True
52 | obs_encoder:
53 | hidden_units_list: [ 120 ]
54 | out_norm: 'none'
55 | variance_activation: 'softplus'
56 | trans_net_hidden_units: [ ]
57 | control_net_hidden_units: [ 120 ]
58 | task_net_hidden_units: [ 120 ]
59 | process_noise_hidden_units: [ 30 ]
60 | trans_net_hidden_activation: "Tanh"
61 | control_net_hidden_activation: 'ReLU'
62 | process_noise_hidden_activation: 'ReLU'
63 | task_net_hidden_activation: 'ReLU'
64 | learn_trans_covar: True
65 | trans_covar: 0.1
66 | learn_initial_state_covar: False
67 | initial_state_covar: 10
68 | obs_decoder:
69 | hidden_units_list: [ 240 ]
70 | variance_activation: 'softplus'
71 |
72 | decode:
73 | reward: False
74 | obs: True
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/experiments/maze2d/conf/model/learn/default.yaml:
--------------------------------------------------------------------------------
1 | name: "_default"
2 | model:
3 | load: False
4 | id: 2e4hzn33
5 | epochs: 1000
6 | clip_gradients: True
7 | batch_size: 1200
8 | curriculum: True
9 | obs_imp: 0.15
10 | task_imp: 0.05
11 | max_curriculums: 7
12 | latent_visualization: False
13 | plot_traj: False
14 | lr: 0.003
15 | save_model: True
16 | loss: 'nll'
17 | data_parallel:
18 | enable: False
19 | device_ids:
20 | - 0
21 |
--------------------------------------------------------------------------------
/experiments/maze2d/conf/model/learn/default_acrkn.yaml:
--------------------------------------------------------------------------------
1 | name: "_default"
2 | model:
3 | load: False
4 | id: 2e4hzn33
5 | epochs: 1000
6 | clip_gradients: True
7 | batch_size: 2000
8 | obs_imp: 0.9
9 | latent_visualization: False
10 | plot_traj: False
11 | lr: 0.001
12 | save_model: True
13 | loss: 'nll'
14 | data_parallel:
15 | enable: False
16 | device_ids:
17 | - 0
18 |
--------------------------------------------------------------------------------
/experiments/maze2d/conf/model/learn/default_rnn.yaml:
--------------------------------------------------------------------------------
1 | name: "_default"
2 | model:
3 | load: False
4 | id: 2e4hzn33
5 | epochs: 1000
6 | clip_gradients: True
7 | batch_size: 2000
8 | obs_imp: 0.9
9 | latent_visualization: False
10 | plot_traj: False
11 | lr: 0.001
12 | save_model: True
13 | loss: 'nll'
14 | data_parallel:
15 | enable: False
16 | device_ids:
17 | - 0
18 |
--------------------------------------------------------------------------------
/experiments/maze2d/conf/platform/horeka.yaml:
--------------------------------------------------------------------------------
1 | # @package _global_
2 |
3 | defaults:
4 | - override /hydra/launcher: clusterduck_slurm
5 | - _self_
6 |
7 | hydra:
8 | mode: MULTIRUN # needed for launcher to be used
9 | launcher:
10 | # launcher/cluster specific options
11 | timeout_min: 1000
12 | partition: accelerated
13 | gres: gpu:4
14 | additional_parameters:
15 | output: /home/hk-project-robolrn/ft6900/Alr/MTS3/experiments/outputs/tb-%job-name.out
16 | error: /home/hk-project-robolrn/ft6900/Alr/MTS3/experiments/outputs/error-%job-name.out
17 |
18 | # clusterduck specific options
19 | parallel_runs_per_node: 4
20 | resources_config:
21 | cpu:
22 | cuda:
23 | stagger:
24 | delay: 5
25 | sweeper:
26 | params:
27 | +iteration: range(4)
--------------------------------------------------------------------------------
/experiments/maze2d/conf/platform/local.yaml:
--------------------------------------------------------------------------------
1 | # @package _global_
2 |
3 | defaults:
4 | - override /hydra/launcher: submitit_slurm
5 | - _self_
6 |
7 | hydra:
8 | mode: RUN # needed for launcher to be used
9 |
--------------------------------------------------------------------------------
/experiments/maze2d/hiprssm_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import numpy as np
8 | import torch
9 | import wandb
10 | import pickle
11 | import gdown
12 |
13 | from experiments.exp_prediction_hiprssm import Experiment
14 | from hydra.utils import get_original_cwd
15 |
16 |
17 | nn = torch.nn
18 |
19 | @hydra.main(config_path='conf',config_name="config")
20 | def my_app(cfg)->OmegaConf:
21 | global config
22 | model_cfg = cfg
23 | exp = Experiment(model_cfg)
24 |
25 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
26 | ### train the model
27 | mts3_model, wandb_run, save_path = exp._train_world_model(train_obs, train_act, train_targets, test_obs, test_act, test_targets)
28 | ### test the model
29 | #TODO: normalizer format specify
30 | exp._test_world_model(test_obs, test_act, test_targets, normalizer, mts3_model, wandb_run, save_path)
31 |
32 |
33 | class Experiment(Experiment):
34 | def __init__(self, cfg):
35 | super(Experiment, self).__init__(cfg)
36 |
37 | def _load_save_train_test_data(self):
38 | """
39 | write a function to load the data and return the train and test data
40 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
41 | """
42 | ## load the data from pickle and if not present download from the url
43 | if not os.path.exists(get_original_cwd() + self._data_cfg.save_path):
44 | print("..........Data Not Found...........Downloading from URL")
45 | ### download the data from url
46 | url = self._data_cfg.url
47 | output = get_original_cwd() + self._data_cfg.save_path
48 | gdown.download(url, output, quiet=False)
49 | else:
50 | print("..........Data Found...........Loading from local")
51 | with open(get_original_cwd() + self._data_cfg.save_path, 'rb') as f:
52 | data_dict = pickle.load(f)
53 | print("Train Obs Shape", data_dict['train_obs'].shape)
54 | print("Train Act Shape", data_dict['train_act'].shape)
55 | print("Train Targets Shape", data_dict['train_targets'].shape)
56 | print("Test Obs Shape", data_dict['test_obs'].shape)
57 | print("Test Act Shape", data_dict['test_act'].shape)
58 | print("Test Targets Shape", data_dict['test_targets'].shape)
59 | print("Normalizer", data_dict['normalizer'])
60 | return data_dict
61 |
62 | def _get_data_set(self):
63 | """
64 | write a function to load the data and return the train and test data
65 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
66 | """
67 | ### load or generate data
68 | data_dict = self._load_save_train_test_data()
69 |
70 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
71 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
72 |
73 |
74 | def main():
75 | my_app()
76 |
77 |
78 |
79 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
80 | if __name__ == '__main__':
81 | main()
--------------------------------------------------------------------------------
/experiments/maze2d/mts3_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import numpy as np
8 | import torch
9 | import wandb
10 | import pickle
11 | import gdown
12 |
13 | from experiments.exp_prediction_mts3 import Experiment
14 | from hydra.utils import get_original_cwd
15 |
16 |
17 | nn = torch.nn
18 |
19 | @hydra.main(config_path='conf',config_name="config")
20 | def my_app(cfg)->OmegaConf:
21 | global config
22 | model_cfg = cfg
23 | exp = Experiment(model_cfg)
24 |
25 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
26 | ### train the model
27 | mts3_model, wandb_run, save_path = exp._train_world_model(train_obs, train_act, train_targets, test_obs, test_act, test_targets)
28 | ### test the model
29 | #TODO: normalizer format specify
30 | exp._test_world_model(test_obs, test_act, test_targets, normalizer, mts3_model, wandb_run, save_path)
31 |
32 |
33 | class Experiment(Experiment):
34 | def __init__(self, cfg):
35 | super(Experiment, self).__init__(cfg)
36 |
37 | def _load_save_train_test_data(self):
38 | """
39 | write a function to load the data and return the train and test data
40 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
41 | """
42 | ## load the data from pickle and if not present download from the url
43 | if not os.path.exists(get_original_cwd() + self._data_cfg.save_path):
44 | print("..........Data Not Found...........Downloading from URL")
45 | ### download the data from url
46 | url = self._data_cfg.url
47 | output = get_original_cwd() + self._data_cfg.save_path
48 | gdown.download(url, output, quiet=False)
49 | else:
50 | print("..........Data Found...........Loading from local")
51 | with open(get_original_cwd() + self._data_cfg.save_path, 'rb') as f:
52 | data_dict = pickle.load(f)
53 | print("Train Obs Shape", data_dict['train_obs'].shape)
54 | print("Train Act Shape", data_dict['train_act'].shape)
55 | print("Train Targets Shape", data_dict['train_targets'].shape)
56 | print("Test Obs Shape", data_dict['test_obs'].shape)
57 | print("Test Act Shape", data_dict['test_act'].shape)
58 | print("Test Targets Shape", data_dict['test_targets'].shape)
59 | print("Normalizer", data_dict['normalizer'])
60 | return data_dict
61 |
62 | def _get_data_set(self):
63 | """
64 | write a function to load the data and return the train and test data
65 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
66 | """
67 | ### load or generate data
68 | data_dict = self._load_save_train_test_data()
69 |
70 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
71 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
72 |
73 |
74 | def main():
75 | my_app()
76 |
77 |
78 |
79 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
80 | if __name__ == '__main__':
81 | main()
--------------------------------------------------------------------------------
/experiments/maze2d/rnn_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import numpy as np
8 | import torch
9 | import wandb
10 | import pickle
11 | import gdown
12 |
13 | from experiments.exp_prediction_rnn import Experiment
14 | from hydra.utils import get_original_cwd
15 |
16 |
17 | nn = torch.nn
18 |
19 | @hydra.main(config_path='conf',config_name="config")
20 | def my_app(cfg)->OmegaConf:
21 | global config
22 | model_cfg = cfg
23 | exp = Experiment(model_cfg)
24 |
25 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
26 | ### train the model
27 | mts3_model, wandb_run, save_path = exp._train_world_model(train_obs, train_act, train_targets, test_obs, test_act, test_targets)
28 | ### test the model
29 | #TODO: normalizer format specify
30 | exp._test_world_model(test_obs, test_act, test_targets, normalizer, mts3_model, wandb_run, save_path)
31 |
32 |
33 | class Experiment(Experiment):
34 | def __init__(self, cfg):
35 | super(Experiment, self).__init__(cfg)
36 |
37 | def _load_save_train_test_data(self):
38 | """
39 | write a function to load the data and return the train and test data
40 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
41 | """
42 | ## load the data from pickle and if not present download from the url
43 | if not os.path.exists(get_original_cwd() + self._data_cfg.save_path):
44 | print("..........Data Not Found...........Downloading from URL")
45 | ### download the data from url
46 | url = self._data_cfg.url
47 | output = get_original_cwd() + self._data_cfg.save_path
48 | gdown.download(url, output, quiet=False)
49 | else:
50 | print("..........Data Found...........Loading from local")
51 | with open(get_original_cwd() + self._data_cfg.save_path, 'rb') as f:
52 | data_dict = pickle.load(f)
53 | print("Train Obs Shape", data_dict['train_obs'].shape)
54 | print("Train Act Shape", data_dict['train_act'].shape)
55 | print("Train Targets Shape", data_dict['train_targets'].shape)
56 | print("Test Obs Shape", data_dict['test_obs'].shape)
57 | print("Test Act Shape", data_dict['test_act'].shape)
58 | print("Test Targets Shape", data_dict['test_targets'].shape)
59 | print("Normalizer", data_dict['normalizer'])
60 | return data_dict
61 |
62 | def _get_data_set(self):
63 | """
64 | write a function to load the data and return the train and test data
65 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
66 | """
67 | ### load or generate data
68 | data_dict = self._load_save_train_test_data()
69 |
70 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
71 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
72 |
73 | def main():
74 | my_app()
75 |
76 |
77 |
78 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
79 | if __name__ == '__main__':
80 | main()
--------------------------------------------------------------------------------
/experiments/mobileRobot/acrkn_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import numpy as np
8 | import torch
9 | import wandb
10 | import pickle
11 | import json
12 | import gdown
13 |
14 | from experiments.exp_prediction_acrkn import Experiment
15 | from hydra.utils import get_original_cwd
16 |
17 |
18 | nn = torch.nn
19 |
20 | @hydra.main(config_path='conf',config_name="config")
21 | def my_app(cfg)->OmegaConf:
22 | global config
23 | model_cfg = cfg
24 | exp = MobileExperiment(model_cfg)
25 |
26 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
27 | ### train the model
28 | mts3_model, wandb_run, save_path = exp._train_world_model(train_obs, train_act, train_targets, test_obs, test_act, test_targets)
29 | ### test the model
30 | #TODO: normalizer format specify
31 | exp._test_world_model(test_obs, test_act, test_targets, normalizer, mts3_model, wandb_run, save_path)
32 |
33 |
34 | class MobileExperiment(Experiment):
35 | def __init__(self, cfg):
36 | super(MobileExperiment, self).__init__(cfg)
37 |
38 | def _load_save_train_test_data(self):
39 | """
40 | write a function to load the data and return the train and test data
41 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
42 | """
43 | ## load the data from pickle and if not present download from the url
44 | if not os.path.exists(get_original_cwd() + self._data_train_cfg.save_path):
45 | print("..........Data Not Found...........Downloading from URL")
46 | ### download the data from url
47 | url = self._data_cfg.url
48 | output = get_original_cwd() + self._data_cfg.save_path
49 | gdown.download(url, output, quiet=False)
50 | else:
51 | print("..........Data Found...........Loading from local")
52 | with open(get_original_cwd() + self._data_train_cfg.save_path, 'rb') as f:
53 | data_dict = pickle.load(f)
54 | print("Train Obs Shape", data_dict['train_obs'].shape)
55 | print("Train Act Shape", data_dict['train_act'].shape)
56 | print("Train Targets Shape", data_dict['train_targets'].shape)
57 | print("Test Obs Shape", data_dict['test_obs'].shape)
58 | print("Test Act Shape", data_dict['test_act'].shape)
59 | print("Test Targets Shape", data_dict['test_targets'].shape)
60 | print("Normalizer", data_dict['normalizer'])
61 | return data_dict
62 |
63 | def _get_data_set(self):
64 | """
65 | write a function to load the data and return the train and test data
66 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
67 | """
68 | ### load or generate data
69 | data_dict = self._load_save_train_test_data()
70 |
71 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
72 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
73 |
74 |
75 | def main():
76 | my_app()
77 |
78 |
79 |
80 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
81 | if __name__ == '__main__':
82 | main()
--------------------------------------------------------------------------------
/experiments/mobileRobot/bash_scripts/test.sh:
--------------------------------------------------------------------------------
1 | python experiments/mobileRobot/mts3_exp.py model=default_mts3 model.wandb.project_name='Test-Mobile-NewCode' model.wandb.exp_name="MTS3" --multirun &
2 | python experiments/mobileRobot/acrkn_exp.py model=default_acrkn model.wandb.project_name='Test-Mobile-NewCode' model.wandb.exp_name="acRKN" --multirun &
3 | python experiments/mobileRobot/hiprssm_exp.py model=default_hiprssm model.wandb.project_name='Test-Mobile-NewCode' model.wandb.exp_name="HiP-RSSM" --multirun &
4 | python experiments/mobileRobot/rnn_exp.py model=default_lstm model.wandb.project_name='Test-Mobile-NewCode' model.wandb.exp_name="LSTM" --multirun &
5 | python experiments/mobileRobot/rnn_exp.py model=default_gru model.wandb.project_name='Test-Mobile-NewCode' model.wandb.exp_name="GRU" --multirun
6 |
--------------------------------------------------------------------------------
/experiments/mobileRobot/bash_scripts/test_rkn.sh:
--------------------------------------------------------------------------------
1 | python experiments/mobileRobot/acrkn_exp.py model=default_acrkn model.wandb.project_name='Test-Mobile-NewCode' model.wandb.exp_name="acRKN" --multirun
--------------------------------------------------------------------------------
/experiments/mobileRobot/conf/config.yaml:
--------------------------------------------------------------------------------
1 | hydra:
2 | mode: RUN
3 | sweep:
4 | dir: ./sweep_dir
5 |
6 |
7 | defaults:
8 | - model: default_mts3
9 | - platform: local
10 |
--------------------------------------------------------------------------------
/experiments/mobileRobot/conf/model/data/dataSinMixLong.yaml:
--------------------------------------------------------------------------------
1 | terrain: 'sinMixLong'
2 | frequency: '240'
3 | num_training_sequences: 750 #from a set of given collected train trajectories create this many subtrajectories for training
4 | num_testing_sequences: 500 #from a set of given collected test trajectories create this many subtrajectories for testing
5 | episode_length: 75 #window length for a particular instance of hip-rssm
6 | num_episodes: 12 #number of hip-rssm instances that make a dp-rssm meta sequence during training / backpropagation
7 | tar_type: 'next_state' # Use "delta" argument to predict on the differences as targets. In other cases use "observations".
8 | load: True
9 | save: False
10 | standardize: True
11 | split:
12 | - [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,41,42,43,44,45,46,47,48,49 ]
13 | - [ 30,31,32,33,34,35,36,37,38,39,40 ]
14 | shuffle_split: null
15 | save_path: "/dataFolder/mts3_datasets_processed/mobileData.pkl"
16 | url: "https://drive.google.com/uc?id=1ShZ_LyLGkWimboJv5RRk8M4yvrT7AUYY"
17 | trajPerTask: 10
18 | downsample: 2
19 | episodic: False
--------------------------------------------------------------------------------
/experiments/mobileRobot/conf/model/default_acrkn.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default_acrkn
3 | - data: dataSinMixLong
4 |
5 | wandb:
6 | log: True
7 | project_name: 'debugMobileRobot'
8 | exp_name: 'acrkn'
9 | sweep: False
10 | sweep_id: null
11 |
12 | acrkn:
13 | latent_obs_dim: 30 #for contextual rssm
14 | pixel_obs: False
15 | initial_state_covar: 10 ## for both hierarchies same (chaneg later ??)
16 |
17 | worker:
18 | addIdentity: True
19 | bandwidth: 3
20 | decode_var: True
21 | obs_encoder:
22 | hidden_units_list: [ 120 ]
23 | out_norm: 'post'
24 | variance_activation: 'softplus'
25 | trans_net_hidden_units: [ ]
26 | control_net_hidden_units: [ 120 ]
27 | process_noise_hidden_units: [ 30 ]
28 | trans_net_hidden_activation: "Tanh"
29 | control_net_hidden_activation: 'ReLU'
30 | process_noise_hidden_activation: 'ReLU'
31 | task_net_hidden_activation: 'ReLU'
32 | learn_trans_covar: True
33 | decoder_conditioning: False
34 | multi_gaussian_l_transform: False
35 | trans_covar: 0.1
36 | learn_initial_state_covar: False
37 | initial_state_covar: 10
38 | clip_gradients: True
39 | obs_decoder:
40 | hidden_units_list: [ 240 ]
41 | out_norm: 'post'
42 | variance_activation: 'softplus'
43 |
44 | decode:
45 | reward: False
46 | obs: True
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/experiments/mobileRobot/conf/model/default_gru.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default_acrkn
3 | - data: dataSinMixLong
4 |
5 | wandb:
6 | log: True
7 | project_name: 'debugMobileRobot'
8 | exp_name: 'acrkn'
9 | sweep: False
10 | sweep_id: null
11 |
12 | rnn:
13 | type: 'gru'
14 | latent_obs_dim: 30 #for contextual rssm
15 | pixel_obs: False
16 | decode_var: True
17 | enc_out_norm: True
18 | obs_encoder:
19 | hidden_units_list: [ 120 ]
20 | out_norm: 'post'
21 | variance_activation: 'softplus'
22 | act_encoder:
23 | hidden_units_list: [ 120 ]
24 | out_norm: 'post'
25 | variance_activation: 'softplus'
26 | encoder:
27 | hidden_units_list: [ 120 ]
28 | out_norm: 'post'
29 | variance_activation: 'softplus'
30 | obs_decoder:
31 | hidden_units_list: [ 240 ]
32 | out_norm: 'post'
33 | variance_activation: 'softplus'
34 |
35 | decode:
36 | reward: False
37 | obs: True
--------------------------------------------------------------------------------
/experiments/mobileRobot/conf/model/default_hiprssm.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default_acrkn
3 | - data: dataSinMixLong
4 |
5 | wandb:
6 | log: True
7 | project_name: 'debugMobileRobot'
8 | exp_name: 'hiprssm'
9 | sweep: False
10 | sweep_id: null
11 |
12 | hiprssm:
13 | context_len: 75
14 | clip_gradients: True
15 | latent_obs_dim: 30 #for contextual rssm
16 | pixel_obs: False
17 | initial_state_covar: 10 ## (chaneg later ??)
18 | initial_task_covar: 1 ## (chaneg later ??)
19 |
20 | worker:
21 | addIdentity: True
22 | bandwidth: 3
23 | decode_var: True
24 | obs_encoder:
25 | hidden_units_list: [ 120 ]
26 | out_norm: 'post'
27 | variance_activation: 'softplus'
28 | task_encoder:
29 | hidden_units_list: [ 240 ]
30 | out_norm: 'post'
31 | variance_activation: 'softplus'
32 | trans_net_hidden_units: [ ]
33 | control_net_hidden_units: [ 120 ]
34 | process_noise_hidden_units: [ 30 ]
35 | trans_net_hidden_activation: "Tanh"
36 | control_net_hidden_activation: 'ReLU'
37 | process_noise_hidden_activation: 'ReLU'
38 | task_net_hidden_activation: 'ReLU'
39 | learn_trans_covar: True
40 | decoder_conditioning: False
41 | multi_gaussian_l_transform: False
42 | trans_covar: 0.1
43 | learn_initial_state_covar: False
44 | initial_state_covar: 10
45 | clip_gradients: True
46 | obs_decoder:
47 | hidden_units_list: [ 240 ]
48 | out_norm: 'post'
49 | variance_activation: 'softplus'
50 |
51 | decode:
52 | reward: False
53 | obs: True
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/experiments/mobileRobot/conf/model/default_lstm.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default_acrkn
3 | - data: dataSinMixLong
4 |
5 | wandb:
6 | log: True
7 | project_name: 'debugMobileRobot'
8 | exp_name: 'acrkn'
9 | sweep: False
10 | sweep_id: null
11 |
12 | rnn:
13 | type: 'lstm'
14 | latent_obs_dim: 30 #for contextual rssm
15 | pixel_obs: False
16 | decode_var: True
17 | enc_out_norm: True
18 | obs_encoder:
19 | hidden_units_list: [ 120 ]
20 | out_norm: 'post'
21 | variance_activation: 'softplus'
22 | act_encoder:
23 | hidden_units_list: [ 120 ]
24 | out_norm: 'post'
25 | variance_activation: 'softplus'
26 | encoder:
27 | hidden_units_list: [ 120 ]
28 | out_norm: 'post'
29 | variance_activation: 'softplus'
30 | obs_decoder:
31 | hidden_units_list: [ 240 ]
32 | out_norm: 'post'
33 | variance_activation: 'softplus'
34 |
35 | decode:
36 | reward: False
37 | obs: True
38 |
39 |
40 |
--------------------------------------------------------------------------------
/experiments/mobileRobot/conf/model/default_mts3.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - learn: default
3 | - data: dataSinMixLong
4 |
5 | wandb:
6 | log: True
7 | project_name: 'cameraMobile'
8 | exp_name: 'mts3_new'
9 | sweep: False
10 | sweep_id: null
11 |
12 | mts3:
13 | clip_gradients: True
14 | latent_obs_dim: 30 #for contextual rssm
15 | pixel_obs: False
16 | time_scale_multiplier: 75
17 | initial_state_covar: 10 ## for both hierarchies same (chaneg later ??)
18 | manager:
19 | bandwidth: 3
20 | process_noise_hidden_units: [ 30 ]
21 | trans_net_hidden_activation: "Tanh"
22 | process_noise_hidden_activation: 'ReLU'
23 | learn_trans_covar: True
24 | multi_gaussian_l_transform: False
25 | trans_covar: 0.1
26 | learn_initial_state_covar: False
27 | initial_state_covar: 10
28 | abstract_obs_encoder:
29 | hidden_units_list: [ 240 ]
30 | out_norm: 'none'
31 | variance_activation: 'softplus'
32 | learn_initial_state_covar: False
33 | initial_state_covar: 10
34 | state_abs: True
35 | time_embed:
36 | type: "time"
37 | dim: 1
38 | abstract_act_encoder:
39 | hidden_units_list: [ 240 ]
40 | aggregator: 'BA'
41 | out_norm: 'none'
42 | variance_activation: 'softplus'
43 | learn_initial_state_covar: False
44 | initial_state_covar: 10
45 | state_abs: True
46 | time_embed:
47 | type: "time"
48 | dim: 1
49 |
50 | worker:
51 | bandwidth: 3
52 | decode_var: True
53 | obs_encoder:
54 | hidden_units_list: [ 120 ]
55 | out_norm: 'none'
56 | variance_activation: 'softplus'
57 | trans_net_hidden_units: [ ]
58 | control_net_hidden_units: [ 120 ]
59 | task_net_hidden_units: [ 120 ]
60 | process_noise_hidden_units: [ 30 ]
61 | trans_net_hidden_activation: "Tanh"
62 | control_net_hidden_activation: 'ReLU'
63 | process_noise_hidden_activation: 'ReLU'
64 | task_net_hidden_activation: 'ReLU'
65 | learn_trans_covar: True
66 | decoder_conditioning: False
67 | additive_linear_task: True
68 | additive_l_linear_task_factorized: False
69 | additive_nl_task: False
70 | additive_nl_task_deterministic: False
71 | additive_ll_task: False
72 | multi_gaussian_l_transform: False
73 | trans_covar: 0.1
74 | learn_initial_state_covar: False
75 | initial_state_covar: 10
76 | clip_gradients: True
77 | obs_decoder:
78 | hidden_units_list: [ 240 ]
79 | variance_activation: 'softplus'
80 |
81 | decode:
82 | reward: False
83 | obs: True
84 |
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/experiments/mobileRobot/conf/model/learn/default.yaml:
--------------------------------------------------------------------------------
1 | name: "_default"
2 | model:
3 | load: False
4 | id: 1fb36a45
5 | epochs: 2500
6 | clip_gradients: True
7 | batch_size: 1500
8 | curriculum: True
9 | obs_imp: 0.15
10 | task_imp: 0.05
11 | max_curriculums: 7
12 | latent_visualization: False
13 | plot_traj: False
14 | lr: 0.003
15 | save_model: True
16 | loss: 'nll'
17 | data_parallel:
18 | enable: False
19 | device_ids:
20 | - 0
21 |
22 |
--------------------------------------------------------------------------------
/experiments/mobileRobot/conf/model/learn/default_acrkn.yaml:
--------------------------------------------------------------------------------
1 | name: "_default"
2 | model:
3 | load: False
4 | id: 2e4hzn33
5 | epochs: 1
6 | clip_gradients: True
7 | batch_size: 50
8 | obs_imp: 0.9
9 | latent_visualization: False
10 | plot_traj: False
11 | lr: 0.0003
12 | save_model: True
13 | loss: 'nll'
14 | data_parallel:
15 | enable: False
16 | device_ids:
17 | - 0
18 |
--------------------------------------------------------------------------------
/experiments/mobileRobot/conf/platform/bwuni-cpu.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - submitit_slurm
3 |
4 | timeout_min: 3600
5 | name: ${hydra.job.name}
6 | partition: single
7 | additional_parameters: {"ntasks":1,"nodes":1, "cpus-per-task":32,"mem":20000, "output": /pfs/data5/home/kit/anthropomatik/ft6900/Alr/DP-SSM-v2/experiments/outputs/tb-%job-name.out,"error":/pfs/data5/home/kit/anthropomatik/ft6900/Alr/DP-SSM-v2/experiments/outputs/error-%job-name.out}
--------------------------------------------------------------------------------
/experiments/mobileRobot/conf/platform/bwuni-gpu.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - submitit_slurm
3 |
4 | name: ${hydra.job.name}
5 | partition: gpu_4_a100
6 | gpus_per_node: 1
7 | timeout_min: 500
8 | additional_parameters: {"ntasks": 1, "gres": gpu:1, "cpus-per-task":6, "mem":20000, "output": /home/kit/anthropomatik/ft6900/Alr/DP-SSM-v2/experiments/outputs/tb-%job-name.out,"error": /home/kit/anthropomatik/ft6900/Alr/DP-SSM-v2/experiments/outputs/error-%job-name.out}
--------------------------------------------------------------------------------
/experiments/mobileRobot/conf/platform/horeka-acc.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - submitit_slurm
3 |
4 | name: ${hydra.job.name}
5 | partition: accelerated
6 | gpus_per_node: 4
7 | timeout_min: 1000
8 | additional_parameters: {"ntasks": 1, "gres": gpu:4, cpus-per-task: 8, "output": /home/hk-project-robolrn/ft6900/Alr/DP-SSM-v2/experiments/outputs/tb-%job-name.out,"error":/home/hk-project-robolrn/ft6900/Alr/DP-SSM-v2/experiments/outputs/error-%job-name.out}
--------------------------------------------------------------------------------
/experiments/mobileRobot/conf/platform/horeka-amd.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - submitit_slurm
3 |
4 | name: ${hydra.job.name}
5 | partition: amd-milan-mi250
6 | gpus_per_node: 1
7 | timeout_min: 1000
8 | additional_parameters: {"ntasks": 1, "gres": gpu:4, cpus-per-task: 8, "output": /home/hk-project-robolrn/ft6900/Alr/DP-SSM-v2/experiments/outputs/tb-%job-name.out,"error":/home/hk-project-robolrn/ft6900/Alr/DP-SSM-v2/experiments/outputs/error-%job-name.out}
--------------------------------------------------------------------------------
/experiments/mobileRobot/conf/platform/horeka.yaml:
--------------------------------------------------------------------------------
1 | # @package _global_
2 |
3 | defaults:
4 | - override /hydra/launcher: clusterduck_slurm
5 | - _self_
6 |
7 | hydra:
8 | mode: MULTIRUN # needed for launcher to be used
9 | launcher:
10 | # launcher/cluster specific options
11 | timeout_min: 1000
12 | partition: accelerated
13 | gres: gpu:4
14 | additional_parameters:
15 | output: /home/hk-project-robolrn/ft6900/Alr/MTS3/experiments/outputs/tb-%job-name.out
16 | error: /home/hk-project-robolrn/ft6900/Alr/MTS3/experiments/outputs/error-%job-name.out
17 |
18 | # clusterduck specific options
19 | parallel_runs_per_node: 4
20 | resources_config:
21 | cpu:
22 | cuda:
23 | stagger:
24 | delay: 5
25 | sweeper:
26 | params:
27 | +iteration: range(4)
--------------------------------------------------------------------------------
/experiments/mobileRobot/conf/platform/kluster.yaml:
--------------------------------------------------------------------------------
1 | defaults:
2 | - submitit_slurm
3 |
4 | timeout_min: 3600
5 | name: ${hydra.job.name}
6 | partition: gpu
7 | exclude: node4, node6, node1, node2, node3, node5
8 | additional_parameters: {"ntasks":1, "gres": gpu:1,"cpus-per-task":2, "mem-per-cpu":15000, "output": /home/i53/mitarbeiter/vshaj/DP-SSM-v2/experiments/slurm_output/tb-%job-name.out,"error":/home/i53/mitarbeiter/vshaj/DP-SSM-v2/experiments/slurm_output/error-%job-name.out}
--------------------------------------------------------------------------------
/experiments/mobileRobot/conf/platform/local.yaml:
--------------------------------------------------------------------------------
1 | # @package _global_
2 |
3 | defaults:
4 | - override /hydra/launcher: submitit_slurm
5 | - _self_
6 |
7 | hydra:
8 | mode: RUN # needed for launcher to be used
9 |
--------------------------------------------------------------------------------
/experiments/mobileRobot/hiprssm_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import numpy as np
8 | import torch
9 | import wandb
10 | import pickle
11 | import json
12 | import gdown
13 |
14 | from experiments.exp_prediction_hiprssm import Experiment
15 | from hydra.utils import get_original_cwd
16 |
17 |
18 | nn = torch.nn
19 |
20 | @hydra.main(config_path='conf',config_name="config")
21 | def my_app(cfg)->OmegaConf:
22 | global config
23 | model_cfg = cfg
24 | exp = MobileExperiment(model_cfg)
25 |
26 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
27 | ### train the model
28 | mts3_model, wandb_run, save_path = exp._train_world_model(train_obs, train_act, train_targets, test_obs, test_act, test_targets)
29 | ### test the model
30 | #TODO: normalizer format specify
31 | exp._test_world_model(test_obs, test_act, test_targets, normalizer, mts3_model, wandb_run, save_path)
32 |
33 |
34 | class MobileExperiment(Experiment):
35 | def __init__(self, cfg):
36 | super(MobileExperiment, self).__init__(cfg)
37 |
38 | def _load_save_train_test_data(self):
39 | """
40 | write a function to load the data and return the train and test data
41 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
42 | """
43 | ## load the data from pickle and if not present download from the url
44 | if not os.path.exists(get_original_cwd() + self._data_train_cfg.save_path):
45 | print("..........Data Not Found...........Downloading from URL")
46 | ### download the data from url
47 | url = self._data_cfg.url
48 | output = get_original_cwd() + self._data_cfg.save_path
49 | gdown.download(url, output, quiet=False)
50 | else:
51 | print("..........Data Found...........Loading from local")
52 | with open(get_original_cwd() + self._data_train_cfg.save_path, 'rb') as f:
53 | data_dict = pickle.load(f)
54 | print("Train Obs Shape", data_dict['train_obs'].shape)
55 | print("Train Act Shape", data_dict['train_act'].shape)
56 | print("Train Targets Shape", data_dict['train_targets'].shape)
57 | print("Test Obs Shape", data_dict['test_obs'].shape)
58 | print("Test Act Shape", data_dict['test_act'].shape)
59 | print("Test Targets Shape", data_dict['test_targets'].shape)
60 | print("Normalizer", data_dict['normalizer'])
61 | return data_dict
62 |
63 | def _get_data_set(self):
64 | """
65 | write a function to load the data and return the train and test data
66 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
67 | """
68 | ### load or generate data
69 | data_dict = self._load_save_train_test_data()
70 |
71 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
72 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
73 |
74 |
75 | def main():
76 | my_app()
77 |
78 |
79 |
80 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
81 | if __name__ == '__main__':
82 | main()
--------------------------------------------------------------------------------
/experiments/mobileRobot/mts3_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import torch
8 | import pickle
9 | import gdown
10 |
11 | from experiments.exp_prediction_mts3 import Experiment
12 | from hydra.utils import get_original_cwd
13 |
14 |
15 | nn = torch.nn
16 |
17 | @hydra.main(config_path='conf',config_name="config")
18 | def my_app(cfg)->OmegaConf:
19 | global config
20 | model_cfg = cfg
21 | exp = MobileExperiment(model_cfg)
22 |
23 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
24 | ### train the model
25 | mts3_model, wandb_run, save_path = exp._train_world_model(train_obs, train_act, train_targets, test_obs, test_act, test_targets)
26 | ### test the model
27 | #TODO: normalizer format specify
28 | exp._test_world_model(test_obs, test_act, test_targets, normalizer, mts3_model, wandb_run, save_path)
29 |
30 |
31 | class MobileExperiment(Experiment):
32 | def __init__(self, cfg):
33 | super(MobileExperiment, self).__init__(cfg)
34 |
35 | def _load_save_train_test_data(self):
36 | """
37 | write a function to load the data and return the train and test data
38 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
39 | """
40 | ## load the data from pickle and if not present download from the url
41 | if not os.path.exists(get_original_cwd() + self._data_cfg.save_path):
42 | print("..........Data Not Found...........Downloading from URL")
43 | ### download the data from url
44 | url = self._data_cfg.url
45 | output = get_original_cwd() + self._data_cfg.save_path
46 | gdown.download(url, output, quiet=False)
47 | else:
48 | print("..........Data Found...........Loading from local")
49 | with open(get_original_cwd() + self._data_cfg.save_path, 'rb') as f:
50 | data_dict = pickle.load(f)
51 | print("Train Obs Shape", data_dict['train_obs'].shape)
52 | print("Train Act Shape", data_dict['train_act'].shape)
53 | print("Train Targets Shape", data_dict['train_targets'].shape)
54 | print("Test Obs Shape", data_dict['test_obs'].shape)
55 | print("Test Act Shape", data_dict['test_act'].shape)
56 | print("Test Targets Shape", data_dict['test_targets'].shape)
57 | print("Normalizer", data_dict['normalizer'])
58 | return data_dict
59 |
60 | def _get_data_set(self):
61 | """
62 | write a function to load the data and return the train and test data
63 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
64 | """
65 | ### load or generate data
66 | data_dict = self._load_save_train_test_data()
67 |
68 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
69 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
70 |
71 |
72 | def main():
73 | my_app()
74 |
75 |
76 |
77 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
78 | if __name__ == '__main__':
79 | main()
--------------------------------------------------------------------------------
/experiments/mobileRobot/mts3_simple_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import torch
8 | import pickle
9 |
10 | from experiments.exp_simple_prediction_mts3 import Experiment
11 | from hydra.utils import get_original_cwd
12 |
13 |
14 | nn = torch.nn
15 |
16 | @hydra.main(config_path='conf',config_name="config")
17 | def my_app(cfg)->OmegaConf:
18 | global config
19 | model_cfg = cfg
20 | exp = MobileExperiment(model_cfg)
21 |
22 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
23 | ### train the model
24 | mts3_model, wandb_run, save_path = exp._train_timeseries_model(train_obs, train_targets, test_obs, test_targets)
25 | ### test the model
26 | #TODO: normalizer format specify
27 | exp._test_timeseries_model(test_obs, test_targets, normalizer, mts3_model, wandb_run, save_path)
28 |
29 | class MobileExperiment(Experiment):
30 | def __init__(self, cfg):
31 | super(MobileExperiment, self).__init__(cfg)
32 |
33 | def _load_save_train_test_data(self):
34 | """
35 | write a function to load the data and return the train and test data
36 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
37 | """
38 | ## load the data from pickle and if not present download from the url
39 | if not os.path.exists(get_original_cwd() + self._data_cfg.save_path):
40 | print("..........Data Not Found...........Downloading from URL")
41 | ### download the data from url
42 | url = self._data_cfg.url
43 | output = get_original_cwd() + self._data_cfg.save_path
44 | gdown.download(url, output, quiet=False)
45 | else:
46 | print("..........Data Found...........Loading from local")
47 | with open(get_original_cwd() + self._data_cfg.save_path, 'rb') as f:
48 | data_dict = pickle.load(f)
49 | print("Train Obs Shape", data_dict['train_obs'].shape)
50 | print("Train Act Shape", data_dict['train_act'].shape)
51 | print("Train Targets Shape", data_dict['train_targets'].shape)
52 | print("Test Obs Shape", data_dict['test_obs'].shape)
53 | print("Test Act Shape", data_dict['test_act'].shape)
54 | print("Test Targets Shape", data_dict['test_targets'].shape)
55 | print("Normalizer", data_dict['normalizer'])
56 | return data_dict
57 |
58 | def _get_data_set(self):
59 | """
60 | write a function to load the data and return the train and test data
61 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
62 | """
63 | ### load or generate data
64 | data_dict = self._load_save_train_test_data()
65 |
66 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
67 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
68 |
69 |
70 | def main():
71 | my_app()
72 |
73 |
74 |
75 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
76 | if __name__ == '__main__':
77 | main()
--------------------------------------------------------------------------------
/experiments/mobileRobot/rnn_exp.py:
--------------------------------------------------------------------------------
1 | import sys
2 | sys.path.append('.')
3 | from omegaconf import DictConfig, OmegaConf
4 | import hydra
5 | import os
6 |
7 | import numpy as np
8 | import torch
9 | import wandb
10 | import pickle
11 | import json
12 | import gdown
13 |
14 | from experiments.exp_prediction_rnn import Experiment
15 | from hydra.utils import get_original_cwd
16 |
17 |
18 | nn = torch.nn
19 |
20 | @hydra.main(config_path='conf',config_name="config")
21 | def my_app(cfg)->OmegaConf:
22 | global config
23 | model_cfg = cfg
24 | exp = MobileExperiment(model_cfg)
25 |
26 | train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer = exp._get_data_set()
27 | ### train the model
28 | mts3_model, wandb_run, save_path = exp._train_world_model(train_obs, train_act, train_targets, test_obs, test_act, test_targets)
29 | ### test the model
30 | #TODO: normalizer format specify
31 | exp._test_world_model(test_obs, test_act, test_targets, normalizer, mts3_model, wandb_run, save_path)
32 |
33 |
34 | class MobileExperiment(Experiment):
35 | def __init__(self, cfg):
36 | super(MobileExperiment, self).__init__(cfg)
37 |
38 | def _load_save_train_test_data(self):
39 | """
40 | write a function to load the data and return the train and test data
41 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
42 | """
43 | ## load the data from pickle and if not present download from the url
44 | if not os.path.exists(get_original_cwd() + self._data_cfg.save_path):
45 | print("..........Data Not Found...........Downloading from URL")
46 | ### download the data from url
47 | url = self._data_cfg.url
48 | output = get_original_cwd() + self._data_cfg.save_path
49 | gdown.download(url, output, quiet=False)
50 | else:
51 | print("..........Data Found...........Loading from local")
52 | with open(get_original_cwd() + self._data_cfg.save_path, 'rb') as f:
53 | data_dict = pickle.load(f)
54 | print("Train Obs Shape", data_dict['train_obs'].shape)
55 | print("Train Act Shape", data_dict['train_act'].shape)
56 | print("Train Targets Shape", data_dict['train_targets'].shape)
57 | print("Test Obs Shape", data_dict['test_obs'].shape)
58 | print("Test Act Shape", data_dict['test_act'].shape)
59 | print("Test Targets Shape", data_dict['test_targets'].shape)
60 | print("Normalizer", data_dict['normalizer'])
61 | return data_dict
62 |
63 | def _get_data_set(self):
64 | """
65 | write a function to load the data and return the train and test data
66 | :return: train_obs, train_act, train_targets, test_obs, test_act, test_targets, normalizer
67 | """
68 | ### load or generate data
69 | data_dict = self._load_save_train_test_data()
70 |
71 | return data_dict['train_obs'], data_dict['train_act'], data_dict['train_targets'], data_dict['test_obs'], \
72 | data_dict['test_act'], data_dict['test_targets'], data_dict['normalizer']
73 |
74 |
75 | def main():
76 | my_app()
77 |
78 |
79 |
80 | ## https://stackoverflow.com/questions/32761999/how-to-pass-an-entire-list-as-command-line-argument-in-python/32763023
81 | if __name__ == '__main__':
82 | main()
--------------------------------------------------------------------------------
/experiments/readme.md:
--------------------------------------------------------------------------------
1 | ## Config Structure For Experiments
2 |
3 | Each baselines hyperparameters can be found in the configuration files (yaml files) in the conf folder under the corresponding dataset folder.
4 |
5 | For example for the experiments with Mobile Robot dataset, the configuration files are:
6 |
7 | - experiments/mobileRobot/conf/model/default_mts3.yaml ##for mts3 model hyperparameters
8 | - experiments/mobileRobot/conf/model/learn/default.yaml ##for learning/training/optimizer related hyperparameters
9 |
10 | The configuration files for the other baselines and datasets can be found in the corresponding folders.
11 |
12 | Refer to [hydra](https://hydra.cc/docs/intro/) documentation for more details on how to use the configuration files and how these are used in the script. However to just run the scripts you don't need to understand hydras configuration framework.
13 |
14 | ## Running Experiments with another hyperparameter configuration
15 |
16 | 1. You can either change the hyperparameters in the configuration files or create a new configuration file with the desired hyperparameters.
17 | 2. Then you can run the experiment with the new configuration file by passing the configuration file as an argument to the script. For example:
18 |
19 | ```python
20 | python experiments/mobileRobot/mts3_exp.py model=default_mts3
21 | ```
22 |
23 | This will run the experiment with the hyperparameters specified in the configuration file `default_mts3.yaml` in the `conf/model` folder.
24 | 3. You can also pass the hyperparameters as command line arguments. For example:
25 |
26 | ```python
27 | python experiments/mobileRobot/mts3_exp.py model=default_mts3 model.encoder.hidden_size=256 model.learn.batch_size=500
28 | ```
29 |
30 | This will run the experiment with the hyperparameters specified in the configuration file `default_mts3.yaml` in the `conf/model` folder and will override the `encoder.hidden_size` parameter with the value `256`. It will also override the `learn.batch_size` parameter with the value `500`.
--------------------------------------------------------------------------------
/images/2023-07-14-13-54-04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/images/2023-07-14-13-54-04.png
--------------------------------------------------------------------------------
/images/acrkn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/images/acrkn.png
--------------------------------------------------------------------------------
/images/gclayer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/images/gclayer.png
--------------------------------------------------------------------------------
/images/gclayer2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/images/gclayer2.png
--------------------------------------------------------------------------------
/images/gplayer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/images/gplayer.png
--------------------------------------------------------------------------------
/images/hiprssm4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/images/hiprssm4.png
--------------------------------------------------------------------------------
/images/mean-cov.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/images/mean-cov.jpg
--------------------------------------------------------------------------------
/images/mean_cov5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/images/mean_cov5.jpg
--------------------------------------------------------------------------------
/images/meancov1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/images/meancov1.jpg
--------------------------------------------------------------------------------
/images/mts3_readme.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/images/mts3_readme.jpg
--------------------------------------------------------------------------------
/images/mts3arch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/images/mts3arch.png
--------------------------------------------------------------------------------
/images/pgm_mts3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/images/pgm_mts3.png
--------------------------------------------------------------------------------
/logs/latent_plots/readme.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/logs/latent_plots/readme.md
--------------------------------------------------------------------------------
/logs/output/plots/readme.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/logs/output/plots/readme.md
--------------------------------------------------------------------------------
/logs/output/readme.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/logs/output/readme.md
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | # This is a sample Python script.
2 |
3 | # Press Shift+F10 to execute it or replace it with your code.
4 | # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
5 |
6 |
7 | def print_hi(name):
8 | # Use a breakpoint in the code line below to debug your script.
9 | print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
10 |
11 |
12 | # Press the green button in the gutter to run the script.
13 | if __name__ == '__main__':
14 | print_hi('PyCharm')
15 |
16 | # See PyCharm help at https://www.jetbrains.com/help/pycharm/
17 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | omegaconf==2.3.0
2 | hydra_core==1.3.2
3 | hydra-submitit-launcher==1.2.0
4 | numpy==1.26.1
5 | wandb==0.15.12
6 | torch==1.13.1
7 | torchview==0.2.6
8 | pandas==2.1.2
9 | matplotlib==3.8.0
10 | torchvision==0.14.1
11 | torchviz==0.0.2
12 | gdown==4.7.3
13 |
14 | # from plotTrajectory.py
15 | SciencePlots==2.1.0
16 | tueplots==0.0.10
17 |
18 | # from latentViz.py
19 | scikit-learn==1.3.2
20 | seaborn==0.13.0
21 | plotly==5.18.0
--------------------------------------------------------------------------------
/utils/Losses.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import numpy as np
3 | from matplotlib import pyplot as plt
4 |
5 | def rmse(target, predicted):
6 | """Mean Squared Error"""
7 | return torch.sqrt(torch.mean((target - predicted)**2))
8 |
9 | def mse(target, predicted):
10 | """Mean Squared Error"""
11 | #target = target[:,:1]
12 | return torch.mean((target - predicted)**2)
13 |
14 | def gaussian_nll(target, predicted_mean, predicted_var):
15 | """Gaussian Negative Log Likelihood (assuming diagonal covariance)"""
16 | #target = target[:,:1]
17 | predicted_var += 1e-12
18 | mahal = (target - predicted_mean)**2 / predicted_var
19 | element_wise_nll = 0.5 * (torch.log(predicted_var) + np.log(2 * np.pi) + mahal)
20 | sample_wise_error = torch.sum(element_wise_nll, dim=-1)
21 | return torch.mean(sample_wise_error)
22 |
23 | def root_mean_squared(pred, target, data=[], tar='observations', fromStep=0, denorma=False, plot=None):
24 | """
25 | root mean squared error
26 | :param target: ground truth positions
27 | :param pred_mean_var: mean and covar (as concatenated vector, as provided by model)
28 | :return: root mean squared error between targets and predicted mean, predicted variance is ignored
29 | """
30 | target = target[:,:1]
31 | pred = pred[..., :target.shape[-1]]
32 |
33 | sumSquare = 0
34 | count = 0
35 | if plot != None:
36 | for idx in range(target.shape[2]):
37 | plt.plot(target[3,:,idx],label='target')
38 | plt.plot(pred[3,:,idx],label='prediction')
39 | plt.legend()
40 | plt.show()
41 |
42 | # if denorma==True:
43 | # pred = denorm(pred, data, tar)
44 | # target = denorm(target, data, tar)
45 |
46 |
47 |
48 | #target = target[:, fromStep:, :]
49 | # pred = pred[:, fromStep:, :]
50 | numSamples = 1
51 | for dim in target.shape:
52 | numSamples = numSamples * dim
53 | #print('RMSE Samplesss......................................',numSamples)
54 | sumSquare = np.sum(np.sum(np.sum((target - pred) ** 2)))
55 | return np.sqrt(sumSquare / numSamples)
--------------------------------------------------------------------------------
/utils/PositionEmbedding.py:
--------------------------------------------------------------------------------
1 | import math
2 | import torch
3 |
4 |
5 | class PositionEmbedding:
6 | def __init__(self, device):
7 | self._device = device
8 |
9 |
10 |
11 | def positionalencoding1d(self, d_model, length):
12 | """
13 | :param d_model: dimension of the model
14 | :param length: length of timeseries
15 | :return: length*d_model position matrix
16 | """
17 | if d_model % 2 != 0:
18 | raise ValueError("Cannot use sin/cos positional encoding with "
19 | "odd dim (got dim={:d})".format(d_model))
20 | pe = torch.zeros(length, d_model, dtype=torch.float32, device= self._device)
21 | position = torch.arange(0, length, dtype=torch.float32, device= self._device).unsqueeze(1)
22 | div_term = torch.exp((torch.arange(0, d_model, 2, dtype=torch.float32, device=self._device) *
23 | -(math.log(50.0) / d_model))) #nlogM = logM^n
24 | pe[:, 0::2] = torch.sin(position.float() * div_term)
25 | pe[:, 1::2] = torch.cos(position.float() * div_term)
26 |
27 | return pe
28 |
29 |
30 | def positionalencoding2d(self, d_model, height, width):
31 | """
32 | :param d_model: dimension of the model
33 | :param height: height of the positions
34 | :param width: width of the positions
35 | :return: d_model*height*width position matrix
36 | """
37 | if d_model % 4 != 0:
38 | raise ValueError("Cannot use sin/cos positional encoding with "
39 | "odd dimension (got dim={:d})".format(d_model))
40 | pe = torch.zeros(d_model, height, width)
41 | # Each dimension use half of d_model
42 | d_model = int(d_model / 2)
43 | div_term = torch.exp(torch.arange(0., d_model, 2) *
44 | -(math.log(10000.0) / d_model))
45 | pos_w = torch.arange(0., width).unsqueeze(1)
46 | pos_h = torch.arange(0., height).unsqueeze(1)
47 | pe[0:d_model:2, :, :] = torch.sin(pos_w * div_term).transpose(0, 1).unsqueeze(1).repeat(1, height, 1)
48 | pe[1:d_model:2, :, :] = torch.cos(pos_w * div_term).transpose(0, 1).unsqueeze(1).repeat(1, height, 1)
49 | pe[d_model::2, :, :] = torch.sin(pos_h * div_term).transpose(0, 1).unsqueeze(2).repeat(1, 1, width)
50 | pe[d_model + 1::2, :, :] = torch.cos(pos_h * div_term).transpose(0, 1).unsqueeze(2).repeat(1, 1, width)
51 |
52 | return pe
--------------------------------------------------------------------------------
/utils/__init__.py:
--------------------------------------------------------------------------------
1 | from utils.serializable import Serializable
--------------------------------------------------------------------------------
/utils/__pycache__/ConfigDict.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/ConfigDict.cpython-37.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/Losses.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/Losses.cpython-37.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/PositionEmbedding.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/PositionEmbedding.cpython-37.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/__init__.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/__init__.cpython-36.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/__init__.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/__init__.cpython-37.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/__init__.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/__init__.cpython-38.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/dataProcess.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/dataProcess.cpython-37.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/dataProcess.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/dataProcess.cpython-38.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/latentVis.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/latentVis.cpython-37.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/metrics.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/metrics.cpython-37.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/metrics.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/metrics.cpython-38.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/multistepRecurrent.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/multistepRecurrent.cpython-37.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/plotTrajectory.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/plotTrajectory.cpython-37.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/serializable.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/serializable.cpython-36.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/serializable.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/serializable.cpython-37.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/serializable.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/serializable.cpython-38.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/tensor_utils.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/tensor_utils.cpython-37.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/utils.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/utils.cpython-36.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/utils.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/utils.cpython-37.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/utils.cpython-38.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/utils.cpython-38.pyc
--------------------------------------------------------------------------------
/utils/__pycache__/x_ai_tools.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ALRhub/MTS3/ab971c0ec43df7664c4b727ca69d5b8dd0cab5da/utils/__pycache__/x_ai_tools.cpython-37.pyc
--------------------------------------------------------------------------------
/utils/plotTrajectory.py:
--------------------------------------------------------------------------------
1 | import os
2 | import numpy as np
3 | import torch
4 | import matplotlib.pyplot as plt
5 | import matplotlib
6 | import scienceplots
7 | import tueplots
8 | from tueplots import bundles
9 | from matplotlib.collections import LineCollection
10 | from matplotlib.colors import ListedColormap, BoundaryNorm
11 | from utils.dataProcess import denorm,denorm_var
12 | from hydra.utils import get_original_cwd, to_absolute_path
13 | import wandb
14 | from matplotlib import rc
15 | #rc("text", usetex=False)
16 | matplotlib.rcParams['axes.unicode_minus'] = False #https://github.com/garrettj403/SciencePlots/issues/2
17 |
18 | def plotJoints(gt,pred_mu,pred_std, valid_flag, traj, wandb_run, show=False, exp_name='trial'):
19 | """
20 | plot the groundtruth, predictions and missing observation (valid) flags for each joints of the robot
21 | :param gt: ground truth
22 | :param pred_mu: predicted mean
23 | :param pred_std: predicted standard deviation
24 | :param valid_flag: missing observation flags
25 | :param traj: trajectory number
26 | :param wandb_run: wandb run
27 | :param show: show the plot
28 | :param exp_name: experiment name
29 | :return: figure and axis"""
30 |
31 | if gt.shape[1] < 2:
32 | fig, axs = plt.subplots(1,2)
33 | return fig, axs
34 |
35 | n1 = int((gt.shape[-1])/2)+1
36 | n2 = 2
37 | #with plt.style.context(['science']: #https://github.com/garrettj403/SciencePlots/blob/master/examples/plot-examples.py
38 | #with plt.rc_context(bundles.jmlr2001()):
39 | fig, axs = plt.subplots(n1, n2)
40 | fig.set_size_inches(8, 6) ##set the size of the figure important for nicer plot saving
41 | dim = 0
42 | for i in range(n1):
43 | for j in range(n2):
44 | if dim >= gt.shape[-1]:
45 | break
46 | gt_dim = gt[:,dim]
47 | pred_mu_dim = pred_mu[:, dim]
48 | if pred_std is not None:
49 | pred_std_dim = pred_std[:, dim]
50 | dim = dim + 1
51 |
52 | axs[i, j].plot(gt_dim)
53 | if valid_flag is not None:
54 | axs[i, j].scatter(torch.arange(len(valid_flag))[np.logical_not(valid_flag)],
55 | gt_dim[np.logical_not(valid_flag)], facecolor='red', s=2)
56 | axs[i, j].plot(pred_mu_dim, color='black')
57 | axs[i, j].set_title('Joint '+ str(dim),y = 1.0, pad = -14)
58 | if pred_std is not None:
59 | axs[i, j].fill_between(np.arange(len(gt)), pred_mu_dim - pred_std_dim, pred_mu_dim + pred_std_dim, alpha=0.2, color='grey')
60 |
61 | folder_name = get_original_cwd() + '/logs/latent_plots'
62 | if show == True:
63 | plt.show()
64 | plt.close()
65 | else:
66 | #split exp_name by '/' and take the last one
67 | exp_name_split = exp_name.split('/')
68 | print(exp_name_split)
69 | #plt.show(block=False)
70 |
71 | plt.savefig(folder_name + "/traj_" + str(traj) + '_' + exp_name_split[-1] + ".png", bbox_inches='tight')
72 | image = plt.imread(folder_name + "/traj_" + str(traj) + '_' + exp_name_split[-1] + ".png")
73 | if wandb_run is not None:
74 | key = 'Trajectory_' + str(traj) + '_Step_' + exp_name_split[-2] + "_alog_" + exp_name_split[-1] + "_type_" + exp_name_split[0]
75 | wandb_run.log({ key: wandb.Image(image)})
76 | os.remove(folder_name + "/traj_" + str(traj) + '_' + exp_name_split[-1] + ".png")
77 | plt.close()
78 |
79 | return fig,axs
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 | def plotImputation(gts, valid_flags, pred_mus, pred_vars, wandb_run, l_priors=None, l_posts=None, task_labels=None, num_traj: int =2, log_name='test', exp_name='trial', show=False, latent_Vis=False):
88 | # make a folder to save the plots
89 | if type(gts) is not np.ndarray:
90 | gts = gts.cpu().detach().numpy()
91 | if type(valid_flags) is not np.ndarray:
92 | valid_flags = valid_flags.cpu().detach().numpy()
93 | if type(pred_mus) is not np.ndarray:
94 | pred_mus = pred_mus.cpu().detach().numpy()
95 | if type(pred_vars) is not np.ndarray:
96 | pred_vars = pred_vars.cpu().detach().numpy()
97 | if not os.path.exists(get_original_cwd() + "/logs/output/plots/" + exp_name):
98 | os.makedirs(get_original_cwd() + "/logs/output/plots/" + exp_name)
99 | np.savez(get_original_cwd() + "/logs/output/plots/" + exp_name + "/gt", gts[:100])
100 | np.savez(get_original_cwd() + "/logs/output/plots/" + exp_name + "/pred_mean_" + str(wandb_run.id), pred_mus[:100])
101 | np.savez(get_original_cwd() + "/logs/output/plots/" + exp_name + "/valid_flags_" + str(wandb_run.id), valid_flags[:100])
102 | np.savez(get_original_cwd() + "/logs/output/plots/" + exp_name + "/pred_var_" + str(wandb_run.id), pred_vars[:100])
103 |
104 | trjs = np.random.randint(gts.shape[0],size=num_traj)
105 | n=0
106 | for traj in trjs:
107 | gt = gts[traj,:,:]
108 | pred_mu = pred_mus[traj, :, :]
109 | if valid_flags is not None:
110 | valid_flag = valid_flags[traj, :, 0]
111 | else:
112 | valid_flag = None
113 | if pred_vars is not None:
114 | pred_var = pred_vars[traj, :, :]
115 | else:
116 | pred_var = None
117 | fig, axs = plotJoints(gt,pred_mu,pred_var,valid_flag,wandb_run=wandb_run,traj=traj,show=show, exp_name=exp_name)
118 |
119 | folder_name = get_original_cwd() + '/logs/latent_plots'
120 |
121 |
122 |
123 |
124 |
125 | if __name__ == '__main__':
126 | global ax
127 | gt = np.random.rand(10,50,1)
128 | pred = np.random.rand(10,50,1)
129 | std = np.random.uniform(low=0.01, high=0.1, size=(10,50,1))
130 | rs = np.random.RandomState(seed=23541)
131 | obs_valid = rs.rand(gt.shape[0], gt.shape[1], 1) < 1 - 0.5
132 | pred = np.random.rand(10, 50, 1)
133 | plotSimple(gt[1,:,0],obs_valid[1,:,0],pred[1,:,0],pred_std=std[1,:,0])
134 | plotMbrl(gt[1,:,0],pred[1,:,0],pred_std=std[1,:,0])
--------------------------------------------------------------------------------
/utils/serializable.py:
--------------------------------------------------------------------------------
1 | """
2 | Copyright (c) 2016 rllab contributors
3 | https://github.com/rll/rllab
4 | """
5 |
6 | import inspect
7 | import sys
8 |
9 |
10 | class Serializable(object):
11 |
12 | def __init__(self, *args, **kwargs):
13 | self.__args = args
14 | self.__kwargs = kwargs
15 |
16 | def quick_init(self, locals_):
17 | try:
18 | if object.__getattribute__(self, "_serializable_initialized"):
19 | return
20 | except AttributeError:
21 | pass
22 | if sys.version_info >= (3, 0):
23 | spec = inspect.getfullargspec(self.__init__)
24 | # Exclude the first "self" parameter
25 | if spec.varkw:
26 | kwargs = locals_[spec.varkw]
27 | else:
28 | kwargs = dict()
29 | else:
30 | spec = inspect.getargspec(self.__init__)
31 | if spec.keywords:
32 | kwargs = locals_[spec.keywords]
33 | else:
34 | kwargs = dict()
35 | if spec.varargs:
36 | varargs = locals_[spec.varargs]
37 | else:
38 | varargs = tuple()
39 | in_order_args = [locals_[arg] for arg in spec.args][1:]
40 | self.__args = tuple(in_order_args) + varargs
41 | self.__kwargs = kwargs
42 | setattr(self, "_serializable_initialized", True)
43 |
44 | def __getstate__(self):
45 | return {"__args": self.__args, "__kwargs": self.__kwargs}
46 |
47 | def __setstate__(self, d):
48 | out = type(self)(*d["__args"], **d["__kwargs"])
49 | self.__dict__.update(out.__dict__)
50 |
51 | @classmethod
52 | def clone(cls, obj, **kwargs):
53 | assert isinstance(obj, Serializable)
54 | d = obj.__getstate__()
55 |
56 | # Split the entries in kwargs between positional and keyword arguments
57 | # and update d['__args'] and d['__kwargs'], respectively.
58 | if sys.version_info >= (3, 0):
59 | spec = inspect.getfullargspec(obj.__init__)
60 | else:
61 | spec = inspect.getargspec(obj.__init__)
62 | in_order_args = spec.args[1:]
63 |
64 | d["__args"] = list(d["__args"])
65 | for kw, val in kwargs.items():
66 | if kw in in_order_args:
67 | d["__args"][in_order_args.index(kw)] = val
68 | else:
69 | d["__kwargs"][kw] = val
70 |
71 | out = type(obj).__new__(type(obj))
72 | out.__setstate__(d)
73 | return out
74 |
--------------------------------------------------------------------------------
/utils/utils.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import scipy
3 | import scipy.signal
4 | import json
5 | import gdown
6 | import tensorflow as tf
7 |
8 | def compile_function(inputs, outputs, log_name=None):
9 | def run(*input_vals):
10 | sess = tf.get_default_session()
11 | return sess.run(outputs, feed_dict=dict(list(zip(inputs, input_vals))))
12 |
13 | return run
14 |
15 | def get_original_tf_name(name):
16 | """
17 | Args:
18 | name (str): full name of the tf variable with all the scopes
19 |
20 | Returns:
21 | (str): name given to the variable when creating it (i.e. name of the variable w/o the scope and the colons)
22 | """
23 | return name.split("/")[-1].split(":")[0]
24 |
25 |
26 | def remove_scope_from_name(name, scope):
27 | """
28 | Args:
29 | name (str): full name of the tf variable with all the scopes
30 |
31 | Returns:
32 | (str): full name of the variable with the scope removed
33 | """
34 | result = name.split(scope)[1]
35 | result = result[1:] if result[0] == '/' else result
36 | return result.split(":")[0]
37 |
38 | def remove_first_scope_from_name(name):
39 | return name.replace(name + '/', "").split(":")[0]
40 |
41 | def get_last_scope(name):
42 | """
43 | Args:
44 | name (str): full name of the tf variable with all the scopes
45 |
46 | Returns:
47 | (str): name of the last scope
48 | """
49 | return name.split("/")[-2]
50 |
51 |
52 | def extract(x, *keys):
53 | """
54 | Args:
55 | x (dict or list): dict or list of dicts
56 |
57 | Returns:
58 | (tuple): tuple with the elements of the dict or the dicts of the list
59 | """
60 | if isinstance(x, dict):
61 | return tuple(x[k] for k in keys)
62 | elif isinstance(x, list):
63 | return tuple([xi[k] for xi in x] for k in keys)
64 | else:
65 | raise NotImplementedError
66 |
67 |
68 | def normalize_advantages(advantages):
69 | """
70 | Args:
71 | advantages (np.ndarray): np array with the advantages
72 |
73 | Returns:
74 | (np.ndarray): np array with the advantages normalized
75 | """
76 | return (advantages - np.mean(advantages)) / (advantages.std() + 1e-8)
77 |
78 |
79 | def shift_advantages_to_positive(advantages):
80 | return (advantages - np.min(advantages)) + 1e-8
81 |
82 |
83 | def discount_cumsum(x, discount):
84 | """
85 | See https://docs.scipy.org/doc/scipy/reference/tutorial/signal.html#difference-equation-filtering
86 |
87 | Returns:
88 | (float) : y[t] - discount*y[t+1] = x[t] or rev(y)[t] - discount*rev(y)[t-1] = rev(x)[t]
89 | """
90 | return scipy.signal.lfilter([1], [1, float(-discount)], x[::-1], axis=0)[::-1]
91 |
92 |
93 | def explained_variance_1d(ypred, y):
94 | """
95 | Args:
96 | ypred (np.ndarray): predicted values of the variable of interest
97 | y (np.ndarray): real values of the variable
98 |
99 | Returns:
100 | (float): variance explained by your estimator
101 |
102 | """
103 | assert y.ndim == 1 and ypred.ndim == 1
104 | vary = np.var(y)
105 | if np.isclose(vary, 0):
106 | if np.var(ypred) > 0:
107 | return 0
108 | else:
109 | return 1
110 | return 1 - np.var(y - ypred) / (vary + 1e-8)
111 |
112 |
113 | def concat_tensor_dict_list(tensor_dict_list):
114 | """
115 | Args:
116 | tensor_dict_list (list) : list of dicts of lists of tensors
117 |
118 | Returns:
119 | (dict) : dict of lists of tensors
120 | """
121 | keys = list(tensor_dict_list[0].keys())
122 | ret = dict()
123 | for k in keys:
124 | example = tensor_dict_list[0][k]
125 | if isinstance(example, dict):
126 | v = concat_tensor_dict_list([x[k] for x in tensor_dict_list])
127 | else:
128 | v = np.concatenate([x[k] for x in tensor_dict_list])
129 | ret[k] = v
130 | return ret
131 |
132 |
133 | def _stack_tensor_dict_list(tensor_dict_list):
134 | """
135 | Args:
136 | tensor_dict_list (list) : list of dicts of lists of tensors
137 |
138 | Returns:
139 | (dict) : dict of lists of tensors
140 | """
141 | keys = list(tensor_dict_list[0].keys())
142 | ret = dict()
143 | for k in keys:
144 | example = tensor_dict_list[0][k]
145 | if isinstance(example, dict):
146 | v = concat_tensor_dict_list([x[k] for x in tensor_dict_list])
147 | else:
148 | v = np.stack([x[k] for x in tensor_dict_list])
149 | ret[k] = v
150 | return ret
151 |
152 |
153 | def stack_tensor_dict_list(tensor_dict_list, max_path=None):
154 | """
155 | Args:
156 | tensor_dict_list (list) : list of dicts of tensors
157 |
158 | Returns:
159 | (dict) : dict of lists of tensors
160 | """
161 | keys = list(tensor_dict_list[0].keys())
162 | ret = dict()
163 | for k in keys:
164 | example = tensor_dict_list[0][k]
165 | if isinstance(example, dict):
166 | v = stack_tensor_dict_list([x[k] for x in tensor_dict_list])
167 | else:
168 | if max_path is not None:
169 | v = np.asarray([
170 | np.concatenate([x[k], np.zeros((max_path - x[k].shape[0],) + x[k].shape[1:])])
171 | for x in tensor_dict_list])
172 | else:
173 | v = np.asarray([x[k] for x in tensor_dict_list])
174 | ret[k] = v
175 | return ret
176 |
177 |
178 | def create_feed_dict(placeholder_dict, value_dict):
179 | """
180 | matches the placeholders with their values given a placeholder and value_dict.
181 | The keys in both dicts must match
182 |
183 | Args:
184 | placeholder_dict (dict): dict of placeholders
185 | value_dict (dict): dict of values to be fed to the placeholders
186 |
187 | Returns: feed dict
188 |
189 | """
190 | assert set(placeholder_dict.keys()) <= set(value_dict.keys()), \
191 | "value dict must provide the necessary data to serve all placeholders in placeholder_dict"
192 | # match the placeholders with their values
193 | return dict([(placeholder_dict[key], value_dict[key]) for key in placeholder_dict.keys()])
194 |
195 | def set_seed(seed):
196 | """
197 | Set the random seed for all random number generators
198 |
199 | Args:
200 | seed (int) : seed to use
201 |
202 | Returns:
203 | None
204 | """
205 | import random
206 | import tensorflow as tf
207 | seed %= 4294967294
208 | random.seed(seed)
209 | np.random.seed(seed)
210 | tf.set_random_seed(seed)
211 | print('using seed %s' % (str(seed)))
212 |
213 |
214 | class ClassEncoder(json.JSONEncoder):
215 | def default(self, o):
216 | if isinstance(o, type):
217 | return {'$class': o.__module__ + "." + o.__name__}
218 | if callable(o):
219 | return {'function': o.__name__}
220 | return json.JSONEncoder.default(self, o)
221 |
--------------------------------------------------------------------------------