Giter Club home page Giter Club logo

Comments (8)

fchollet avatar fchollet commented on June 9, 2024

Exposing the API provided in keras.utils.PyDataset to backends other than tensorflow would be a valuable addition.

PyDataset is usable with any backend. Nothing about it is TF-specific. Did you encounter an issue?

from keras.

LarsKue avatar LarsKue commented on June 9, 2024

Interesting, for me, the import does not work under the torch backend. I thought this was the intended behaviour:

conda create -y -n test-py-tensorflow python=3.11
conda activate test-py-tensorflow
pip install -U tensorflow keras
conda env config vars set KERAS_BACKEND=tensorflow
conda deactivate
conda activate test-py-tensorflow
python -c "from keras.utils import PyDataset"

works fine, whereas

conda create -y -n test-py-torch python=3.11
conda activate test-py-torch
pip install -U keras
conda install pytorch torchvision torchaudio cpuonly -c pytorch
conda env config vars set KERAS_BACKEND=torch
conda deactivate
conda activate test-py-torch
python -c "from keras.utils import PyDataset"

yields

ImportError: cannot import name 'PyDataset' from 'keras.utils'

Edit: Fixed the minimal example

from keras.

fchollet avatar fchollet commented on June 9, 2024

The import pattern should be from keras.utils import PyDataset or import keras; keras.utils.PyDataset.

from keras.

LarsKue avatar LarsKue commented on June 9, 2024

Sorry, that was a mistake I put in when creating a minimal example.

The issue seems to be a little bit deeper. When I install keras using conda install keras, I get the above issue:

from keras.utils import PyDataset
>>> ImportError: cannot import name 'PyDataset' from 'keras.utils'

When I install with pip install -U keras (as recommended by keras), I instead now get:

import keras
>>> ModuleNotFoundError: No module named 'packaging'

from keras.

SuryanarayanaY avatar SuryanarayanaY commented on June 9, 2024

Hi @LarsKue ,

Please install the packaging module using pip install packaging and try again.

from keras.

SuryanarayanaY avatar SuryanarayanaY commented on June 9, 2024

The library packaging is a dependency for Keras. Please check here.

packaging

from keras.

LarsKue avatar LarsKue commented on June 9, 2024

@SuryanarayanaY thanks, this fixes the issue. packaging should probably be auto-installed when running pip install -U keras though. Would also be nice to have the conda repos updated so that the latest torch-compatible keras version is newer than 3.1.0, which has the issue of the missing PyDataset.

from keras.

google-ml-butler avatar google-ml-butler commented on June 9, 2024

Are you satisfied with the resolution of your issue?
Yes
No

from keras.

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.