{"id":13641388,"url":"https://github.com/scaleoutsystems/tee-mnist","last_synced_at":"2026-06-07T22:33:26.585Z","repository":{"id":53765289,"uuid":"485817051","full_name":"scaleoutsystems/tee-mnist","owner":"scaleoutsystems","description":"This is an example of the classic MNIST hand-written text recognition task using FEDn with the PyTorch C++ API. Optionally, you can run the example with Intel SGX.","archived":false,"fork":false,"pushed_at":"2022-08-24T12:38:39.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T04:09:07.114Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scaleoutsystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-26T14:16:52.000Z","updated_at":"2022-08-11T11:20:43.000Z","dependencies_parsed_at":"2022-08-13T02:50:52.102Z","dependency_job_id":null,"html_url":"https://github.com/scaleoutsystems/tee-mnist","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/scaleoutsystems/tee-mnist","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scaleoutsystems%2Ftee-mnist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scaleoutsystems%2Ftee-mnist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scaleoutsystems%2Ftee-mnist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scaleoutsystems%2Ftee-mnist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scaleoutsystems","download_url":"https://codeload.github.com/scaleoutsystems/tee-mnist/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scaleoutsystems%2Ftee-mnist/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34041087,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-07T02:00:07.652Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:01:20.337Z","updated_at":"2026-06-07T22:33:26.568Z","avatar_url":"https://github.com/scaleoutsystems.png","language":"C++","funding_links":[],"categories":["Machine Learning"],"sub_categories":["Library OSes and SDKs"],"readme":"# MNIST example - Pytorch C++\nThis is an example of the classic MNIST hand-written text recognition task using FEDn with the PyTorch C++ API.\n\n## Table of Contents\n- [MNIST example - Pytorch C++](#mnist-example---pytorch-c)\n  - [Table of Contents](#table-of-contents)\n  - [Prerequisites](#prerequisites)\n  - [Running the example (pseudo-distributed)](#running-the-example-pseudo-distributed)\n  - [Clean up](#clean-up)\n  - [Running in Trusted Execution Environment (TEE)](#running-in-trusted-execution-environment-tee)\n    - [Compute package in Intel SGX](#compute-package-in-intel-sgx)\n    - [Reducer and combiner in Intel SGX](#reducer-and-combiner-in-intel-sgx)\n    - [Running in AMD SEV](#running-in-amd-sev)\n\n## Prerequisites\nThe working environment for this example makes use of [VSC remote containers](https://code.visualstudio.com/docs/remote/containers). The development container is defined by the following files:\n\n1. `Dockerfile` defines the development container along with its dependencies.\n2. `.devontainer/devcontainer.json.tpl` defines how VSC will access and create the developmet container. The teplate need to be copied to `.devontainer/devcontainer.json` and edited. Please refer to this document for more information: https://code.visualstudio.com/docs/remote/devcontainerjson-reference.\n3. You may need to login into Scaleout's GitHub registry if the Dockerfile is based on `ghcr.io/scaleoutsystems/tee-gc/fedn:latest`.\n \n## Running the example (pseudo-distributed)\n\nDownload the data:\n```\nbin/download_data.sh\n```\n\nBuild the compute package and train the seed model:\n```\nbin/build.sh\n```\n\u003e This may take a few minutes. After completion `package.tgz` and `seed.npz` should be built in your current working directory.\n\nStart FEDn:\n\u003e **Note** If you are running on a remote container, you need to setup the remote host data path: `echo \"HOST_DATA_DIR=/path/to/tee-mnist/data\"  \u003e .env`.\n```\nsudo docker-compose up -d\n```\n\u003e This may take a few minutes. After this is done you should be able to access the reducer interface at https://localhost:8090.\n\nNow navigate to https://localhost:8090 and upload `package.tgz` and `seed.npz`. Alternatively, you can upload seed and package using the REST API as it follows.\n```\n# Upload package\ncurl -k -X POST \\\n    -F file=@package.tar.gz \\\n    -F helper=\"pytorch\" \\\n    https://localhost:8090/context\n\n# Upload seed\ncurl -k -X POST \\\n    -F seed=@seed.npz \\\n    https://localhost:8090/models\n```\n\nFinally, you can navigate again to https://localhost:8090 and start the experiment from the \"control\" tab. Alternatively, you can start the experiment using the REST API as it follows.\n```\n# Start experiment\ncurl -k -X POST \\\n    -F rounds=3 \\\n    -F validate=True \\\n    https://localhost:8090/control\n```\n\n## Clean up\nTo clean up you can run: `sudo docker-compose down`. To exit the Docker environment simply run `exit`.\n\n## Running in Trusted Execution Environment (TEE)\n\n### Compute package in Intel SGX\nThe compute package in this example supports running training and validation in [Intel SGX TEE](https://www.intel.com/content/www/us/en/developer/tools/software-guard-extensions/overview.html) via [Gramine](https://grapheneproject.io). The code was tested using [Azure Confidential Computing](https://azure.microsoft.com/en-us/solutions/confidential-compute). To enable this running mode, you can run: `echo \"LOADER=gramine-sgx\" \u003e\u003e .env` and repeat all of the seps.\n\n### Reducer and combiner in Intel SGX\nTo run reducer and combiner in Intel SGX you can use `docker-compose-tee.yaml` to start FEDn, as it follows.\n\n```\nsudo docker-compose -f docker-compose-tee.yaml up -d\n```\n\nNext steps are the same as running without Intel SGX but it may take a bit longer for the clients to connect.\n\n### Running in AMD SEV\nThis codebase has also been tested in [AMD SEV](https://developer.amd.com/sev) with [Azure Confidential VMs](https://docs.microsoft.com/en-us/azure/confidential-computing/virtual-machine-solutions-amd). The steps to follow don't change in this case as the whole VM memory is automatically encypted by the Azure service via AMD SEV.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscaleoutsystems%2Ftee-mnist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscaleoutsystems%2Ftee-mnist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscaleoutsystems%2Ftee-mnist/lists"}