GithubHelp home page GithubHelp logo

tflearn import issue about tflearn HOT 5 OPEN

krinali1901 avatar krinali1901 commented on June 18, 2024
tflearn import issue

from tflearn.

Comments (5)

rela-v avatar rela-v commented on June 18, 2024

Hi! Thanks for your question.

tl;dr: everywhere you say "is_sequence" in your code, replace it with "is_sequence_or_composite".

Your problem

  • If you try to do the following:
    from tensorflow.python.util.nest import is_sequence
  • The following error results:
    ImportError: cannot import name 'is_sequence' from 'tensorflow.python.util.nest'
    (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/tensorflow/python/util/nest.py)

Explanation of the Problem

If this is indeed the problem, then I encountered the same issue several days ago and was able to resolve it. The reason you are experiencing the error is that, as the error message says, you
cannot import name 'is_sequence' from 'tensorflow.python.util.nest'
which means that there was some issue in the import process. Indeed, cursory research reveals that there is no longer any name "is_sequence" in the nest.py module (per tensorflow/tensorflow@f564400).

Solution

If you visit the provided link above, there is a new function which will serve your purpose well named "is_sequence_or_composite()", which according to the source code does the same exact thing as "is_nested_or_composite()" (use whichever one floats your boat!).
Thus, replacing the "is_sequence" function with the "is_sequence_or_composite" function will resolve the error.
For more information on what a "nested structure" is, which is what this function actually checks for, see the following link:
https://www.tensorflow.org/api_docs/python/tf/nest

Thank you so much again for asking. I hope this works for you, and feel free to ask for any help you may need along the way!

-Rela

from tflearn.

MihaMarkic avatar MihaMarkic commented on June 18, 2024

@rela-v It happens if one doesn't use is_sequence explictly, simple import tflearn is enough to trigger the error. So, it is not possible to correct the error which is most probably somewhere in tflearn code.

from tflearn.

MihaMarkic avatar MihaMarkic commented on June 18, 2024

And as expected, is_sequence is imported in tflearn/layers/recurrent.py file.

from tflearn.

MihaMarkic avatar MihaMarkic commented on June 18, 2024

Created a PR

from tflearn.

awsumbill avatar awsumbill commented on June 18, 2024

In the meantime you can pip install tensorflow<2.13 to get around this untill it's fixed

from tflearn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.