question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not able to use Tf.Keras

See original GitHub issue

Hi there 😃 First of all thanks a lot for this repository its amazing. I have an issue with using tensorflow as a backend. I follow your instructions on the readme and even tried out both options, i.e.

SM_FRAMEWORK="tf.keras"
import segmentation_models as sm
sm.set_framework("tf.keras")

Unfortunately no matter what I do, as soon as I have Keras installed your module will use Keras as backend and I can switch to tf.Keras (i.e. it will always say Segmentation Models: using keras framework.). (Note i am using tensorflow 2.0).

If i remove Keras from my installations, it will then use tensorflow 2.0. But somehow this should work by setting it. Can you reproduce this or do you have any idea why this is happening?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
qubvelcommented, Nov 28, 2019

Hi @JeremyAlain The second option is (before importing segmentation_models):

import os
os.environ["SM_FRAMEWORK"] = "tf.keras"

not SM_FRAMEWORK="tf.keras"

0reactions
dimimalcommented, Apr 20, 2020

What is the version of tf and sm. Which line and file cause an error?

That is! I had the version 0.2.1! That’s why! Thanks anyway!

Read more comments on GitHub >

github_iconTop Results From Across the Web

can't import keras from tensorflow - Stack Overflow
If you have conda installed just download tensorflow using it. Create a conda environment called tf and install the latest ...
Read more >
Better performance with tf.function | TensorFlow Core
You can use tf.function to make graphs out of your programs. ... However, it's possible that a Python argument is not being used...
Read more >
Keras: the Python deep learning API
Built on top of TensorFlow 2, Keras is an industry-strength framework that can scale to large clusters of GPUs or an entire TPU...
Read more >
What is tf.keras really?
Neural net from scratch (no tf.keras)¶. Let's first create a model using nothing but TensorFlow tensor operations. We're assuming you're already familiar with ......
Read more >
How to correctly install Keras and Tensorflow - ActiveState
Instead of pip installing each package separately, the recommended approach is to install Keras as part of the TensorFlow installation. When you ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found