Commit e6bd7188 authored by Yuxin Wu's avatar Yuxin Wu

TENSORPACK_SERIALIZE (#746)

parent 3dd7171d
...@@ -9,7 +9,7 @@ Here are a list of things that were changed, starting from an early version. ...@@ -9,7 +9,7 @@ Here are a list of things that were changed, starting from an early version.
TensorFlow itself also changed APIs before 1.0 and those are not listed here. TensorFlow itself also changed APIs before 1.0 and those are not listed here.
+ [2018/04/05] msgpack is replaced by pyarrow. If you want compatibility with old serialized data, + [2018/04/05] msgpack is replaced by pyarrow. If you want compatibility with old serialized data,
manually uninstall pyarrow, and msgpack will be used as a fallback. `export TENSORPACK_SERIALIZE=msgpack`.
+ [2018/03/20] `ModelDesc` starts to use simplified interfaces: + [2018/03/20] `ModelDesc` starts to use simplified interfaces:
+ `_get_inputs()` renamed to `inputs()` and returns `tf.placeholder`s. + `_get_inputs()` renamed to `inputs()` and returns `tf.placeholder`s.
+ `build_graph(self, tensor1, tensor2)` returns the cost tensor directly. + `build_graph(self, tensor1, tensor2)` returns the cost tensor directly.
......
...@@ -87,7 +87,7 @@ class SimulatorProcessStateExchange(SimulatorProcessBase): ...@@ -87,7 +87,7 @@ class SimulatorProcessStateExchange(SimulatorProcessBase):
c2s_socket.send(dumps( c2s_socket.send(dumps(
(self.identity, state, reward, isOver)), (self.identity, state, reward, isOver)),
copy=False) copy=False)
action = loads(s2c_socket.recv(copy=False).bytes) action = loads(s2c_socket.recv(copy=False))
state, reward, isOver, _ = player.step(action) state, reward, isOver, _ = player.step(action)
if isOver: if isOver:
state = player.reset() state = player.reset()
...@@ -144,7 +144,7 @@ class SimulatorMaster(threading.Thread): ...@@ -144,7 +144,7 @@ class SimulatorMaster(threading.Thread):
self.clients = defaultdict(self.ClientState) self.clients = defaultdict(self.ClientState)
try: try:
while True: while True:
msg = loads(self.c2s_socket.recv(copy=False).bytes) msg = loads(self.c2s_socket.recv(copy=False))
ident, state, reward, isOver = msg ident, state, reward, isOver = msg
client = self.clients[ident] client = self.clients[ident]
if client.ident is None: if client.ident is None:
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# File: serialize.py # File: serialize.py
import os
from .develop import create_dummy_func from .develop import create_dummy_func
__all__ = ['loads', 'dumps'] __all__ = ['loads', 'dumps']
...@@ -61,7 +62,7 @@ except ImportError: ...@@ -61,7 +62,7 @@ except ImportError:
dumps_msgpack = create_dummy_func( # noqa dumps_msgpack = create_dummy_func( # noqa
'dumps_msgpack', ['msgpack', 'msgpack_numpy']) 'dumps_msgpack', ['msgpack', 'msgpack_numpy'])
if pa is None: if pa is None or os.environ.get('TENSORPACK_SERIALIZE', None) == 'msgpack':
loads = loads_msgpack loads = loads_msgpack
dumps = dumps_msgpack dumps = dumps_msgpack
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment