Comments (8)
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.
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.
The import pattern should be from keras.utils import PyDataset
or import keras; keras.utils.PyDataset
.
from keras.
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.
Hi @LarsKue ,
Please install the packaging
module using pip install packaging
and try again.
from keras.
The library packaging is a dependency for Keras. Please check here.
Line 20 in da83683
from keras.
@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.
Are you satisfied with the resolution of your issue?
Yes
No
from keras.
Related Issues (20)
- RNN layer: len is not well defined for a symbolic Tensor. Please call `x.shape` rather than `len(x)` for shape information. HOT 3
- keras.ops.select doesn't accept tuples as input HOT 1
- Recommendation for writing tests for ModelParallel distribution HOT 2
- optimizers.Adam no longer accepts tf.Variable HOT 1
- Please explain label_mode='int' in keras.utils.image_dataset_from_directory HOT 2
- Getting Nan values in prediction HOT 1
- compatibility with pytorch 2.3 HOT 1
- Specifying shape of normal sampling with partially empty keras tensor HOT 3
- Question: Best practice for direct variable initialization HOT 5
- Inconsistent assertion in keras.layers.MultiHeadAttention
- [BUG] keras.layers.StringLookup and Vocabulary of Tensors HOT 3
- model.export() fails to save output layer name in the SavedModel HOT 9
- ops.linspace broken in Tensorflow when num is a tf.Tensor HOT 4
- Loading model fails: can only concatenate tuple
- model.predict time stdout HOT 4
- Keras `__init__.py` structure isn't readable by a static type checker HOT 5
- [BUG] Conflicting loss_weights implementation in Keras3 for single output case. HOT 2
- Most of the outbound links are broken in Tensorflow documentation HOT 1
- [Question] When is it absolutely necessary to use a `Lambda` layer? HOT 1
- TimeDistributed layer with nested model no longer working in TensorFlow 2.16.1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keras.