AML-IP Collaborative Learning

AML-IP Collaborative Learning

This demo shows aCollaborative Learning Scenario and the AML-IP nodes involved:Model Manager Receiver Node andModel Manager Sender Node. With these 2 nodes implemented, the user can deploy as many nodes of each kind as desired and check the behavior of a simulated AML-IP network running. They are implemented in Python to prove the communication between the two implementations.

Background

The purpose of the demo is to show how a Sender and a Receiver node can communicate. The Receiver node awaits model statistics from the Sender. Since the Sender doesn’t have a real AML Engine, it sends the model statistics as a string. Upon receiving the statistics, the Receiver sends a model request, also as a string since it doesn’t have an AML Engine. Then, the Sender converts the received model request to uppercase and sends it back as a model reply.

../../_images/collaborative_demo.png

Prerequisites

Before running this demo, ensure that AML-IP is correctly installed using one of the following installation methods:

Building the demo

If the demo package is not compiled, please refer toBuild demos or run the command below.

 1.jpeg

Once AML-IP packages are installed and built, import the libraries using the following command.

2.jpeg

Explaining the demo

In this section, we will delve into the details of the demo and how it works.

Model Manager Receiver Node

This is the Python code for theModel Manager Receiver Node application. It does not use real AML Models, but strings. It is implemented in Python using amlip_pyAPI.

This code can be found here.

The next block includes the Python header files that allow the use of the AML-IP Python API.

3.jpeg

Let’s continue explaining the global variables.

DOMAIN_ID variable isolates the execution within a specific domain. Nodes with the same domain ID can communicate with each other.

4.jpeg

waiter is a WaitHandler that waits on a boolean value. Whenever this value is True, threads awake. Whenever it is False, threads wait.

5.jpeg

The CustomModelListener class listens toModel Statistics Data Type andModel Reply Data Type messages received from aModel Manager Sender Node. This class is supposed to be implemented by the user in order to process the messages received from other nodes in the network.

6.jpeg

The main function orchestrates the execution of theModel Manager Receiver Node. It creates an instance of the ModelManagerReceiverNode and starts its execution with the specified listener.

7.jpeg

After starting the node, it waits for statistics to arrive from theModel Manager Sender Node.

8.jpeg

Then, it requests a model from the Model Manager Sender Node using the received server ID.

 9.jpeg

Finally, the node stops.

10.jpeg

Model Manager Sender Node

This is the Python code for the Model Manager Sender Node application. It does not use real AML Models, but strings. It does not have a real AML Engine but instead the calculation is an upper-case conversion of the string received. It is implemented in Python using amlip_py API.

This code can be found here.

The following block includes the Python header files necessary for using the AML-IP Python API.

11.jpeg

Let’s continue explaining the global variables.

DOMAIN_ID isolates the execution within a specific domain. Nodes with the same domain ID can communicate with each other.

12.jpeg

waiter is a WaitHandler that waits on a boolean value. Whenever this value is True, threads awake. Whenever it is False, threads wait.

14.jpeg

The CustomModelReplier class listens to Model Request Data Type request messages received from a Model Manager Receiver Node. This class is supposed to be implemented by the user in order to process the messages.

15.jpeg

The main function orchestrates the execution of the Model Manager Sender Node. It creates an instance of ModelManagerSenderNode.

16.jpeg

After starting the node, it publishes statistics using the publish_statistics() function, which fills a Model Statistics Data Type and publishes it.

17.jpeg

Then we start the node execution, passing the previously defined CustomModelReplier() class, which is responsible for managing the request received.

19.jpeg

Waits for the response model to be sent to the Model Manager Receiver Node.

20.jpeg

Finally, it stops and closes the node.

21.jpeg

Running the demo

This demo runs the implemented nodes in amlip_demo_nodes/amlip_collaborative_learning_demo.

Run Model Manager Receiver Node

Run the following command:

 22.jpeg

Run Model Manager Sender Node

Run the following command to answer before closing:

 23.jpeg

 

Check the video to see how it works:

 

 

 

By Denisa Alexandru from eProsima.

MORE INFORMATION ABOUT ALMA:

For any questions please contact This email address is being protected from spambots. You need JavaScript enabled to view it..

Logo ALMA

The ALMA project leverages AML properties to develop a new generation of interactive, human-centered machine learning systems.

Coordinator Office Address

Plaza de la Encina 10-11, Núcleo 4, 2ª Pl.
28760 Tres cantos - Madrid (España)

  • X
  • LinkedIn

EN-Funded_by_the_EU-POSThis project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 952091.