Assignment 1 Gym environment

Original price was: $35.00.Current price is: $30.00.

Rate this product

CMPE260 Assignment 1
The goal of this assignment is for you to become familiar with gym environment,
apply vae deep learning algorithm implementation,
and see how the training/inference looks like in code.

### Goals
* explore the gym framework for training rl agents.
* apply your knowledge of VAE to learn image generation.
* train generative models to produce sample pixel observation images from gym environments.

### What to submit
* your ``.
* a doc with generated images and answers to questions in activities.

### Environment
[OpenAI’s Gym]( is a framework for training reinforcement
learning agents. It provides a set of environments and a
standardized interface for interacting with those.
In this assignment we will use the [CartPole]( environment from gym.

### Installation

#### Using conda (recommended)
1. [Install Anaconda](

2. Create the env
`conda create a1 python=3.8`

3. Activate the env
`conda activate a1`

4. install torch ([steps from pytorch installation guide](
– if you don’t have an nvidia gpu or don’t want to bother with cuda installation:
`conda install pytorch torchvision torchaudio cpuonly -c pytorch`

– if you have an nvidia gpu and want to use it:
[install cuda](
install torch with cuda:
`conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch`

5. other dependencies
`conda install -c conda-forge matplotlib gym opencv pyglet`

#### Using pip
`python3 -m pip install -r requirements.txt`

### Code
`` – your VAE model
`` – script to collect pixel observations from gym environments using a random policy and train a vae model
`` – samples from a vae trained by

### Activities

1. Finish the `__init__()` in `` model.
At this point this is not really a VAE yet, but you should be able
to train the model. Run `` to train.
Then, run `` to generate a few images with your model.
*Note: you can run `` to quickly test if your model is working.
Save two generated images.
What model components are used in the forward pass and in sampling?

2. By default, the model behaves as an autoencoder. Upgrade it to
VAE by modifying `forward()`, `encode()`, and `reparameterize()`
in ``.
Train and save two generated images.
Describe the difference between the AE and VAE models.
What is the reparametrization trick?

3. Update the `` to reset
the environment after the first 20 observations from each episode.
Train and save two generated images.
when does the cartpole environment return done=True?

4. update the `` train vae on
observations with a custom angle range. Pick some max and min vales for image observations that
will make generated observations look different from the previous outputs. Don’t use states that
too far from the initialization state, so that the sampling doesn’t take too long.
Train and save two generated images.

5. pick [some other gym environment]((
(environments outside the classical control may require you to install additional libraries)
and train vae on it.
Train and save two generated images.

Have fun!


There are no reviews yet.

Be the first to review “Assignment 1 Gym environment”

Your email address will not be published. Required fields are marked *

Scroll to Top