From f679664c69d2b2a30c0359640f3294e316a3d41b Mon Sep 17 00:00:00 2001 From: Grzegorz Skorupko Date: Tue, 15 Oct 2024 14:12:32 +0200 Subject: [PATCH 1/7] Update config.yaml --- config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.yaml b/config.yaml index 40f1d70..05402f9 100644 --- a/config.yaml +++ b/config.yaml @@ -93,4 +93,4 @@ local_port: 8081 data_path: dataset/ -production_mode: False # Turn on to use environment variables such as data path, server address, certificates etc. +production_mode: True # Turn on to use environment variables such as data path, server address, certificates etc. From 65c0ee9d3e698245d62558b9df549922b208aba6 Mon Sep 17 00:00:00 2001 From: Grzegorz Skorupko Date: Tue, 15 Oct 2024 14:13:04 +0200 Subject: [PATCH 2/7] Update datasets.py --- flcore/datasets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flcore/datasets.py b/flcore/datasets.py index 6431baf..bb95f05 100644 --- a/flcore/datasets.py +++ b/flcore/datasets.py @@ -279,7 +279,7 @@ def load_kaggle_hf(data_path, center_id, config) -> Dataset: id = 'hungarian' elif id == 2: id = 'va' - elif id == 0: + elif id == 3: id = 'cleveland' elif id == None: pass @@ -654,4 +654,4 @@ def get_stratifiedPartitions(n_splits,test_size, random_state): def split_partitions(n_splits,test_size, random_state,X_data, y_data): sss = get_stratifiedPartitions(n_splits,test_size, random_state) splits_nested = (sss.split(X_data, y_data)) - return splits_nested \ No newline at end of file + return splits_nested From 4bbdad1399c13abf7b34be672fa367c3553bc2b9 Mon Sep 17 00:00:00 2001 From: faildeny Date: Wed, 11 Dec 2024 16:43:28 +0100 Subject: [PATCH 3/7] Update certificate paths --- server.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/server.py b/server.py index 0b9784a..f9f0f6a 100644 --- a/server.py +++ b/server.py @@ -49,11 +49,19 @@ def check_config(config): data_path = os.getenv("DATA_PATH") central_ip = os.getenv("FLOWER_CENTRAL_SERVER_IP") central_port = os.getenv("FLOWER_CENTRAL_SERVER_PORT") + ca_cert = os.getenv("FLOWER_SSL_CACERT") # ca.crt + server_cert = os.getenv("FLOWER_SSL_SERVER_CERT") # server.pem + server_key = os.getenv("FLOWER_SSL_SERVER_KEY") # server.key certificates = ( - Path('.cache/certificates/rootCA_cert.pem').read_bytes(), - Path('.cache/certificates/server_cert.pem').read_bytes(), - Path('.cache/certificates/server_key.pem').read_bytes(), + Path(f"{ca_cert}").read_bytes(), + Path(f"{server_cert}").read_bytes(), + Path(f"{server_key}").read_bytes(), ) + # certificates = ( + # Path('.cache/certificates/rootCA_cert.pem').read_bytes(), + # Path('.cache/certificates/server_cert.pem').read_bytes(), + # Path('.cache/certificates/server_key.pem').read_bytes(), + # ) else: data_path = config["data_path"] central_ip = "LOCALHOST" From aab4bf2bd0c68f84db1b8a3b6346772f866b94ed Mon Sep 17 00:00:00 2001 From: faildeny Date: Wed, 11 Dec 2024 16:45:55 +0100 Subject: [PATCH 4/7] Add random client_id --- client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client.py b/client.py index 93b4071..8c12178 100644 --- a/client.py +++ b/client.py @@ -3,6 +3,7 @@ from pathlib import Path import flwr as fl import yaml +import random import flcore.datasets as datasets from flcore.client_selector import get_model_client @@ -21,7 +22,7 @@ if config["production_mode"]: node_name = os.getenv("NODE_NAME") - num_client = int(node_name.split("_")[-1]) + num_client = random.randint(0, 2) data_path = os.getenv("DATA_PATH") flower_ssl_cacert = os.getenv("FLOWER_SSL_CACERT") root_certificate = Path(f"{flower_ssl_cacert}").read_bytes() From 9f4fa339c703aa7c535352612143562f876ddf3d Mon Sep 17 00:00:00 2001 From: Grzegorz Skorupko Date: Tue, 21 Jan 2025 14:56:19 +0100 Subject: [PATCH 5/7] Add handling of id 0 for kaggle dataset --- flcore/datasets.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flcore/datasets.py b/flcore/datasets.py index bb95f05..440269e 100644 --- a/flcore/datasets.py +++ b/flcore/datasets.py @@ -275,6 +275,8 @@ def load_kaggle_hf(data_path, center_id, config) -> Dataset: if id == -1: id = 'switzerland' + elif id == 0: + id = 'hungarian' elif id == 1: id = 'hungarian' elif id == 2: From c8b8ee4560ee74549e6e5cabeaa6d12b49704c79 Mon Sep 17 00:00:00 2001 From: Grzegorz Skorupko Date: Mon, 27 Jan 2025 15:53:21 +0100 Subject: [PATCH 6/7] Update Dockerfile with cache cleaning --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0c9bcd1..17bd6d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,12 @@ FROM ubuntu:22.04 RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes \ - pip iputils-ping curl wget wkhtmltopdf + pip wkhtmltopdf \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* COPY requirements.txt /home/requirements.txt -RUN pip3 install -r /home/requirements.txt +RUN pip3 install -r /home/requirements.txt --no-cache-dir RUN ln -s /usr/bin/python3 /usr/bin/python WORKDIR /flcore From 7f9c5e7ddc4893ec916f04a6b151d6a5bc5a47c4 Mon Sep 17 00:00:00 2001 From: Grzegorz Skorupko Date: Mon, 27 Jan 2025 15:53:57 +0100 Subject: [PATCH 7/7] Update requirements.txt with cpu-only torch --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 13078ec..81f149a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,6 +9,7 @@ pandas==2.0.1 PyYAML==6.0.1 scikit_learn==1.2.2 torch==2.0.1 +--extra-index-url https://download.pytorch.org/whl/cpu torchmetrics==0.11.4 tqdm==4.65.0 xgboost==1.7.5