Subwork_Sichang
Last updated
Last updated
Make a POC with flwr
.
Test deploy w/ Johnny.
Map multiple ports to different subdomains.
HTTPS for backend server.
SSL for Flower server.
Static file (.tflite
) serving.
Server: smart scheduling.
Simulation and physical benchmark system.
Clean up org.eu.fedcampus.train.Train
's state w/ sealed class TrainState
.
Feature in dyn_flower_android_drf
to start training without previously saved parameters.
Converted Beilong's TFLite on-device regression model training demo and integrated it into dyn_flower_android_drf
.
Studied Flower simulation in preparation for the benchmark platform.
Collaborated with Johnny on the dockerization of dyn_flower_android_drf
.
Collect data fuzzed with LaplaceMechanism
on FedCampus_APP
in preparation for Federated Analytics.
Studied Android background process.
Integrated org.eu.fedcampus.train
into FedCampus_APP
.
Silly simple_health_kit
model that predicts 3 classes of distance from 2 input: steps and calories.
dyn_flower_android_drf
tracks TrainingDataType
and advertise models accordingly.
Meet with Aicha to overview dyn_flower_android
and the customizations it provides for her federated learning.
Walk Aicha through the demo and the logic of the process.
Meet with Johnny & Tianjun to specify deployment tasks.
Integrating training package into FedCampus_APP with Beilong.
Tested tflite_convertor/convert_to_tflite.py
to verify that it is still able to generate the 5 .tflite
files.
Failed to make the script run on my ARM Mac after trying multiple Python and Tensorflow versions.
Got it running on Beilong's x86_64 Windows machine.
Start to add telemetry to org.eu.fedcampus.train
.
Togglable using an argument.
Sends client, session, and timing data to backend on training events.
Persuaded Beilong to write nice commit messages and format code.
Convert flwr.android_client
from Java to Kotlin and use suspend functions.
Extract training functionality from MainActivity
into org.eu.fedcampus.train
to work towards a standalone library.
Upgraded org.tensorflow:tensorflow-lite
dependency.
Check if the models are already downloaded to prevent redownloading.
Restore user input on launch.
FedCampus_APP
:
Currently, Beilong is writing this App in Java because he is more productive in Java. I suggest that we want the null safety from Kotlin and we will probably need to migrate to Kotlin, at least partially, when we want to use suspend functions.
Django REST server serve TFLite model files and their information.
Android client ask for TFLite model files, download them onto disk, and start FlowerClient
using the model downloaded.
Implemented to load model anywhere on disk instead of in assets/
: org/tensorflow/lite/examples/transfer/api/ExternalModelLoader.kt
.
Django server launch Flower server in background process.
Studied Selery, Huey, and APScheduler, and landed on using multiprocessing
directly.
Tried saving model parameters in the background Flower process using a custom Strategy
, but it does not work because django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
.
Spawn a new process for each server requested.
Spawn a thread to monitor it so that it could save the parameters to DB.
Restore old parameters from DB at Flower server start.
flower
uses protobuf
to generate language-specific gRPC stub code.
In Android example, the TFLite model is hard-coded:
Data parsing functions have data semantics hard-coded and and run at data load.
No encoded way to transfer model (.tflite
) files.
The TFLite API used (TransferLearningModel
) is model-agnostic. Potential to easily swap models.
Consider an extra connection layer in front of flower
.
flower
has sophisticated gRPC configuration—hard to fiddle with.
Keeping flower
contained and in one piece is beneficial for future compatibility.
Can use Django to spawn flower servers and reverse proxy to them.
Consider using Django to spawn flower servers on new ports, and tell clients to connect to them at the ports.
Study how flower
works.
The strategy
handles most custom logic on server side.
Order of connection and training managed/hardcoded.
Start training after connection established.
No resume.
No sleep option.
Sketch POC of the whole structure without on-device training.
Subscribe to topic.
Publish content in EditText input box.
Fairly maintained and well documented.
Worked out of the box.
Uses TFLite for Android.
Uses gRPC.
Set up two Nova 9 for development.
It is just easier to set the language to English.
Developer options
is in System & updates
.
Need to turn USB debugging
on.
Need to log in to HUAWEI ID.
Requires manually cloning MNN and configuring Cpp toolchain to build.
Uses JNI to call Cpp function from Java.
FedML wants you to use their platform as a service, register an account, connect your app to them and manage online.
Android SDK API documents are basically nonexistent.
Read FedML Android SDK codebase because no documentation.
Investigated FedML platform lock-in and cloud lock-in.
Unfortunately, FedML Android SDK forces the users to use open.fedml.ai as a proxy for all MQTT traffic.
Forced MNN on Android
Tried Retrofit and made blocking GET request not in strict mode.
Android client was able to make GET request to the server.
Set up fake JSON API. Made requests successfully both in Java test and on Android emulator.
Looked for Android HTTPS client resources.
Checked out the previous Android app FedC
.
The app architecture is similar in Java, although the UI uses XML.
org.eclipse.paho.client.mqttv3
handles MQTT.
The connection blocks the main thread, causing UI lag.
Nuked Kotlin and related work out of the plan.
Looked for Android developers tutorial for Java instead.
Hard to find because most are in Kotlin.
Read FedML background materials.
Ran FedML demo Python simulation.
Tried Android Studio, Kotlin, JetPack Compose.
Sketched tech stack plan for the Android platform.
Looked for full-duplex communication protocol as demanded by Jiaqi.
Grand update to dyn_flower_android_drf
to use the latest TFLite on-device training following their example. .
Updated FedCampus_APP
to be synchronized with dyn_flower_android_drf
. .
Created to group FedCampus_APP and dyn_flower_android_drf together.
.
to address the breakage.
:
DB using .
Needed .
Also needed to .
.
.
Started
MQTT client on Django connecting to Johnny's deployed broker following .
MQTT client on Android following .
Tensorflow Lite was benchmarked to be a few times faster than PyTorch Mobile. .
:
:
Tried out
.
.
Tap About phone
> Build number
7 times to .
Studied .
supports major Machine Learning libraries.
onnxruntime cannot train on mobile currently 😢: . We would have to use a mobile framework anyway.
Tried Retrofit with and for non-blocking requests.
Tried supporting Kotlin in existing Java app and calling Kotlin from Java. . . Very minimal changes and easy.
Set up test repository .
Use localhost on emulators according to .
from Android developers.
the Kotlin HTTPS client/server library.
Android HTTPS client .
, a Git repository of code samples.
For , I only found which is for web apps. Unofficial instructions to make push messages to Android exist on and , both of which use Firebase for the push service.