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

[Docs] Update PyTorch tutorial #2063

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions Documentation/tutorials/pytorch/index.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
PyTorch PPML Framework Tutorial
===============================

.. warning::

This tutorial is outdated and may not work on the current Gramine version /
currently supported Linux distributions. Contributions to refresh it are
welcomed!

.. highlight:: sh

This tutorial presents a framework for developing PPML (Privacy-Preserving
Expand Down Expand Up @@ -91,15 +85,30 @@ user who will decrypt it and analyze its contents.
Prerequisites
-------------

- Ubuntu 20.04.
- A Linux-based operating system (e.g., Ubuntu 22.04 or later)

- PyTorch (Python3). PyTorch is a framework for machine learning based on
Python. Please `install PyTorch <https://pytorch.org/get-started/locally/>`__
before you proceed (don't forget to choose Linux as the target OS and CPU as
the compute platform).

- Gramine v1.5, with DCAP support. DCAP software infrastructure must also be
installed.
- Gramine with DCAP support. DCAP software infrastructure must also be
installed. Please refer to the `Gramine Attestation Documentation
<https://gramine.readthedocs.io/en/latest/attestation.html>`__ for more
details.

.. warning::

If you're on a recent distro that implements PEP 668 (e.g., Debian 12,
Ubuntu 24.04), it is required to use a virtual environment to manage
dependencies. You can create and activate a virtual environment with the
following commands:

.. code-block:: sh

sudo apt install python3-venv
python3 -m venv my_venv
source my_venv/bin/activate

Executing Native PyTorch
------------------------
Expand All @@ -113,7 +122,7 @@ example as a basis and will improve it to protect all user files.

Go to the directory with Gramine's PyTorch example::

git clone --depth 1 --branch v1.5 https://github.com/gramineproject/examples.git
git clone --depth 1 https://github.com/gramineproject/examples.git
cd examples/pytorch

The directory contains a Python script ``pytorchexample.py`` and other relevant
Expand Down Expand Up @@ -366,7 +375,7 @@ We will use the reference implementation of the Secret Provisioning server found
under ``CI-Examples/ra-tls-secret-prov`` directory (in the core Gramine
repository), so let's build the secret provisioning server::

git clone --depth 1 --branch v1.5 https://github.com/gramineproject/gramine.git
git clone --depth 1 `|stable-checkout|` https://github.com/gramineproject/gramine.git
cd gramine/CI-Examples/ra-tls-secret-prov
make app dcap RA_TYPE=dcap

Expand Down