Skip to content

Commit

Permalink
Fix checkpoint of Light-NAS (#18332)
Browse files Browse the repository at this point in the history
Socket can't be pickled.

test=release/1.5
  • Loading branch information
wanghaoshuang authored Jun 26, 2019
1 parent e517202 commit e0cb671
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/paddle/fluid/contrib/slim/nas/light_nas_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ def on_compression_begin(self, context):
self._search_agent = SearchAgent(
self._server_ip, self._server_port, key=self._key)

def __getstate__(self):
"""Socket can't be pickled."""
d = {}
for key in self.__dict__:
if key not in ["_search_agent", "_server"]:
d[key] = self.__dict__[key]
return d

def _constrain_func(self, tokens, context=None):
"""Check whether the tokens meet constraint."""
_, _, test_prog, _, _, _, _ = context.search_space.create_net(tokens)
Expand Down

0 comments on commit e0cb671

Please sign in to comment.