Experiments

Imitating Latent Policy from Observation 2

자월현 2020. 12. 26.

1. stable-baselines 에서 VecVideoRecorder를 가지고 gym 환경 녹화하기 (mujoco는 안됨. atari랑 classic control만 되더라 - mujoco는 rendering 환경에서 video record하는 거만 되는듯..)

colab.research.google.com/github/araffin/rl-tutorial-jnrr19/blob/master/1_getting_started.ipynb#scrollTo=4efFdrQ7MBvl

 

Google Colaboratory

 

colab.research.google.com

이거는 jupyter나 colab에서 돌릴 때 유용할듯.

이 함수는 gym.wrappers.monitoring의 video_recorder.py를 가지고 만든 함수이다.

또한 GIF를 만든다든지,  official 한 도움은, 밑에서 받을 수 있다.

stable-baselines.readthedocs.io/en/master/guide/examples.html

 

Examples — Stable Baselines 2.10.2a1 documentation

PyBullet: Normalizing input features Normalizing input features may be essential to successful training of an RL agent (by default, images are scaled but not other types of input), for instance when training on PyBullet environments. For that, a wrapper ex

stable-baselines.readthedocs.io

이때 pybox2d를 다시 설치해야할 수도 있고, (swig를 설치하거나) - lunarlander example을 돌릴때

 

2. random 함수는 

import random

random.seed(2)  -> 아무 수나 가능.

random.random() 해서 0과 1사이 수를 얻을 수 있다.

 

3. 16.04에서 이 실험을 재현하다보면 - 설치하다보면, mujoco-py 2.0 이상 버전 설치할 때 patchelf를 설치하라는 얘기를 들을 수 있다. - 근데 개귀찮음. <processing>

 

4. video가 잘 만들어지는지 보기위해 VLC player도 설치하고 ubuntu-restricted-extras도 설치해봄. 근데 gym.videorecorder로 만든거는 재생이 안되더라. gif는 잘 보임.

askubuntu.com/questions/214421/how-to-install-the-mpeg-4-aac-decoder-and-the-h-264-decoder

 

5. custom gym env 만들기 -매우 잘 설명해주신다. 

www.youtube.com/watch?v=kd4RrN-FTWY&t=366s

6. error

 

models/ilpo.py 162 tf.compat.v1.set_random_seed

 

models/image_ilpo.py 41 string_input_producer (tensorflow.python.training.input)->

Queue-based input pipelines have been replaced by `tf.data`. Use `tf.data.Dataset.from_tensor_slices(string_tensor).shuffle(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs)`. If `shuffle=False`, omit the `.shuffle(...)`.

 

models/image_ilpo.py:42: WholeFileReader.__init__ (from tensorflow.python.ops.io_ops) is deprecated and will be removed in a future version. ->

Queue-based input pipelines have been replaced by `tf.data`. Use `tf.data.Dataset.map(tf.read_file)`.

 

models/image_ilpo.py:47: The name tf.assert_equal is deprecated. Please use tf.compat.v1.assert_equal instead.

 

7. from_tensor_slices 함수

www.tensorflow.org/api_docs/python/tf/data/Dataset

 

tf.data.Dataset  |  TensorFlow Core v2.4.0

Represents a potentially large set of elements.

www.tensorflow.org

www.tensorflow.org/api_docs/python/tf/data/Iterator

댓글