starting-kit icon indicating copy to clipboard operation
starting-kit copied to clipboard

[notebook] add `keras` implementation

Open innat opened this issue 2 years ago • 1 comments

I translated the PyTorch code to the Keras code.

innat avatar Jul 03 '23 14:07 innat

@eleniTriantafillou A gentle reminder. This PR might be helpful for Keras users in the upcoming competitions.

innat avatar Jul 04 '23 06:07 innat

thanks a lot @innat for this contribution! It would be indeed great to have an example notebook for those that wish to use keras.

However, for the competition, participants will submit an unlearn function that expects its first argument to be a Pytorch model and the rest Pytorch dataset loaders. Hence I'm afraid having an example that doesn't respect this API will cause confusion in participants.

Would it be possible to re-do your example, but where the unlearn function respects the submission API (and converts between Pytorch model and loader within this function? This would be really helpful for other participants!

fabianp avatar Jul 06 '23 17:07 fabianp

@fabianp Thanks for the comment. Made some changes accordingly to your comments.

innat avatar Jul 06 '23 18:07 innat

Hi @innat . I'm confused as I don't see any conversion from keras models and loaders to Pytorch.

Can you confirm that the unlearning method would work giving it as input Pytorch model and Pytorch loaders?

fabianp avatar Jul 08 '23 13:07 fabianp

@fabianp Sorry for the confusion.

In the upcoming Kaggle competition, will the participants need to convert their models and data loader to the PyTorch ecosystem?

Generally, in Kaggle, submissions should be ok either PyTorch or TensorFlow (Keras), unless there are some exceptions. For example, 1, 2, these competitors (hosted by Google). People can use whatever framework they like but the submission should be in TensorFlow. So, in this unlearning competition, should it be submitted in PyTorch?

innat avatar Jul 08 '23 17:07 innat

In the upcoming Kaggle competition, will the participants need to convert their models and data loader to the PyTorch ecosystem?

that is exactly right. Participants can use any library as long as they provide a function that takes as input pytorch model and loader and return a pytorch model. Hence, if a participant decides to use a different framework he/she would need to convert pytorch models and loaders to those of the chosen framework (and back)

fabianp avatar Jul 08 '23 20:07 fabianp

@fabianp Thanks for the clarification.

.. if a participant decides to use a different framework he/she would need to convert pytorch models and loaders ...

This can be done. However few complications to adding all in a single starter notebook,

  1. The conversion code (for data loader and model) may create a distraction to the main goal (machine unlearning task) if that is added in the middle of the notebook (right before the unlearning method). (major concern)
  2. The conversion code may not be general for all cases. Participants might use it in the actual competition and might face issues. (can be resolved)
  3. GPU memory consumption of both frameworks. (can be resolved)

What if,

  1. A new section is added at the end of the notebook demonstrating the submission process, i.e. converting the data loader and model to the supported formats.

innat avatar Jul 11 '23 20:07 innat

Hi @innat . That solution of adding it to a section at the end of the document sounds good to me

fabianp avatar Jul 27 '23 15:07 fabianp

Great. I will update accordingly.

innat avatar Jul 27 '23 15:07 innat

@fabianp Hi. I have re-implemented the PyTorch to the new Keras-Core with the PyTorch backend. Could you please check this updated version from here? It addresses all the issues previously had. Please let me know, after confirmation, I will update this PR with this new notebook. Thank you.

innat avatar Jul 30 '23 18:07 innat

Thanks @innat . Given the length of the notebook it seems to me that it would be more useful to keep it as a separate notebook as you have done and link it from this repo's README so other participants can use it.

I've done this in https://github.com/unlearning-challenge/starting-kit/commit/beafbcdee7b9d51d11a251aab8f5eea47d02379c

Thanks!

fabianp avatar Jul 31 '23 15:07 fabianp