securefederatedai / openfl

An Open Framework for Federated Learning.
https://openfl.readthedocs.io/en/latest/index.html
Apache License 2.0
733 stars 207 forks source link

Fix OpenFL MICCAI tutorials #766

Closed psfoley closed 1 week ago

psfoley commented 1 year ago

At least two OpenFL tutorials from MICCAI 2022 are failing:

  1. 2D MedMNIST - https://github.com/intel/fl-tutorial/blob/gh-pages/tutorial_notebooks/Tutorial_1_Medmnist_2D.ipynb
  2. OpenFL GaNDLF tutorial - https://github.com/intel/fl-tutorial/blob/gh-pages/tutorial_notebooks/Tutorial_3_GaNDLF_OpenFL_tutorial.ipynb

Steps to reproduce:

  1. Go to either of the above links and click the Open in Colab link image
  2. Run all cells
kta-intel commented 1 year ago

Investigating on 2D MedMNIST

Seems to be an incompatibility with Google Colab and OpenFL v1.4. Colab currently uses Python v3.9.16 whereas the version of OpenFL installed in the miccai_fl_tutorial branch specifies Python <3.9.

Installing from the latest branch or binary (pip install openfl) seems to resolve this error. For some reason, I still end up with an import error:

ImportError: cannot import name 'builder' from 'google.protobuf.internal' (/usr/local/lib/python3.9/dist-packages/google/protobuf/internal/__init__.py)

Here is a workaround (bandage) for that:

!pip install --upgrade protobuf
!cp /usr/local/lib/python3.9/dist-packages/google/protobuf/internal/builder.py .
!pip install protobuf==3.19.6
!mv builder.py /usr/local/lib/python3.9/dist-packages/google/protobuf/internal/

Worth it to note that this issue looks to be unique to Google Colab. I didn't not run into this issue using Intel's Developer Cloud or a standard local notebook


Edit: the import error is being caused by incompatible protobuf requirements between Tensorflow 2.12 and OpenFL v1.5. OpenFL requires protobuf==3.19.6 whereas TF 2.12 requires protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.20.

bjklemme-intel commented 1 year ago

"OpenFL_Team1 is working on this"

teoparvanov commented 1 week ago

Closing this issue as the Interactive API is being deprecated in favor of Workflow API, and the MICCAI tutorials repo is being archived. Please reopen if the priorities change.