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

🚀 Contributing to Keras 🚀 #18442

Open
fchollet opened this issue Jul 14, 2023 · 52 comments
Open

🚀 Contributing to Keras 🚀 #18442

fchollet opened this issue Jul 14, 2023 · 52 comments

Comments

@fchollet
Copy link
Member

fchollet commented Jul 14, 2023

Keras 3 is a high-velocity open-source project. We welcome contributions! Here's what you can do:

Take up one of these items:

Here are some features that we'd love to see implemented by the Keras community:

  • Add cuDNN support for PyTorch RNNs by implementing keras/backend/torch/rnn.py:cudnn_lstm and cudnn_gru.
  • Add support for ONNX in model.export() and ExportArchive. On the TF and JAX side, we can transit via SavedModel. On the torch side, we can do a native export.
  • Add rematerialization support to KerasHub LLMs.
  • Contribute to the MLX backend. We have a mlx branch on the repo, which does not yet have full operation converge in keras/src/backend/mlx/. Add missing ops and help get the new MLX backend closer to the finish line!

Check out TODOs

There are various TODOs in the codebase. You can do a quick search (e.g. grep "TODO" keras/ -r) and see if anything looks interesting to you. Make sure to ask in this thread before starting work on any item!

Bring new pretrained model implementations to KerasHub

The Keras ecosystem package KerasHub is looking for contributors!
If you'd like to port a pretrained model implementation to the Keras ecosystem, that's a great project to join.

Convert an example from keras.io to Keras 3

keras.io/examples offers many great tutorials, but many of them are still based on Keras 2. We'd like to bring over in the shiny new world of multi-framework ML.

There are two stages of conversion:

  1. Converting a Keras 2 example so that it can run on Keras 3 with the TF backend.
  2. Converting a Keras 2 example so that it can run on Keras 3 with any backend.

If you see an example marked as "v2" on keras.io/examples, you can open a PR on keras-team/keras-io to convert it to Keras 3. Keep in mind:

  • Start by only including the Python file in the PR, not the md and ipynb files, because you may have to regenerate those after review comments come in.
  • To convert the code, you can refer to the Keras 3 migration guide.

Add new examples to keras.io

Have a great ML project you'd like to use to teach others about ML? You can add a new tutorial on keras.io/examples! Just follow the instructions at keras-team/keras-io.

Increase test coverage

Keras doesn't have 100% code coverage in unit tests just yet. You can try to run a code coverage tool like codecov and see if there are any unit tests you could add to improve Keras.

@suvadityamuk
Copy link

Taking up the Moving Dataset utils task as a priority! Should I make a draft PR?

@fchollet
Copy link
Member Author

Taking up the Moving Dataset utils task as a priority! Should I make a draft PR?

No need for a draft -- you can just send the PR when you have something you want a review on. Thank you!

@asingh9530
Copy link
Contributor

asingh9530 commented Jul 16, 2023

@fchollet regarding dataset utils, since all three frameworks tensorflow , torch and jax have their own data-loading modules or have specific classes to provide this utilities, but currently it is relying on tf.keras can only accept either tf.Dataset or regular python structures as of now, so dropping it means that we either support similar logic for individual framework or we accept generic structures + framework specific data-holder and convert it to a unified keras data-holder and then perform similar operations.

since in first option we import framework specific modules and built on top but these will stay in keras.backend but in option two we we don't need to touch keras.backend' we only made changes to keras.utils`. Can you please let me know your thoughts on this. 😊

@suvadityamuk can please also share your thoughts in which direction you are choosing. 😊

@suvadityamuk
Copy link

@asingh9530

I'm currently looking into trying to move the tf.keras-specific data utils from the original keras-team/keras space to this space, with all implementations intact. The only thing I'm adding is support to handle torch.utils.data.Dataset along with it, since that's a major focus.

@asingh9530
Copy link
Contributor

@suvadityamuk Thanks for responding, since this will be a big change let's track it in a new issue with specific changes needed to be done since even in keras the utils are for tf.Dataset let's say Iterators, batched etc. How about I'll add you there and work on this.

@dranaivo
Copy link
Contributor

Hello,
I am rather new w.r.t contributions, so I may ask a rather silly question : are publicly exported functions those decorated with @keras_core_export ?

@fchollet
Copy link
Member Author

so I may ask a rather silly question : are publicly exported functions those decorated with @keras_core_export

Yes, that's right. The public API is programmatically generated using those decorators.

@vulkomilev
Copy link

Can someone help me with keras_core/layers/layer.py:439: # TODO: handle layout.What does it mean to handle the layout?

@vulkomilev
Copy link

@fchollet bump

@fchollet
Copy link
Member Author

Can someone help me with keras_core/layers/layer.py:439: # TODO: handle layout.What does it mean to handle the layout?

This was referring to the implementation of a future distribution API -- but this has been handled since. Nothing to do here.

@BenjiFischman
Copy link

Hi,

I am willing to take a shot at the solve operation implementation, still setting up a development environment. One clarification question. What is the error value for a matrix input that is singular (i.e., no inverse matrix exists), not full rank, or not square? To be sure, I look forward to contributing as a hobby and will circle back when I have something satisfactory for review.

Thanks,
bf

@sqali
Copy link
Contributor

sqali commented Sep 17, 2023

Hello @fchollet,

I wanted to reach out and update you on the progress I've made with the ERF function. I've made significant changes to the code and have already uploaded them to my forked repository. I'm confident that these updates will improve the function's performance, but please take a look and let me know if there's anything else you'd like me to do.

1.) Changes to keras-core/ops/math.py
https://github.com/sqali/keras-core/blob/6485433201e8a935f462aca191bc37dd7cf00c30/keras_core/ops/math.py#L934-L966

2.) Changes to keras-core/ops/math_test.py
https://github.com/sqali/keras-core/blob/6485433201e8a935f462aca191bc37dd7cf00c30/keras_core/ops/math_test.py#L840-L868

3.) Changes to keras-core/backend/tensorflow/math.py
https://github.com/sqali/keras-core/blob/6485433201e8a935f462aca191bc37dd7cf00c30/keras_core/backend/tensorflow/math.py#L244-L245

@fchollet
Copy link
Member Author

I am willing to take a shot at the solve operation implementation, still setting up a development environment. One clarification question. What is the error value for a matrix input that is singular (i.e., no inverse matrix exists), not full rank, or not square? To be sure, I look forward to contributing as a hobby and will circle back when I have something satisfactory for review.

solve exists in all 3 backends, so most likely we just want to wrap it. You can check what the error is for a singular matrix for each backend. We should raise a similar error.

@fchollet
Copy link
Member Author

I wanted to reach out and update you on the progress I've made with the ERF function. I've made significant changes to the code and have already uploaded them to my forked repository. I'm confident that these updates will improve the function's performance, but please take a look and let me know if there's anything else you'd like me to do.

It will also need to be implemented for the JAX, torch, and numpy backends. Can you open a PR? We can carry on on the PR.

@sqali
Copy link
Contributor

sqali commented Sep 18, 2023

Sure, I will do that. Thanks.

@fchollet fchollet pinned this issue Sep 25, 2023
@jayaBalaR
Copy link

@fchollet ,I was trying to port this example of mixup augmentation https://keras.io/examples/vision/mixup/, while defining Hyperparameters in keras-core, what should we replace this line with AUTO = tf.data.AUTOTUNE? Could you please help clarify the same.

@GreatRSingh
Copy link

@fchollet I am interested in solving the todo,
keras/metrics/accuracy_metrics_test.py: # TODO: Check save and restore config

can you give me more detail of how it should be done.

@naoitoi
Copy link
Contributor

naoitoi commented Nov 22, 2023

Hi, @fchollet ,

For my first commit to Keras, I picked a simple one, addressing two small TODO items in reduction_metrics_test.py.

Here's the PR: #18812

I believe what the comment "# TODO: Check save and restore config" meant is that an object (Sum or Mean) must be re-constructed from config, and be tested.

Please let me know if I misunderstood the requirements, or otherwise made any mistakes.

Thank you! I'm very excited about working on this very important library.

@AlvaroMaza
Copy link
Contributor

Hi, @fchollet ,

For my first commit to Keras, I picked the TODO in discretization_test.py.

Here's the PR: #18882

Thank you!

@AakashKumarNain
Copy link
Contributor

Is anyone working on JAX CTC? If not, I can take it up

@fchollet fchollet changed the title Contributing to Keras 📣 Contributing to Keras 📣 Mar 12, 2024
@fchollet fchollet changed the title 📣 Contributing to Keras 📣 📢 Contributing to Keras 📢 Mar 12, 2024
@fchollet fchollet changed the title 📢 Contributing to Keras 📢 🚀 Contributing to Keras 🚀 Mar 12, 2024
@vulkomilev
Copy link

I will take the ops.correlate if nobody is working on it.

@markodjordjic
Copy link

@fchollet I could take dice loss if nobody else is working on it. @vulkomilev did you start with ops.correlate?

@markodjordjic
Copy link

@fchollet can you or someone add me as a contributor? I need to make a push to the remote branch for the dice loss.

@markodjordjic
Copy link

@fchollet I have the first version of the DiceLoss in the tf backend. I need to be made a contributor to make a push to the remote branch so that the code review can take place.

@markodjordjic
Copy link

@fchollet any updates for the DiceLoss? I have the TF implementation ready.

@vulkomilev
Copy link

@fchollet I could take dice loss if nobody else is working on it. @vulkomilev did you start with ops.correlate?

yes I did

@markodjordjic
Copy link

@vulkomilev Thanks for the answer. Are you a contributor? How do you do the push to the branch? I have this dice loss done, but cannot push since I am not a contributor.

@Frnckthewoo
Copy link

Please Can I have a french version !?

@YagaoDirac
Copy link

@fchollet Hi, I think I invented something interesting. I implemented it in pytorch and I opened an issue there.
pytorch/pytorch#122680

@vulkomilev
Copy link

@vulkomilev How do you do the push to the branch?

you make a MR and waiting for approval

@markodjordjic
Copy link

@vulkomilev I cannot push. I don't have the rights.

@vulkomilev
Copy link

@vulkomilev I cannot push. I don't have the rights.

sorry I meant pull request

@pmasousa
Copy link

Hello @fchollet,
Can I make the tool for saved Keras model file inspection, diff, and patching or is there someone already working on it?
Thanks in advance!

@vulkomilev
Copy link

I will get the "Add a new Flash Attention op" task

@vulkomilev
Copy link

@fchollet for every back-end I must introduce the implementation mentioned in the ticket right ?

@chanduvkp
Copy link

@sampathweb @fran6co - I have seen last comments on file 'keras/src/layers/preprocessing/string_lookup_test.py' . I have grep'ed for 'TODO' and list this file . I am new for Keras contrib and setup Keras in local successfully. Would any one give me insight on this file and changes needed for 'TODO' sections .

@ghsanti
Copy link
Contributor

ghsanti commented Aug 10, 2024

Hi @fchollet,

Is there any intention to add types (type information) to the library ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests