RosenblockChainers/Unity_RL

I can't save .bytes file! Plz help

Opened this issue · 1 comments

Hello
I am following this Unity example.
In training process, few seconds later, it show "list index out of range" error
I think the error is about "freeze_graph.py", saving bytes files

Please help me

System information

Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
I do not modify any of the source code
OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
MacOS High Sierra 10.13.6

TensorFlow installed from (source or binary):
source (pip3)
TensorFlow version (use command below):
1.10.1
Python version:
3.6
_ **Bazel version
N
_ **CUDA/cuDNN version
N
_ **GPU model and memory

Unity_RL git:(master) ✗ python3 python/run_hill_climbing.py /Users/wsl/Unity_RL/python/test.app --run_id=11 --train

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6
return f(*args, **kwds)
CrashReporter: initialized
Mono path[0] = '/Users/wsl/Unity_RL/python/test.app/Contents/Resources/Data/Managed'
Mono config path = '/Users/wsl/Unity_RL/python/test.app/Contents/MonoBleedingEdge/etc'
PlayerConnection initialized from /Users/wsl/Unity_RL/python/test.app/Contents/Resources/Data (debug = 0)
PlayerConnection initialized network socket : 0.0.0.0 55054
Multi-casting "[IP] 192.168.43.65 [Port] 55054 [Flags] 2 [Guid] 1965391316 [EditorId] 2137687650 [Version] 1048832 [Id] OSXPlayer(WSLs-MBP) [Debug] 0 [PackageName] OSXPlayer" to [225.0.0.222:54997]...
Started listening to [0.0.0.0:55054]
PlayerConnection already initialized - listening to [0.0.0.0:55054]
INFO:unityagents:
'CartPoleAcademy' started successfully!
Unity Academy name: CartPoleAcademy
Number of Brains: 1
Number of External Brains : 1
Lesson number : 0
Reset Parameters :

Unity brain name: CartPoleBrain
Number of Visual Observations (per agent): 0
Vector Observation space type: continuous
Vector Observation space size (per agent): 4
Number of stacked Vector Observation: 1
Vector Action space type: discrete
Vector Action space size (per agent): 2
Vector Action descriptions: Left, Right
Unity Academy name: CartPoleAcademy
Number of Brains: 1
Number of External Brains : 1
Lesson number : 0
Reset Parameters :

Unity brain name: CartPoleBrain
Number of Visual Observations (per agent): 0
Vector Observation space type: continuous
Vector Observation space size (per agent): 4
Number of stacked Vector Observation: 1
Vector Action space type: discrete
Vector Action space size (per agent): 2
Vector Action descriptions: Left, Right
2018-09-13 11:13:43.954012: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Successfully saved: ./models/11/model-0.cptk
iteration: 0, num_episode: 5, step: 562, total_reward: 111.4, best_total_reward: 111.4
iteration: 10, num_episode: 55, step: 5932, total_reward: 64.2, best_total_reward: 316.0
iteration: 20, num_episode: 105, step: 10519, total_reward: 8.0, best_total_reward: 316.0
iteration: 30, num_episode: 155, step: 23525, total_reward: 7.4, best_total_reward: 452.2
Successfully saved: ./models/11/model-31.cptk
./models/11/test_11.bytes
Traceback (most recent call last):
File "python/run_hill_climbing.py", line 51, in
main()
File "python/run_hill_climbing.py", line 44, in main
trainer.train()
File "/Users/wsl/Unity_RL/python/hill_climbing/trainer.py", line 127, in train
export_graph(self.model_path, self.env_name, self.run_id)
File "/Users/wsl/Unity_RL/python/common/save_utils.py", line 42, in export_graph
filename_tensor_name="save/Const:0")
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/tools/freeze_graph.py", line 254, in freeze_graph
checkpoint_version=checkpoint_version)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/tools/freeze_graph.py", line 128, in freeze_graph_with_def_protos
var_list=var_list, write_version=checkpoint_version)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1281, in init
self.build()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1293, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1330, in _build
build_save=build_save, build_restore=build_restore)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 756, in _build_internal
saveables = self._ValidateAndSliceInputs(names_to_saveables)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 663, in _ValidateAndSliceInputs
for converted_saveable_object in self.SaveableObjectsForOp(op, name):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 637, in SaveableObjectsForOp
variable, "", name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 121, in init
self.handle_op = var.op.inputs[0]
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2001, in getitem
return self._inputs[i]
IndexError: list index out of range

file list
checkpoint model-31.cptk.data-00000-of-00001
model-0.cptk.data-00000-of-00001 model-31.cptk.index
model-0.cptk.index model-31.cptk.meta
model-0.cptk.meta raw_graph_def.pb

Thank you for your post.

This problem seems to occur when tensorflow version is 1.9.0 or higher.
tensorflow/tensorflow#22029

I fixed the version of tensorflow in python/requirement.txt.
Would you downgrade the version of tensorflow to 1.8.0 or lower and try again?