unlearning-challenge / starting-kit

Starting kit for the NeurIPS 2023 unlearning challenge
https://unlearning-challenge.github.io/
Apache License 2.0
375 stars 133 forks source link

[notebook] add `keras` implementation #5

Closed innat closed 1 year ago

innat commented 1 year ago

I translated the PyTorch code to the Keras code.

innat commented 1 year ago

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

fabianp commented 1 year ago

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!

innat commented 1 year ago

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

fabianp commented 1 year ago

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?

innat commented 1 year ago

@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?

fabianp commented 1 year ago

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)

innat commented 1 year ago

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

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

innat commented 1 year ago

Great. I will update accordingly.

innat commented 1 year ago

@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.

fabianp commented 1 year ago

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!