Skip to content

Commit a9e083a

Browse files
committed
Add cloudpickle wrapper for compatibility
1 parent 3d4368d commit a9e083a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'akro>=0.0.8',
1414
'click>=2.0',
1515
# Older versions don't work with torch.save
16-
'cloudpickle>=1.6.0',
16+
'cloudpickle',
1717
'cma==2.7.0',
1818
'dowel==0.0.3',
1919
'numpy>=1.14.5',

src/garage/experiment/snapshotter.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,12 @@ def save_itr_params(self, itr, params):
136136

137137
if file_name:
138138
if torch:
139+
140+
class _pickle_module:
141+
Pickler = cloudpickle.CloudPickler
142+
139143
params['global_device'] = global_device()
140-
torch.save(params, file_name, pickle_module=cloudpickle)
144+
torch.save(params, file_name, pickle_module=_pickle_module)
141145
else:
142146
with open(file_name, 'wb') as file:
143147
cloudpickle.dump(params, file)

0 commit comments

Comments
 (0)