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
Make FiniteDifferenceHvp pickleable #745
Conversation
Codecov Report
@@ Coverage Diff @@
## master #745 +/- ##
==========================================
+ Coverage 67.57% 67.59% +0.01%
==========================================
Files 164 164
Lines 10197 10201 +4
Branches 1335 1335
==========================================
+ Hits 6891 6895 +4
Misses 2958 2958
Partials 348 348
Continue to review full report at Codecov.
|
@ahtsan can you add a test which would have caught this bug? i think you can just run one step of TRPO with the LSTM policy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a test which would have caught this
del new_dict['opt_fun'] | ||
return new_dict | ||
|
||
def __setstate__(self, state): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to re-create opt_fun
here?
If you don't, then you should be able to delete this __setstate__
implementation, since this is the "default."
Note that you'll still have a __getstate__
implementation then, despite not having a __setstate__
implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, will remove __getstate__
since opt_fun
is recreated somewhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as long as you resolve Ryan and KR's comments
Currently all policies using `FiniteDifferenceHvp` in `examples/tf/` don't work because `FiniteDifferenceHvp` is not pickleable. This PR fixes the issue, and also update outdated arguments in some TRPO usage.
Currently all policies using `FiniteDifferenceHvp` in `examples/tf/` don't work because `FiniteDifferenceHvp` is not pickleable. This PR fixes the issue, and also update outdated arguments in some TRPO usage.
Currently all policies using `FiniteDifferenceHvp` in `examples/tf/` don't work because `FiniteDifferenceHvp` is not pickleable. This PR fixes the issue, and also update outdated arguments in some TRPO usage.
Currently all policies using `FiniteDifferenceHvp` in `examples/tf/` don't work because `FiniteDifferenceHvp` is not pickleable. This PR fixes the issue, and also update outdated arguments in some TRPO usage.
* Make FiniteDifferenceHvp pickleable (#745) Currently all policies using `FiniteDifferenceHvp` in `examples/tf/` don't work because `FiniteDifferenceHvp` is not pickleable. This PR fixes the issue, and also update outdated arguments in some TRPO usage. * Convert tests to run with pytest * Use pytest-cov for coverage * Fix broken tests * Fix code formatting * Fix more formatting * Fix typo in TestSanpshotter class name * Update new tests to use pytest format
Currently all policies using `FiniteDifferenceHvp` in `examples/tf/` don't work because `FiniteDifferenceHvp` is not pickleable. This PR fixes the issue, and also update outdated arguments in some TRPO usage.
Currently all policies using `FiniteDifferenceHvp` in `examples/tf/` don't work because `FiniteDifferenceHvp` is not pickleable. This PR fixes the issue, and also update outdated arguments in some TRPO usage.
Currently all policies using `FiniteDifferenceHvp` in `examples/tf/` don't work because `FiniteDifferenceHvp` is not pickleable. This PR fixes the issue, and also update outdated arguments in some TRPO usage.
Currently all policies using `FiniteDifferenceHvp` in `examples/tf/` don't work because `FiniteDifferenceHvp` is not pickleable. This PR fixes the issue, and also update outdated arguments in some TRPO usage.
Currently all policies using `FiniteDifferenceHvp` in `examples/tf/` don't work because `FiniteDifferenceHvp` is not pickleable. This PR fixes the issue, and also update outdated arguments in some TRPO usage.
Currently all policies using `FiniteDifferenceHvp` in `examples/tf/` don't work because `FiniteDifferenceHvp` is not pickleable. This PR fixes the issue, and also update outdated arguments in some TRPO usage.
Currently all policies using `FiniteDifferenceHvp` in `examples/tf/` don't work because `FiniteDifferenceHvp` is not pickleable. This PR fixes the issue, and also update outdated arguments in some TRPO usage.
Currently all policies using `FiniteDifferenceHvp` in `examples/tf/` don't work because `FiniteDifferenceHvp` is not pickleable. This PR fixes the issue, and also update outdated arguments in some TRPO usage.
Currently all policies using `FiniteDifferenceHvp` in `examples/tf/` don't work because `FiniteDifferenceHvp` is not pickleable. This PR fixes the issue, and also update outdated arguments in some TRPO usage.
Currently all policies using `FiniteDifferenceHvp` in `examples/tf/` don't work because `FiniteDifferenceHvp` is not pickleable. This PR fixes the issue, and also update outdated arguments in some TRPO usage.
Currently all policies using `FiniteDifferenceHvp` in `examples/tf/` don't work because `FiniteDifferenceHvp` is not pickleable. This PR fixes the issue, and also update outdated arguments in some TRPO usage.
Currently all policies using
FiniteDifferenceHvp
inexamples/tf/
don't work becauseFiniteDifferenceHvp
is not pickleable.This PR fixes the issue, and also update outdated arguments in some TRPO usage.