未验证 提交 1bdfd2eb 编写于 作者: W whs 提交者: GitHub

Fix checkpoint of Light-NAS (#18330)

Socket can't be pickled.
test=develop
上级 79bcdbbf
...@@ -127,6 +127,14 @@ class LightNASStrategy(Strategy): ...@@ -127,6 +127,14 @@ class LightNASStrategy(Strategy):
self._search_agent = SearchAgent( self._search_agent = SearchAgent(
self._server_ip, self._server_port, key=self._key) 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): def _constrain_func(self, tokens, context=None):
"""Check whether the tokens meet constraint.""" """Check whether the tokens meet constraint."""
_, _, test_prog, _, _, _, _ = context.search_space.create_net(tokens) _, _, test_prog, _, _, _, _ = context.search_space.create_net(tokens)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册