Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status of ragged tensors in tf nightly #62332

Closed
0x0L opened this issue Nov 6, 2023 · 8 comments
Closed

Status of ragged tensors in tf nightly #62332

0x0L opened this issue Nov 6, 2023 · 8 comments
Assignees
Labels
comp:keras Keras related issues stat:awaiting response Status - Awaiting response from author type:feature Feature requests type:support Support issues

Comments

@0x0L
Copy link

0x0L commented Nov 6, 2023

Hello,

It seems keras 3 (used in tf nightly) has dropped support for ragged tensors.

What are the plans for the future of ragged tensors in keras tf?

Thanks

@SuryanarayanaY SuryanarayanaY added type:support Support issues type:feature Feature requests comp:keras Keras related issues labels Nov 6, 2023
@SuryanarayanaY
Copy link
Collaborator

Hi @0x0L ,

As Keras now become multi backend to support Pytorch, Jax as backend along with Tensorflow , there has been changes. Keras do have plan to support ragged tensors in future but not sure of exact time line.

Please have a look into Keras tickets #18467 and #18414 for more details.

Thanks!

@SuryanarayanaY SuryanarayanaY added the stat:awaiting response Status - Awaiting response from author label Nov 6, 2023
@mihaimaruseac
Copy link
Collaborator

Meanwhile, you can still use tf.keras or directly the ragged tensors API from within TF though

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Status - Awaiting response from author label Nov 6, 2023
@SuryanarayanaY
Copy link
Collaborator

@0x0L ,

If you are particularly looking to train a model with ragged input by using tf.keras, AFAIK, you can do it unitil TF2.14 version(Not sure about 2.15V yet). From Keras3(current tf-nightly keras package) onwards the Inputlayer(Input) don't accept ragged argument. I tested with a demo and attached gist here.

@0x0L
Copy link
Author

0x0L commented Nov 6, 2023

@mihaimaruseac Actually no, it does not work in tf-nightly: tf.keras.Input does not support the ragged kwarg anymore as noted by @SuryanarayanaY (tf keras 2.15rc still has ragged support)

As mentioned in keras-team/keras#18467 they (keras) "may add it back later"... which does not sound too encouraging

@mihaimaruseac
Copy link
Collaborator

Try https://pypi.org/project/tf-keras-nightly/ instead of keras-nightly

@0x0L
Copy link
Author

0x0L commented Nov 6, 2023

@mihaimaruseac Thank you so much !!

So I can expect ragged tensors to stay in tf.keras, is that right ?

@SuryanarayanaY
Copy link
Collaborator

Hi @0x0L ,

AFAIK, tf_keras will work for replacement of tf.keras . To use tf_keras with latest tf-nightly versions, we need to import tf_keras as keras and use keras instead of tf.keras since tf.keras still imports keras-nightly(i.e. Keras3) code instead of tf_keras code.

I tried the same demo above and it works importing tf_keras as keras and replace tf.keras with keras and attached gist here for reference.

Thanks to @mihaimaruseac for the inputs.

@SuryanarayanaY SuryanarayanaY added the stat:awaiting response Status - Awaiting response from author label Nov 7, 2023
@0x0L 0x0L closed this as completed Nov 10, 2023
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:keras Keras related issues stat:awaiting response Status - Awaiting response from author type:feature Feature requests type:support Support issues
Projects
None yet
Development

No branches or pull requests

3 participants