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.

Bug when loading keras model under keras2.3.0 and TensorFlow2.0

See original GitHub issue

Summary

Bug when loading keras model under keras2.3.0 and TensorFlow2.0 if using st.button.

Steps to reproduce

import keras
import streamlit as st
def main():
    model = keras.applications.mobilenet.MobileNet(input_shape=None, alpha=1.0,
                                                   depth_multiplier=1, dropout=1e-3, include_top=True,
                                                   weights='imagenet', input_tensor=None, pooling=None, classes=1000)
    st.title("test")
    st.subheader(" test")
    st.subheader(" Extract from Your Text ")
    message = st.text_area(" Entre Your Text ", "  ")
    if st.button("Extract"):
        st.write(message)
if __name__ == '__main__':
    main()

What are the steps we should take to reproduce the bug:

  1. load a keras model under keras2.3.0 and TensorFlow2.0.
  2. streamlit run app.py
  3. input some characters.
  4. click the Extract button.
  5. Error occurs. Any ideas? Thanks a lot.

AttributeError: ‘_thread._local’ object has no attribute ‘value’ Traceback: File “C:\Users\lxy\AppData\Roaming\Python\Python36\site-packages\streamlit\ScriptRunner.py”, line 311, in _run_script exec(code, module.dict)

Debug info

  • Streamlit version: (get it with $ streamlit version) => 0.51.0
  • Python version: (get it with $ python --version) => 3.6
  • Using Conda? PipEnv? PyEnv? Pex? => Conda
  • OS version: => win10
  • Browser version: => chrome

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
LCorleonecommented, Dec 18, 2019

@jrhone Thanks a lot. Hope someone can give me some suggestions!

0reactions
LCorleonecommented, Jan 10, 2020

@jrhone @monchier Thanks a lot. I think it is a special case I encounted. When i load a simple model, it is all ok. Maybe the complex model structure causes the error. It may be difficult to repro and i will not dig into this error. Close the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to load Keras model in Keras 2.4.3 (with Tensorflow ...
I am able to load the model using Keras to 2.1.0. So the real question is - what changed in Keras/Tensorflow, and is...
Read more >
Save and load a model using a distribution strategy
This tutorial demonstrates how you can save and load models in a SavedModel format with tf.distribute.Strategy during or after training.
Read more >
Keras vs. tf.keras: What's the difference in TensorFlow 2.0?
In this tutorial you'll discover the difference between Keras and tf.keras. You'll also learn what's new in TensorFlow 2.0.
Read more >
Introduction to TensorFlow2.0 and Keras with MNIST dataset
ADDITIONALLY WE WILL WALK THROUGH ON HOW YOU CAN LOAD IN YOUR OWN IMAGE , RESIZE IT USING OPENCV AND MAKE THE MODEL...
Read more >
A detailed example of how to use data generators with Keras
python keras 2 fit_generator large dataset multiprocessing ... dataset on multiple cores in real time and feed it right away to your deep...
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