rlworkgroup / garage

A toolkit for reproducible reinforcement learning research.
MIT License
1.84k stars 309 forks source link

Add gpu pickleable module to torch #2265

Closed ziyiwu9494 closed 3 years ago

ziyiwu9494 commented 3 years ago

A potential fix for #2079, by creating an garage.torch.Module wrapper class which implements pickling with moving to cpu on pickle and back to original device on unpickle if the device exists.

codecov[bot] commented 3 years ago

Codecov Report

Merging #2265 (3654cf0) into master (90b6090) will decrease coverage by 0.02%. The diff coverage is 82.60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2265      +/-   ##
==========================================
- Coverage   91.20%   91.17%   -0.03%     
==========================================
  Files         199      199              
  Lines       11627    10996     -631     
  Branches     1557     1392     -165     
==========================================
- Hits        10604    10026     -578     
+ Misses        754      703      -51     
+ Partials      269      267       -2     
Impacted Files Coverage Δ
src/garage/torch/_functions.py 90.84% <80.95%> (-3.49%) :arrow_down:
src/garage/torch/policies/policy.py 100.00% <100.00%> (ø)
src/garage/torch/optimizers/optimizer_wrapper.py 93.75% <0.00%> (-6.25%) :arrow_down:
src/garage/sampler/env_update.py 82.92% <0.00%> (-3.62%) :arrow_down:
src/garage/torch/optimizers/differentiable_sgd.py 86.66% <0.00%> (-3.34%) :arrow_down:
src/garage/torch/policies/stochastic_policy.py 88.63% <0.00%> (-3.17%) :arrow_down:
src/garage/torch/algos/trpo.py 91.66% <0.00%> (-3.08%) :arrow_down:
src/garage/torch/algos/dqn.py 93.07% <0.00%> (-2.09%) :arrow_down:
src/garage/np/_functions.py 77.39% <0.00%> (-1.74%) :arrow_down:
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 90b6090...3654cf0. Read the comment docs.