Subwork_Sichang
TODOs
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.
Up till now
Clean up
org.eu.fedcampus.train.Train
's state w/ sealed classTrainState
.Feature in
dyn_flower_android_drf
to start training without previously saved parameters.
Up till 2023/7/3
Converted Beilong's TFLite on-device regression model training demo and integrated it into
dyn_flower_android_drf
.Grand update to
dyn_flower_android_drf
to use the latest TFLite on-device training following their example. BREAKING! Replacetransfer_api
with latest TFLite usage.Updated
FedCampus_APP
to be synchronized withdyn_flower_android_drf
. Match latestdyn_flower_android_drf
.
Up till 2023/6/21
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
onFedCampus_APP
in preparation for Federated Analytics.Studied Android background process.
Up till 2023/6/14
Integrated
org.eu.fedcampus.train
intoFedCampus_APP
.Silly
simple_health_kit
model that predicts 3 classes of distance from 2 input: steps and calories.dyn_flower_android_drf
tracksTrainingDataType
and advertise models accordingly.
Up till 2023/6/8
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.
Created MonoRepo to group FedCampus_APP and dyn_flower_android_drf together.
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.
Opened an issue on the Flower repo to address the breakage.
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.
Up till 2023/5/26
dyn_flower_android
client side:Convert
flwr.android_client
from Java to Kotlin and use suspend functions.Extract training functionality from
MainActivity
intoorg.eu.fedcampus.train
to work towards a standalone library.Upgraded
org.tensorflow:tensorflow-lite
dependency.DB using Room.
Check if the models are already downloaded to prevent redownloading.
Restore user input on launch.
Needed Room migration.
Also needed to store schema.
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.
Up till 2023/5/18
Started dyn_flower_android_drf
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 becausedjango.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.
Up till 2023/4/21
flower
usesprotobuf
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.
Up till 2023/04/10
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.
Up till 2023/04/04
Sketch POC of the whole structure without on-device training.
MQTT client on Django connecting to Johnny's deployed broker following How to Use MQTT in The Django Project.
MQTT client on Android following example in eclipse/paho.mqtt.java.
Subscribe to topic.
Publish content in EditText input box.
Tried out Flower
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.
Tap
About phone
>Build number
7 times to enter developer mode.Developer options
is inSystem & updates
.Need to turn
USB debugging
on.Need to log in to HUAWEI ID.
Up till 2023/03/27
Studied FedML Android demo.
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
Up till 2023/03/12
Tried Retrofit and made blocking GET request not in strict mode.
Tried supporting Kotlin in existing Java app and calling Kotlin from Java. Commit. Answer on StackOverflow. Very minimal changes and easy.
Set up test repository AndroidClient_django_server_POC.
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.
Up till 2023/03/09
Looked for Android HTTPS client resources.
Perform network operations overview from Android developers.
Ktorthe Kotlin HTTPS client/server library.Android HTTPS client Retrofit.
android/connectivity-samples, a Git repository of code samples.
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.
Up till 2023/03/05
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.
Last updated