Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve tutorial and example overviews #291

Merged
merged 14 commits into from Jan 13, 2023
Merged

Conversation

btjanaka
Copy link
Member

@btjanaka btjanaka commented Jan 5, 2023

Description

Various updates to tutorials to fit the new release of pyribs. This PR reframes the tutorials and examples, and there will be several followup PRs to implement and smooth out all the tutorials.

TODO

Questions

Status

  • I have read the guidelines in CONTRIBUTING.md
  • I have formatted my code using yapf
  • I have tested my code by running pytest
  • I have linted my code with pylint
  • I have added a one-line description of my change to the changelog in HISTORY.md
  • This PR is ready to go

@btjanaka btjanaka changed the title Edit tutorials to improve their flow Edit tutorials to improve flow Jan 5, 2023
btjanaka and others added 5 commits January 11, 2023 18:41
@btjanaka btjanaka changed the title Edit tutorials to improve flow Edit tutorial and example overviews Jan 12, 2023
@btjanaka btjanaka changed the title Edit tutorial and example overviews Improve tutorial and example overviews Jan 12, 2023
@btjanaka btjanaka merged commit 2d72eaf into master Jan 13, 2023
@btjanaka btjanaka deleted the docs/tutorial-reframe branch January 13, 2023 05:20
btjanaka added a commit that referenced this pull request Jan 14, 2023
## Description

<!-- Provide a brief description of the PR's purpose here. -->

We update the tutorial so that it is in line with the new tutorial
structure in #291. We also expand the features demonstrated in this
tutorial.

Depends on #291 and #295

### moviepy woes

**Update:** It turns out this was all due to the decorator module not
being loaded properly; see Zulko/moviepy#1625
-- we just have to reload decorator so that moviepy imports it
correctly.

One notable issue was that the tutorial needed ffmpeg to be installed in
order to generate videos; this happens because the new Gymansium depends
on moviepy for video recording, which in turn depends on ffmpeg. This is
not a problem for Colab users as ffmpeg is already installed there, but
local users may encounter frustration -- the video generation happens
after the run, so they may do the run, wait for 2 hours, and then see
that the videos fail. The steps that fail are as follows:

1. Create a Conda environment with Python 3.7 and activate it.
2. Install the package with `pip install -e .[visualize]`
3. Install jupyterlab with `pip install jupyterlab`
4. Start jupyterlab and run the notebook.
5. Leads to error on first `display_video` line with message looking
like:
    ```
         86             '-s', '%dx%d' % (size[0], size[1]),
         87             '-pix_fmt', 'rgba' if withmask else 'rgb24',
    ---> 88             '-r', '%.02f' % fps,
         89             '-an', '-i', '-'
         90         ]

    TypeError: must be real number, not NoneType
    ```

It appears that if you re-run the notebook without changing anything,
everything then works, perhaps because `imageio_ffmpeg` has had time to
load its ffmpeg executable (under the hood moviepy uses `imageio_ffmpeg`
to get ffmpeg).

I tried to see if we could overcome this by loading the ffmpeg
executable early on, but it did not work:
```python
import imageio_ffmpeg
imageio_ffmpeg.get_ffmpeg_exe()
```

I also tried installing moviepy beforehand, so if it is installed before
running the notebook, everything works.

## TODO

<!-- Notable points that this PR has either accomplished or will
accomplish. -->

- [x] Update tutorial to reference the lunar lander MAE tutorial
- [x] Log QD score in tutorial
- [x] Add CQD score to tutorial -> doesn't fit
- [x] Cut back on notes
- [x] Link to documentation for features when mentioning them
- [x] Show `best_elite`
- [x] Explain elites_with_measures
- [x] Explain two-stage improvement ranking
- [x] Make sure the imports are still correct after changes
- [x] Add QD score offset (find paper which explains offsets)
- [x] Replace all `latest` links with `stable` (links will be broken but
it's okay)
- [x] Rerun the tutorial to have consistent images

## Questions

<!-- Any concerns or points of confusion? -->

## Status

- [x] I have read the guidelines in
[CONTRIBUTING.md](https://github.com/icaros-usc/pyribs/blob/master/CONTRIBUTING.md)
- [x] I have formatted my code using `yapf`
- [x] I have tested my code by running `pytest`
- [x] I have linted my code with `pylint`
- [x] I have added a one-line description of my change to the changelog
in `HISTORY.md`
- [x] This PR is ready to go
btjanaka added a commit that referenced this pull request Jan 17, 2023
## Description

<!-- Provide a brief description of the PR's purpose here. -->

As was introduced in #291, this tutorial shows how to run CMA-MAE with
the lunar lander.

## TODO

<!-- Notable points that this PR has either accomplished or will
accomplish. -->

- [x] Edit CMA-MAE tutorial
- [x] Edit lunar lander tutorial to match
- [x] Run through CONTRIBUTING checklist for CMA-MAE

## Questions

<!-- Any concerns or points of confusion? -->

## Status

- [x] I have read the guidelines in
[CONTRIBUTING.md](https://github.com/icaros-usc/pyribs/blob/master/CONTRIBUTING.md)
- [x] I have formatted my code using `yapf`
- [x] I have tested my code by running `pytest`
- [x] I have linted my code with `pylint`
- [x] ~I have added a one-line description of my change to the changelog
in `HISTORY.md`~
- [x] This PR is ready to go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant