## How to convert keras model to corml format using coremltools - tensorflow

I want to convert my keras model to coreml using coremltools.
When I try to do this, it gives me an error
ImportError: cannot import name 'relu6'
My tensorflow version is 1.5.1
My keras version is 2.1.6
The complete colab file is here:
https://colab.research.google.com/drive/1kSeErLsp_xaU37haUrwBO5jiNlV2RCll
I have already tried different versions of the modules but I am ready to try a new version I haven't tried

It looks like your installation still tries to use Keras 2.2.0, since the error in coremltools happens after it checks that the Keras version >= 2.2.0.
Write keras.__version__ to see what version of Keras your notebook is really using.
Try installing an older version of keras_applications, one that still has the relu6 function. It was recently changed. The problem with Keras is that stuff often moves around between minor versions.

## Related

### Converting Tensorflow 1.1 model into Tensorflow Lite

I want to convert my tensorflow 1.1 based model into tensorflow lite in order to serve the model locally and remotely for a PWA. The official guide only offers Python APIs for 1.11 at the earliest. Command line tools only seem to work starting at 1.7. Is it possible to convert a 1.1 model to tensorflow lite? Has anyone had experience with this? The tf module is an out-of-the-box pre-trained model using BIDAF. I am having difficulty serving the full tf app on Heroku, which is unable to run it. I would like to try a tf lite app to see if hosting it locally will make it faster, and easier to set up as a PWA.

### Updating Tensorflow Distributions to Tensorflow Probability

As the title says, I would like to update Tensorflow Distributions to Tensorflow Probability. I'm following this tutorial to build Tensorflow from source. https://medium.com/searce/installing-tensorflow-gpu-with-nvidia-cuda-on-a-google-cloud-platform-vm-instance-b059ea47e55c When I tried to build tensorflow using bazel, I get this warning. WARNING: /home/tensorflow/tensorflow/contrib/bayesflow/BUILD:17:1: in py_library rule //tensorflow/contrib/bayesflow:bayesflow_py: target '//tensorflow/contrib/bayesflow:bayesflow_py' depends on deprecated target '//tensorflow/contrib/distributions:distributions_py': TensorFlow Distributions has migrated to TensorFlow Probability (https://github.com/tensorflow/probability). Deprecated copies remaining in tf.contrib.distributions are unmaintained, unsupported, and will be removed by late 2018. You should update all usage of `tf.contrib.distributions` to `tfp.distributions`. Since I was new to building Tensorflow from resource, I tried to search exactly how to do this, but I couldn't get enough information. In the init.py file, it says """Classes representing statistical distributions and ops for working with them. Use tfp.distributions instead. """ Does this mean I should add all files in Tensorflow Probability to my current tensorflow folders? and rewrite init file deleting deprecated Tensorflow Distributions? I'm not sure what exactly I have to do. If you could give me resources of how to do this or anything related to this problem, that would be helpful. Thanks.

When you finish building TF from source, you'll be left with a .whl file that needs to be pip installed. You should then also pip install tfp-nightly which is the nightly packaging of TF Probability. You could also follow the instructions on the TFP GitHub page for installing TFP from source. Note that if all you want is recent features of the two packages, simply installing tf-nightly and tfp-nightly will be a very close approximation to a source build. If you want to modify the TF library then building from source is the way to go. Hope this helps!

### Tensorflow version vs tensorboard version

I would like to ask if tensorflow version could be different than tensorboard's one? I have a problem (404 problem) and someone suggested installing a newer version of tensorboard using: pip uninstall tensorflow-tensorboard pip install tensorboard I checked my versions and they are both 1.6.0: from tensorboard import version; print(version.VERSION) import tensorflow as tf; print(tf.__version__) 1.6.0 Also since I don't remember installing tensorboard separately (I might be mistaken about this one though) I guess it's expected to be on the same version. So, my question is could they be on different versions? (I guess they could since we have the opportunity to install tensorboard separately). And also is there a point in upgrading one and not the other? Could there be some conflicts in the latter case?

Since TensorFlow 1.3.0, TensorBoard has had its own PyPI package, but there is a circular dependency between the packages, so when users installs TensorFlow they will always get TensorBoard along (that's why you have it installed). However, the fact is that TensorFlow does really not depend on TensorBoard to work and TensorBoard does not even have a dependency to TensorFlow, so it should not be possible that the two packages affect each other in any way. About the suggested fix, it tells you to remove tensorflow-tensorboard and then install tensorboard. This fixes a known issue from 1.6.0 due to renaming the TensorBoard package from tensorflow-tensorboard to tensorboard, which caused troubles in some cases. In the GitHub link you posted, the developer suggests to upgrade TensorBoard from 1.5.1 to 1.6.0 to fix one particular issue, hence the need to remove the package with the old name and install the new one. Since you already have TensorBoard 1.6.0, you should most definitely have tensorboard installed, not tensorflow-tensorboard (you can check with pip list if you want). To upgrade to a newer version, you can just run: pip install --upgrade tensorboard

### Getting errors installing Tensorflow GPU

I was earlier working with the CPU only version of tensorflow. I tried installing the GPU version now using this link. But I think I messed up. When I try to do import tensorflow it gives the following message: ImportError: libcudart.so.7.5: cannot open shared object file: No such file or directory What should I do?

It could be because a wrong version of cuda is installed : check /usr/local/ for the versions of cuda that are installed and if it matches with the version in the Tensorflow error. If it both versions don't match, you'll have to either install another version of cuda or Tensorflow. Another reason could be because of missing environment variables (as explained here). Try this : export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64" export CUDA_HOME=/usr/local/cuda

### How to determine the version of libc6 to be used with Tensorflow?

I am trying to install Tensorflow on a machine that I do not have root access. I have followed all the steps and the installation has been successful. However, when I try to import Tensorflow in Python, I get an error that an old version of libc6 is installed. I have tried the solution suggested here, but I could only get it to work once and I am not able to use the same solution now. It looks like there are two versions of libc6 installed on the machine: the first one is /lib64/libc6.so and the other one is /usr/lib/libstdc++-libc6.2-2.so.3. Apparently, TF uses the first one which has an older version of libc6 and returns an error ImportError: /lib64/libc.so.6: version 'GLIBC_2.14' not found. How can I force TF to use the second library, which is a more recent version of libc6, in order to solve this problem?