keras-team / keras

Deep Learning for humans
http://keras.io/
Apache License 2.0
62.13k stars 19.49k forks source link

๐Ÿš€ Contributing to Keras ๐Ÿš€ #18442

Open fchollet opened 1 year ago

fchollet commented 1 year ago

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:

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:

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 commented 1 year ago

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

fchollet commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

vulkomilev commented 1 year ago

@fchollet bump

fchollet commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Sure, I will do that. Thanks.

jayaBalaR commented 1 year ago

@fchollet , I am interested in contributing to Keras Core. I went through the description above and interested to work on this item "Convert an example from keras.io to Keras Core". Could you please guide me on the steps to follow . Do I need to raise a new pull request. Thank you

asingh9530 commented 1 year ago

@fchollet I can take up erf implementation, any specific condition you want in the implementation if not I will follow implementation guideline of rest of operations.

vulkomilev commented 1 year ago

I can take up the scan op/operation in jax

sqali commented 1 year ago

Hi @asingh9530 ,

I have already opened a PR for erf and working on it. Thanks.

BenjiFischman commented 1 year ago

Hi people,

I think I took care of most of the necessary changes. Still struggling on how to run a unit test locally with respect to my forked branch. Happy to open a PR if this is helpful. In addition, please advise on how to run a test, import a built whl binary into a Jupyter notebook, and next steps for agnostic solve.

Thanks, bf

pranavvp16 commented 1 year ago

@fchollet I'm working on the keras_core/saving/saving_lib.py. TODO: if h5 filepath is remote, create the file in a temporary directory then upload it. Should I use the requests library to posts the file on the required remote filepath ?

fchollet commented 1 year ago

I'm working on the keras_core/saving/saving_lib.py. TODO: if h5 filepath is remote, create the file in a temporary directory then upload it. Should I use the requests library to posts the file on the required remote filepath ?

Please only use Python stdlib utilities for this. Thanks!

fchollet commented 1 year ago

I am interested in contributing to Keras Core. I went through the description above and interested to work on this item "Convert an example from keras.io to Keras Core". Could you please guide me on the steps to follow . Do I need to raise a new pull request.

Here's the full context and the process to follow: https://github.com/keras-team/keras/issues/18468

fchollet commented 1 year ago

I can take up the scan op/operation in jax

Sure, sounds good! It will need to be implemented in all 4 backends though.

I think I took care of most of the necessary changes. Still struggling on how to run a unit test locally with respect to my forked branch. Happy to open a PR if this is helpful. In addition, please advise on how to run a test, import a built whl binary into a Jupyter notebook, and next steps for agnostic solve.

It will need much more extensive unit testing. You can run unit tests locally via pytest.

pranavvp16 commented 1 year ago

I'm working on the keras_core/saving/saving_lib.py. TODO: if h5 filepath is remote, create the file in a temporary directory then upload it. Should I use the requests library to posts the file on the required remote filepath ?

Please only use Python stdlib utilities for this. Thanks!

thanks, last question what can be a good example for remote file path.

fchollet commented 1 year ago

thanks, last question what can be a good example for remote file path.

Something like gcs://...

jayaBalaR commented 1 year ago

I am interested in contributing to Keras Core. I went through the description above and interested to work on this item "Convert an example from keras.io to Keras Core". Could you please guide me on the steps to follow . Do I need to raise a new pull request.

Here's the full context and the process to follow: keras-team/keras#18468

Thank you. I will check the link and start working

BenjiFischman commented 1 year ago

Thanks @fchollet! Debugging more unit tests now, I commented the latest errors I have been seeing in the math._test.py file here. Any ideas to get a more deterministic response from tensorflow are much appreciated.

pranav-vempati commented 1 year ago

I could port some of the listed examples from tf.keras to Keras Core. Out of the outstanding examples, are there any, in particular, you would first like to see ported to Keras Core?

vulkomilev commented 1 year ago

@fchollet what to do if some framework do not have the feature or it is work in progress( like scan and pytorch https://github.com/pytorch/pytorch/issues/50688)?

jayaBalaR commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

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: https://github.com/keras-team/keras/pull/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 commented 11 months ago

Hi, @fchollet ,

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

Here's the PR: https://github.com/keras-team/keras/pull/18882

Thank you!

AakashKumarNain commented 11 months ago

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

vulkomilev commented 8 months ago

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

markodjordjic commented 8 months ago

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

markodjordjic commented 8 months ago

@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 commented 8 months ago

@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 commented 8 months ago

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

vulkomilev commented 8 months ago

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

yes I did

markodjordjic commented 8 months ago

@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 commented 8 months ago

Please Can I have a french version !?

YagaoDirac commented 7 months ago

@fchollet Hi, I think I invented something interesting. I implemented it in pytorch and I opened an issue there. https://github.com/pytorch/pytorch/issues/122680

vulkomilev commented 7 months ago

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

you make a MR and waiting for approval

markodjordjic commented 7 months ago

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

vulkomilev commented 7 months ago

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

sorry I meant pull request

pmasousa commented 7 months ago

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 commented 7 months ago

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

vulkomilev commented 7 months ago

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