xaynetwork / xaynet

Xaynet represents an agnostic Federated Machine Learning framework to build privacy-preserving AI applications.
https://www.xaynet.dev/
Apache License 2.0
200 stars 28 forks source link

use of Xaynet with Raspberry pi #961

Open prathapkumarbaratam opened 2 years ago

prathapkumarbaratam commented 2 years ago

hi @Robert-Steiner , Iam currently working on project about federated learning and came across your framework during exploratory analysis. My project should utilize federated learning in this manner - I have an aggregation server (let's say in a cloud). I want this server to provide a model for my 2 Raspberry PIs. These two RPIs would then train the model on a local data for x epochs and provide the trained models/gradients back to the global server. On this server, the results would be federated averaged and a new model would be sent to the PIs. Is such a workflow possible with your framework? If so, could you provide me with a hint?any other examples using xaynet if possible?

Thank you,

Robert-Steiner commented 2 years ago

Hi @prathapkumarbaratam, yes that is possible. You can use our Python SDK to write your own client that fits your needs or you can also take a look into our examples in bindings/python/examples. Please note that the PET protocol requires at least three clients in order to function. Further, the selection of clients is random, which means that it will probably require more than three clients for the server to run several rounds. If you need any further assistance, please let me know.

prathapkumarbaratam commented 2 years ago

Thanks for quick response @Robert-Steiner . When Iam running rust examples. Iam getting error like this. can you help me in this?

the first pic i have tried running coordinater and second pic I have tried running example with 4 participants and getting log like that. can you figure it out once Screenshot (14) Screenshot (15)

Thanks and Regards Prathap kumar

acrrd commented 2 years ago

This does not seems to be related with the project. Maybe you have a compilation that hanged some where and it is still keeping the lock or some inconsistency within the .cargo directory. You can take a look here on how to resolve your issue: https://stackoverflow.com/questions/47565203/cargo-build-hangs-with-blocking-waiting-for-file-lock-on-the-registry-index-a

Robert-Steiner commented 2 years ago

@prathapkumarbaratam I also recommend to use docker compose to build and run the coordinator. The coordinator requires some infrastructure like redis for saving its state and the docker compose command here starts everything that is needed.

prathapkumarbaratam commented 2 years ago

@Robert-Steiner can you tell me why iam getting this error after running Docker-compose for this case(I am bit new to docker). it is saying that app/configs not found. And also tell me step by step with commands how to run FL using xaynet framework. image image

Thanks and Regards, Prathap kumar

prathapkumarbaratam commented 2 years ago

hi, after running docker-compose up from docker directory ,i got like this. Can you tell me is it over?any thing wrong in it. Iam bit new to docker and docker compose. can anyone tell me step by step. i didn't get understood from logs. and also me tell me what commands i have to type in power shell for running a simple Federated learning basic example by step by step. Screenshot (26) Screenshot (27) Screenshot (28)

Thanks and Regards, Prathap kumar

acrrd commented 2 years ago

The coordinator is running correctly. You can follow this example to create https://github.com/xaynetwork/xaynet/blob/master/bindings/python/examples/keras_house_prices/README.md your own client. Keep in mind that the selection of a client for each phase of the protocol is random, and a client for one particular round could not be choose at all. So to successfully complete a round you need many active clients, but there should be not problem in running more the one on a Raspberry. For more information about the protocol please read the whitepaper.

prathapkumarbaratam commented 2 years ago

@acrrd Iam getting following error after creating xaynet virtual environment. seems xaynet-sdk-python not supported?

image

acrrd commented 2 years ago

are you using python 3.6 or higher? I cannot reproduce this.

prathapkumarbaratam commented 2 years ago

iam using python 3.7.9 version @acrrd @Robert-Steiner