save videos during training
Description
This addresses Issue #523 to automatically save videos during training time. This builds off of the following, earlier PR.
Known Limitations: (1) Will not necessarily save a video at the end of the training run - it just saves a video at the first episode after each checkpoint. (2) Saves videos during training episodes (and not in a separate, evaluation environment)
Testing
Added tests to test_scripts.
A lot of the test failures on Mac seem to be down to ffmpeg not being installed. I think we removed that in https://github.com/HumanCompatibleAI/imitation/pull/539 as it was making Mac OS build times very high, although an alternative that might be worth revisiting is installing ffmpeg from a static executable (it was compiling it under brew that was slow). Alternatively we can just skip the video tests on Mac, as we do the others.
Codecov Report
Merging #597 (7714484) into master (d6f8ca2) will increase coverage by
0.04%. The diff coverage is98.90%.
@@ Coverage Diff @@
## master #597 +/- ##
==========================================
+ Coverage 97.49% 97.54% +0.04%
==========================================
Files 85 85
Lines 8099 8176 +77
==========================================
+ Hits 7896 7975 +79
+ Misses 203 201 -2
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/imitation/scripts/common/rl.py | 97.43% <ø> (ø) |
|
| src/imitation/scripts/train_adversarial.py | 94.87% <83.33%> (+0.20%) |
:arrow_up: |
| src/imitation/scripts/common/common.py | 97.82% <100.00%> (+0.29%) |
:arrow_up: |
| src/imitation/scripts/config/train_adversarial.py | 71.25% <100.00%> (+0.36%) |
:arrow_up: |
| src/imitation/scripts/config/train_imitation.py | 71.66% <100.00%> (+3.87%) |
:arrow_up: |
| ...ion/scripts/config/train_preference_comparisons.py | 85.52% <100.00%> (+0.19%) |
:arrow_up: |
| src/imitation/scripts/config/train_rl.py | 79.22% <100.00%> (+0.27%) |
:arrow_up: |
| src/imitation/scripts/eval_policy.py | 100.00% <100.00%> (ø) |
|
| src/imitation/scripts/train_imitation.py | 95.65% <100.00%> (+0.06%) |
:arrow_up: |
| .../imitation/scripts/train_preference_comparisons.py | 97.01% <100.00%> (+0.13%) |
:arrow_up: |
| ... and 6 more |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more