Git Product home page Git Product logo

Comments (9)

kayhayen avatar kayhayen commented on September 26, 2024

The portpicker function can actually be inlined, I will do that instead of giving up on it, but we can also try to get rid of it too, since it seems to be a test code itself, checking it out now with --noinclude-custom-mode=tensorflow.python.distribute.multi_worker_test_base:error and lets see if that helps, pushing the bloat problem closer to its origin.

from nuitka.

KRRT7 avatar KRRT7 commented on September 26, 2024

i realized this just now, this is a duplicate of #2751 at least until the keras issue is hit.

from nuitka.

kayhayen avatar kayhayen commented on September 26, 2024

This reproduces it for me too from tensorflow.experimental import dtensor causing this:

  File "C:\Users\kayha\repos\Py2C\MINI3~1.DIS\keras\src\backend\tensorflow\distribution_lib.py", line 10, in <module keras.src.backend.tensorflow.distribution_lib>
ModuleNotFoundError: No module named 'tensorflow.experimental'

I don't see how it doesn't work, indeed something the lazy loader would be supposed to do, but is not happening with tensorflow or keras somehow. The tensorflow.experimental will only be set when the code returns from that import.

from nuitka.

kayhayen avatar kayhayen commented on September 26, 2024

So, I traced this down to where it crashes, and it seems that the tf imported nearby, does have the experimental name. Now I am not yet convinced this can be a import mechanic error, but at first glance it's non-obvious why it wouldn't work in this case, and I will have to look into this.

from nuitka.

kayhayen avatar kayhayen commented on September 26, 2024

I only now noticed, that I am not having the precise error that you got. I am pretty sure I sneaked by those lines, but I will later try your example too. It seems I am loading tensorflow first, and there it doesn't occur. Might be more clever to first sort out that lazy loader, just in case it corrupts tensorflow somehow.

from nuitka.

kayhayen avatar kayhayen commented on September 26, 2024

So, this is self inflicted damage.

      append_plain: |
        import sys
        sys.modules["tensorflow.compat"] = compat
        sys.modules["tensorflow.compat.v1"] = compat.v1
        sys.modules["tensorflow.compat.v2"] = compat.v2
        sys.modules["tensorflow.compat.v1.logging"] = compat.v1.logging
        sys.modules["tensorflow.compat.v2.experimental"] = compat.v2.experimental
        sys.modules["tensorflow.keras"] = keras
        sys.modules["tensorflow.keras.layers"] = keras.layers
        sys.modules["tensorflow.keras.activations"] = keras.activations
        sys.modules["tensorflow.keras.models"] = keras.models

This triggers the lazy loader I think, and then the bad thing happens. There is no line for this:

File "C:\Users\Divine\Desktop\OSSCON~1\NUITKA~1\1242-S~1\MAIN~1.DIS\tensorflow\__init__.py", line 499, in <module tensorflow>

So something in the import design changed there at some time. Now question is of course, what version needed that, and what version doesn't need it anymore, and did it need it for keras ever. These things have critically underdocumented history. I guess, the way forward is to make use see old tensorflow works as is, and then make newest one work, and then bisect to the point where it fails. Given the time a single compilation of these takes, no a quick thing.

from nuitka.

KRRT7 avatar KRRT7 commented on September 26, 2024

removing your append_plain results in ModuleNotFoundError: No module named 'tensorflow.experimental'
keeping it, still gives the AttributeError: partially initialized module 'keras' has no attribute '__version__' (most likely due to a circular import) on factory

from nuitka.

KRRT7 avatar KRRT7 commented on September 26, 2024

with the most recent changes, on factory, this example works now.

from nuitka.

kayhayen avatar kayhayen commented on September 26, 2024

Part of the 2.1.4 hotfix release.

from nuitka.

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.