"Python SDK library for using the Modalic Federated Learning Operations Platform."
Project description
Python SDK
Python SDK library for using the Modalic Federated Learning Operations Platform. The SDK library serves as convenient interface for performing Federated Learning with the most common Machine Learning frameworks like Pytorch written in the Python programming language. As an API layer it enables an individual client application to take part within a Federated Learning setup. The coordination of a distributed Machine Learning process solving a particular problem, is done by a central server or service provider which can be started via Python script using the SDK.
As the main entrypoint to a production ready FLOps Platform, this software package aims for all developers and ML practitioners that want to run ML use cases in distributed fashion.
Usage
In order to run a Federated Learning procedure two main entities have to instantiated. The client logic and the aggregation server application. Both can be started via SDK. Currently Pytorch & Tensorflow are supported as framework to construct the ML architecture.
Run the Aggregation Server
# (1) Run the aggregation server with configuration using .toml
cfg = toml.load(".toml")
modalic.run_server(cfg)
# .toml
#
# [api]
# server_address = "[::]:8080"
#
# [model]
# data_type = "F32"
#
# [process]
# training_rounds = 10
# participants = 3
# strategy = "FedAvg"
Construct the client logic using a framework of choice. The Pytorch approach uses an object-oriented paradigm while the Tensorflow examples applies a functional one. Both paradigm are available in both frameworks vice versa.
Pytorch
# (2) Construct the client logic.
# Define a Trainer object that contains all the ML logic.
class Trainer():
def __init__():
self.model = Net()
self.dataset = torch.utils.data.DataLoader(dataset, batch_size=32)
...
def train():
...
# Put the Modalic client layer on top of the ML logic.
client = modalic.PytorchClient(Trainer())
# (3) Run training for single client.
client.run()
Tensorflow
# (2) Construct the client logic.
# Wrap the custom defined train function with modalic.tf_train.
@modalic.tf_train(...)
def train(model, x_train, y_train):
model.fit(x_train, y_train, batch_size=32, epochs=1)
return model
...
# Define the model & data
model = tf.keras.Model(...)
...
# (3) Run training for single client simply via.
train(model, x_train, y_train)
Please keep in mind that this code snippet shows only the logic and the general idea. For more details, check out the /examples folder that contains more in-depth and complete instruction sets and examples that are actually actionable.
Installation
Binaries
The latest release of Modalic Python SDK can be installed via pip:
pip install modalic
Documentation
See the Python SDK docs for more information. Additionally, some examples for starting with Modalic are provided in this repository under the examples folder. Any Questions? Reach out to us on modalic.ai.
Development
Find more information on contributing to the open source stack and the development process in general here.
License
The Modalic Python SDK is distributed under the terms of the Apache License Version 2.0. A complete version of the license is available in LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for modalic-0.1.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c074336baab2ca5dceffc8cf55c1f2f22b21713ff1e0cd3b940abd4857b6027 |
|
MD5 | 39bf2d788ddd65e86e6ee998e2ead62a |
|
BLAKE2b-256 | 3dfc805d2ff79f2fd397b193aec12b1f41a2d50581719b2cd664f3d5337101e2 |
Hashes for modalic-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85240bd46c433fe1dafdeb1860540b96e155a1967f744b97e1b871183d64e090 |
|
MD5 | de97f96f044c2553464ba8f991a596d2 |
|
BLAKE2b-256 | 97741c3d74761cf19b08a39dbd76036c3b0bf7794f339cd0acbf255b6cce7683 |
Hashes for modalic-0.1.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36263d58157e3924dcf0b66034bff732de06d9b55ea74e0e31c88484e393644a |
|
MD5 | c7d296711d9262b4484218fc84d4e3f8 |
|
BLAKE2b-256 | ce622db8aae947601848a36ac0a3dc4c575ca799057169685b933ca3705c4336 |
Hashes for modalic-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2832b7c4ea4617a713aa2094ff5718fc07d5944de72fbfa482d33feb5746d37e |
|
MD5 | becbe37b97a76312f7511dc93e639abc |
|
BLAKE2b-256 | 31fe8ff59de688fb93f755876f357b91c0cf420b18a902b80eb4e9a500804d35 |
Hashes for modalic-0.1.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 367c624607efd17db042aefbafd303e4e10c9a6077e7210a2af4bb4860403ab5 |
|
MD5 | b81f73863515fda9106f300e984695bb |
|
BLAKE2b-256 | b076a96b537e54d61f23e1adc5bf2a0fe2a4a94214c34a7bd660d2484e84d47a |
Hashes for modalic-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7db57652916cf458fa6f7351bfc1862bfbf6e2051cec900f2c3523120aed3116 |
|
MD5 | 210c2d8aef850641fa5eb8206312d8dd |
|
BLAKE2b-256 | b76e9feb5a58e7e4bc7d573e15178124c38f26e342569e294d03bcb95e954f01 |
Hashes for modalic-0.1.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e1e2f85a38ad3c8ed55f2063af23f6b774c55700e44ef222705287359edf1aa |
|
MD5 | 3136e70aedb9a059061356f046435d2d |
|
BLAKE2b-256 | 7c239216a77d38073f516dba27fa3677ea1558852e69a752855a8294c8cb0aad |
Hashes for modalic-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35ca9ba6cf1a756db1712f5dab93cd63d002778dc0b02e7c7d093b9b1d8667d2 |
|
MD5 | c44aadd017339246311b3e72041e22ed |
|
BLAKE2b-256 | 12358de644d4cf005220b69b5db65ad48b4a7d5b8720202b863d9e227b14a1e8 |
Hashes for modalic-0.1.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6bc084cecb7f4fa74aee949369e8f01a20ad4ecacb795a3898e63cff9f499b5 |
|
MD5 | 653dac5372c69c066f675ed88fc0c0ed |
|
BLAKE2b-256 | e66aa3fbd180280c7d4b0f5b01ebed5ec1197e43bbaeedb99fd4743806a576d9 |
Hashes for modalic-0.1.0-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 432f9db8f63ab099f2b0f90b518e995088a8a4feca3d70daa0b0cced84919a10 |
|
MD5 | 193d89bd6b1f5c6caa2cf7b3e9a657c9 |
|
BLAKE2b-256 | 35ecd333e83ab8cb51ac89c4843450e5cdc80b2846687b72c4e179e4b430a0e9 |
Hashes for modalic-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c5cd9c68a4cfaec99a356bf5208d06d5568dfa1028a09b103cc656b5bea1c5f |
|
MD5 | 30c9c3d6f301eaf53b3a33149b209e4e |
|
BLAKE2b-256 | 32ddc89a4548b63b309d0d2737e8654b2f608d8dfe9413c3984aa216b9760134 |
Hashes for modalic-0.1.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6228817ba945966b7ec9d842037e9ee94f25bb2207dda57418b332ecd7fd9565 |
|
MD5 | b888a52c03e6a6b5e2566cb845513643 |
|
BLAKE2b-256 | 302e8ce68a1530c207ee3c6fe5695d2d029a8621269c3efe38026167049fd283 |
Hashes for modalic-0.1.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e97d3fbb3e6ffe7cdc2854f67b328dfc6cc6c1bb8a90e0e34d6254f7980466a |
|
MD5 | 58957ba6eeafb398562fa6765808c671 |
|
BLAKE2b-256 | a2f1db483dd2e5e43d9611f1582f58816eb54bde7b8810e14c91331b21315786 |
Hashes for modalic-0.1.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc48523a0a93a5ece520784c2a33385f268e4617fbfd616b0ba0f7cacf5ea6e7 |
|
MD5 | f833362ee678f29e5a090418fd048dbb |
|
BLAKE2b-256 | 65aef80b9aa11884e65bd97803b67e689bf582f9af8d2633811c8d99d5dbe06e |