Having errors loading tensorflow online


#1

My bot seems okay on my local machine, but online I am getting the following error below. I thought keras/tensorflow are available on the server? Anybody know whats causing this? Had to comment out all keras/tensorflow imports/functions to make my bot run online.

[ {
"Error": {
"Message": "ERRORED! Got Exception (if any): ERROR: Bot #0: Received invalid character '2018-01-04 19:39:56.835704: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.:'. (at character 14.)\nInput received from bot:\n2018-01-04 19:39:56.835704: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.\n ^; Response received (if any): 2018-01-04 19:39:56.835704: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.2018-01-04 19:39:56.835753: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.2018-01-04 19:39:56.835760: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.2018-01-04 19:39:56.835763: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations ...


#2

What version of TensorFlow are you running? I'm guessing you have 1.3+, I do believe Halite runs 1.2


#3

I had this error and I solved it using by following the discussion in this link:
https://forums.halite.io/t/prevent-hlt-engine-from-getting-output-from-training-a-model-in-game/537/2

The initial log from tensorflow is causing the problem


#4

I actually posted that question lol. It doesnt seem to be that.

When i do:

import tensorflow as tf; print(tf.version)
import keras as k; print(k.version)

I get 0.12.1 and 2.0.6 respectively.


#5

whoops, sorry I missed that.
I think tensorflow and keras versions are not related to each other.

Usually when I use tensorflow i get the same warning that you are getting here. It's just telling you that you can speed up your computations using AVX instructions (not really useful if you have a gpu).

Check this line though:
Bot #0: Received invalid character '2018-01-04 19:39:56.835704.

This means that the warning is interrupting the com protocol between your bot and the game engine. To get rid of this error I had to follow the discussion that I linked.


#6

I think i know what you are saying. Just curious why this warning does not show up on my local machine. Anyways, do you do everything that csheldrick stated? Meaning that entire code block?


#7

First I do this:
import sys, os
stderr = sys.stderr
sys.stderr = open(os.devnull, 'w')

Then I import keras and tensorflow and load all the models that I want.
After that do this:
sys.stderr = stderr

so you basically reset sys.stderr to its initial value after dumping all the unwanted logs. You can also do it with stdout instead of stderr.


#8

Hmm no luck. This still causes the same error. Have you tried uploading your bot with these fixes? And it works okay?


#9

I only tested it on my local machine.


#10

ok well let me know once you submitted online. I have no issues on my local machine as well, until i upload


#11

One workaround is to patch the value of sys.stderr before importing tensorflow.

EDIT: Nevermind, saw @TrustLak had already suggested that.