diff --git a/.github/workflows/smoke_test_cross_device_mnn_server_win.yml b/.github/workflows/smoke_test_cross_device_mnn_server_win.yml deleted file mode 100644 index b38a1831d5..0000000000 --- a/.github/workflows/smoke_test_cross_device_mnn_server_win.yml +++ /dev/null @@ -1,55 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: CROSS-DEVICE-MNN-Windows - -# Controls when the workflow will run -on: - # Triggers the workflow on push or pull request events but only for the master branch - schedule: - # Nightly build at 12:12 A.M. - - cron: "12 12 */1 * *" - push: - branches: [ master, test/v0.7.0, dev/v0.7.0 ] - pull_request: - branches: [ master, test/v0.7.0, dev/v0.7.0 ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - cross-device-mnn-server: - defaults: - run: - shell: powershell - working-directory: fedml-devops\python - strategy: - fail-fast: false - matrix: - os: [ windows-2019 ] - arch: [X64] - python-version: ['3.8'] -# exclude: -# - os: macos-latest -# python-version: '3.8' -# - os: windows-latest -# python-version: '3.6' - runs-on: [self-hosted, runner-windows, devops] - steps: - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - # https://github.com/actions/checkout/issues/116#issuecomment-644419389 - - uses: actions/checkout@v3 - with: - path: fedml-devops - clean: true - - name: pip install -e ./ - run: | - pip install -e ./ - pip install MNN==1.1.6 - - name: test server of cross-device - run: | - cd quick_start/beehive - .\run_server.bat diff --git a/doc/en/starter/installation.md b/doc/en/starter/installation.md index ebf3b8dac6..737e2e5395 100644 --- a/doc/en/starter/installation.md +++ b/doc/en/starter/installation.md @@ -11,7 +11,16 @@ FedML supports Linux, MacOS, Windows, and Android. ``` pip install fedml ``` -(Note: please use python 3.6, 3.7, 3.8, 3.9. We will support 3.10 systematically in the next iteration.) + +The default machine learning engine is `PyTorch`. FedML also supports `TensorFlow`, `Jax`, and `MXNet`. +You can install related engine as follows: +``` +pip install "fedml[tensorflow]" +pip install "fedml[jax]" +pip install "fedml[mxnet]" +``` +Note that the commands above only install the CPU version. +If you need GPU/TPU version, please follow TensorFlow/Jax/MXNet official guidance. ## Installing FedML with Anaconda diff --git a/python/fedml/model/model_hub.py b/python/fedml/model/model_hub.py index 493e1cb5d4..67388d4db7 100644 --- a/python/fedml/model/model_hub.py +++ b/python/fedml/model/model_hub.py @@ -72,11 +72,14 @@ def create(args, output_dim): model = (gen, disc) elif model_name == "lenet" and hasattr(args, "deeplearning_backend") and args.deeplearning_backend == "mnn": from .mobile.mnn_lenet import create_mnn_lenet5_model + create_mnn_lenet5_model(args.global_model_file_path) + model = None # for server MNN, the model is saved as computational graph and then send it to clients. elif model_name == "resnet20" and hasattr(args, "deeplearning_backend") and args.deeplearning_backend == "mnn": from .mobile.mnn_resnet import create_mnn_resnet20_model create_mnn_resnet20_model(args.global_model_file_path) + model = None # for server MNN, the model is saved as computational graph and then send it to clients. else: raise Exception("no such model definition, please check the argument spelling or customize your own model") return model diff --git a/python/quick_start/beehive/README.md b/python/quick_start/beehive/README.md index b78daa7154..9762ea18c9 100644 --- a/python/quick_start/beehive/README.md +++ b/python/quick_start/beehive/README.md @@ -22,8 +22,8 @@ brew install android-platform-tools [https://github.com/FedML-AI/FedML/tree/master/python/quick_start/beehive](https://github.com/FedML-AI/FedML/tree/master/python/quick_start/beehive) -5. For local debugging of cross-device server, please try - +5. For local debugging of cross-device server, please try +(Cross device server on Windows is not working because MNN lib can't work on Windows correctly, so you should run cross-device server on linux or other OS in which MNN lib can be working correctly) ``` sh run_server.sh ``` diff --git a/python/quick_start/beehive/config/fedml_config.yaml b/python/quick_start/beehive/config/fedml_config.yaml index c2d8a1b89f..58ad7dc828 100644 --- a/python/quick_start/beehive/config/fedml_config.yaml +++ b/python/quick_start/beehive/config/fedml_config.yaml @@ -9,7 +9,7 @@ environment_args: data_args: dataset: "mnist" - data_cache_dir: "../../../data/mnist" + data_cache_dir: ~/fedml_data partition_method: "hetero" partition_alpha: 0.5 train_size: 10000 @@ -18,8 +18,8 @@ data_args: model_args: model: "lenet" deeplearning_backend: "mnn" - model_file_cache_folder: "./model_file_cache" # will be filled by the server automatically - global_model_file_path: "./model_file_cache/global_model.mnn" + model_file_cache_folder: "model_file_cache" # will be filled by the server automatically + global_model_file_path: "model_file_cache/global_model.mnn" train_args: federated_optimizer: "FedAvg" diff --git a/python/quick_start/beehive/my_dataset.py b/python/quick_start/beehive/my_dataset.py index 5f85221d4b..b527945b10 100644 --- a/python/quick_start/beehive/my_dataset.py +++ b/python/quick_start/beehive/my_dataset.py @@ -5,11 +5,11 @@ class MnistDataset(MNN.data.Dataset): - def __init__(self, training_dataset=True): + def __init__(self, training_dataset=True, root_path="./data"): super(MnistDataset, self).__init__() self.is_training_dataset = training_dataset - trainset = MNIST(root="./data", train=True, download=True) - testset = MNIST(root="./data", train=False, download=True) + trainset = MNIST(root=root_path, train=True, download=True) + testset = MNIST(root=root_path, train=False, download=True) if self.is_training_dataset: self.data = trainset.data / 255.0 self.labels = trainset.targets diff --git a/python/quick_start/beehive/torch_server.py b/python/quick_start/beehive/torch_server.py index 530256ecee..3c3a366d59 100644 --- a/python/quick_start/beehive/torch_server.py +++ b/python/quick_start/beehive/torch_server.py @@ -1,3 +1,6 @@ +import os +from os.path import expanduser + import MNN import fedml @@ -12,8 +15,8 @@ device = fedml.device.get_device(args) # load data - train_dataset = MnistDataset(True) - test_dataset = MnistDataset(False) + train_dataset = MnistDataset(True, root_path=args.data_cache_dir) + test_dataset = MnistDataset(False, root_path=args.data_cache_dir) train_dataloader = MNN.data.DataLoader(train_dataset, batch_size=64, shuffle=True) test_dataloader = MNN.data.DataLoader( test_dataset, batch_size=args.batch_size, shuffle=False @@ -21,7 +24,7 @@ class_num = 10 # load model - model = fedml.model.create(args, output_dim=class_num) + fedml.model.create(args, output_dim=class_num) # start training server = ServerMNN( diff --git a/python/setup.py b/python/setup.py index d58e09adb2..4861ccd81c 100755 --- a/python/setup.py +++ b/python/setup.py @@ -54,7 +54,7 @@ def finalize_options(self): ] requirements_extra_jax = [ - "jax[cuda]", + "jax[cpu]", "dm-haiku", "optax", "jaxlib"