Decentralized Machine Learning Client
Decentralized Machine Learning Client
Sonar is a smart contract library that allows data scientists to publish new models they want to get trained into the ModelRepository and people to pick models they can train on their personal data.
You can find a working proof of concept in the notebooks directory.
Using Docker is the easiest way to get this running.
docker-compose up. This will launch IPFS, the in-memory fake ethereum blockchain with the smart contract, OpenMined mine.js and the jupyter notebooks
docker-compose upto get some infos on what happens
Before running the demo there are a couple of prerequisites you need to install.
Before installing the python packages you need to make sure your system holds a set of basic math libraries required for the encryption operations (
phelib)
For MacOS with brew just run:
brew install libmpc mpfr gmp
For Linux run:
apt-get install libgmp3-dev libmpfr-dev libmpc-dev python3-dev
Then run:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash nvm install v8
The solidity tools are required to compile the contract of our demo. See installing solidity for instructions for your platform.
In order to import ABIs you'll need to install truffle.
sudo npm install -g truffle
As the network itself is too big to actually host it on the blockchain you need
IPFSto host the files. For installation see the ipfs installation page or run:
brew install ipfs
After installation is complete run
ipfs initto initialize your local IPFS system.
Make sure you have a clean python3 install and continue with installing all the packages
pip install -r requirements.txt
PySonar utilizes pip-tools to help with maintaining PIP packages (https://github.com/jazzband/pip-tools)
To update all packages, periodically re-run
pip-compile --upgrade
First you need to get
sonarpackage bundled up
python setup.py install
Then make sure you also have the
syftpackage properly installed. Head over to the repository and follow its instructions.
The interface for our
Sonarsmart contract is distributed via an npm package. You can import the
ModelRepository.abifile to your local environment by running
make import-abi
which will place the file at
abis/ModelRepository.abi.
After you made sure all the installation steps are done you need to set up your local mock environment.
# start the ipfs daemon in the background ipfs daemon& # run local ethereum mock testrpc -a 1000
Now open a second shell, start the notebook and follow its instructions
jupyter notebook notebooks
brewinstallation of solidity not working properly
If you experience any problems while running this demo please create a github issue and help us get better.
Apache-2.0 by OpenMined contributors