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

I want to use secure multiparty computation (SMPC) during inference in my model which is built using TensorFlow will this library integrate well with my TensorFlow model or it is just supported with pytorch? #8826

Closed
Am0stafa opened this issue May 16, 2024 · 3 comments
Labels
Awaiting Response Type: Question ❔ Question about implementation or some technical aspect

Comments

@Am0stafa
Copy link

I would love the community to discuss with me the potential errors I might get when integrating it with TensorFlow.
Thanks

@Am0stafa Am0stafa added the Type: Question ❔ Question about implementation or some technical aspect label May 16, 2024
@madhavajay
Copy link
Collaborator

Hi @Am0stafa we had tensorflow and tensorflow federated integrated into an older version of syft, I think version 0.7.0. Since 0.8.0 we moved to supporting jax and torch as the main DL libraries, but since we now have the ability to define custom docker images for the workload you can essentially use any python library you like.

Take a look at this example notebook:
https://github.com/OpenMined/PySyft/blob/dev/notebooks/api/0.8/10-container-images.ipynb

tensorflow_dockerfile_str = f"""
FROM openmined/grid-backend:{syft_base_worker_tag}

RUN pip install tensorflow

""".strip()

tensorflow_dockerfile_str = "openmined/custom-worker-tensorflow:1.0.0"

The main thing you will need to do is make sure the version of tensorflow is compatible with syft. We install Syft in google colab so what ever version they use is probably compatible, best way to check is to try pip install tensorflow in a virtualenv with syft and see what versions resolve etc. The common dependencies are things like numpy.

Once you have your image with a working version of tensorflow make sure that the inputs and outputs of your function are supported by serialization.

For now I would recommend using numpy arrays or jax tensors as they are supported. You can see an example of constructing jax tensor weights here:
https://github.com/OpenMined/PySyft/blob/dev/notebooks/api/0.8/04-jax-example.ipynb

@madhavajay
Copy link
Collaborator

@Am0stafa also feel free to join us on slack if you want to chat directly:
https://slack.openmined.org/

@madhavajay
Copy link
Collaborator

I will close this issue for now. We will be adding more examples for DL soon but for now the above custom container workload information and notebook on how to send in weights and utilize custom class code should be sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Response Type: Question ❔ Question about implementation or some technical aspect
Projects
None yet
Development

No branches or pull requests

2 participants