adap / flower

Flower: A Friendly Federated AI Framework
https://flower.ai
Apache License 2.0
5.13k stars 881 forks source link

About flower examples quickstart-tensorflow #3743

Open rasb0 opened 4 months ago

rasb0 commented 4 months ago

What is your question?

Excuse me,

Regarding the flower example quick start-tensorflow, which one should I use in the flower version?

jafermarq commented 4 months ago

Hi @rasb0, for examples/quickstart-tensorflow just follow the instructions in the README. It will use the latest stable version of flower (1.9.0). Do you see any issues?

rasb0 commented 3 months ago

Dear Ja, sorry for the late reply to you, Later, I found the flower (v1.5.0) version from online resources and successfully executed server.py and client.py.

Raspberry pi Server.py log: (env) pi@raspberrypi:~/project/flower-main/examples/quickstart-tensorflow $ python3 server.py INFO flwr 2024-07-28 22:04:52,662 | app.py:162 | Starting Flower server, config: ServerConfig(num_rounds=3, round_timeout=None) WARNING: All log messages before absl::InitializeLog() is called are written to STDERR I0000 00:00:1722175492.709628 2389 config.cc:230] gRPC experiments enabled: call_status_override_on_cancellation, event_engine_dns, event_engine_listener, http2_stats_fix, monitoring_experiment, pick_first_new, trace_record_callops, work_serializer_clears_time_cache I0000 00:00:1722175492.788178 2397 work_stealing_thread_pool.cc:320] WorkStealingThreadPoolImpl::PrepareFork INFO flwr 2024-07-28 22:04:52,828 | app.py:175 | Flower ECE: gRPC server running (3 rounds), SSL is disabled INFO flwr 2024-07-28 22:04:52,829 | server.py:89 | Initializing global parameters INFO flwr 2024-07-28 22:04:52,829 | server.py:276 | Requesting initial parameters from one random client INFO flwr 2024-07-28 22:06:17,275 | server.py:280 | Received initial parameters from one random client INFO flwr 2024-07-28 22:06:17,275 | server.py:91 | Evaluating initial parameters INFO flwr 2024-07-28 22:06:17,275 | server.py:104 | FL starting DEBUG flwr 2024-07-28 22:06:17,276 | server.py:222 | fit_round 1: strategy sampled 2 clients (out of 2) DEBUG flwr 2024-07-28 22:07:14,577 | server.py:236 | fit_round 1 received 2 results and 0 failures WARNING flwr 2024-07-28 22:07:15,124 | fedavg.py:242 | No fit_metrics_aggregation_fn provided DEBUG flwr 2024-07-28 22:07:15,125 | server.py:173 | evaluate_round 1: strategy sampled 2 clients (out of 2) DEBUG flwr 2024-07-28 22:08:04,352 | server.py:187 | evaluate_round 1 received 2 results and 0 failures WARNING flwr 2024-07-28 22:08:04,353 | fedavg.py:273 | No evaluate_metrics_aggregation_fn provided DEBUG flwr 2024-07-28 22:08:04,353 | server.py:222 | fit_round 2: strategy sampled 2 clients (out of 2) DEBUG flwr 2024-07-28 22:08:23,236 | server.py:236 | fit_round 2 received 2 results and 0 failures DEBUG flwr 2024-07-28 22:08:23,728 | server.py:173 | evaluate_round 2: strategy sampled 2 clients (out of 2) DEBUG flwr 2024-07-28 22:09:18,902 | server.py:187 | evaluate_round 2 received 2 results and 0 failures DEBUG flwr 2024-07-28 22:09:18,903 | server.py:222 | fit_round 3: strategy sampled 2 clients (out of 2) DEBUG flwr 2024-07-28 22:09:42,883 | server.py:236 | fit_round 3 received 2 results and 0 failures DEBUG flwr 2024-07-28 22:09:43,398 | server.py:173 | evaluate_round 3: strategy sampled 2 clients (out of 2) DEBUG flwr 2024-07-28 22:10:36,522 | server.py:187 | evaluate_round 3 received 2 results and 0 failures INFO flwr 2024-07-28 22:10:36,522 | server.py:153 | FL finished in 259.246545428 INFO flwr 2024-07-28 22:10:36,525 | app.py:225 | app_fit: losses_distributed [(1, 2.302649974822998), (2, 2.302701234817505), (3, 2.3027091026306152)] INFO flwr 2024-07-28 22:10:36,526 | app.py:226 | app_fit: metrics_distributed_fit {} INFO flwr 2024-07-28 22:10:36,526 | app.py:227 | app_fit: metrics_distributed {} INFO flwr 2024-07-28 22:10:36,526 | app.py:228 | app_fit: losses_centralized [] INFO flwr 2024-07-28 22:10:36,527 | app.py:229 | app_fit: metrics_centralized {} I0000 00:00:1722175836.563240 2397 work_stealing_thread_pool.cc:320] WorkStealingThreadPoolImpl::PrepareFork (env) pi@raspberrypi:~/project/flower-main/examples/quickstart-tensorflow $

Raspberry pi Client-1.py log: (env) rb1@raspberrypi:~/project/flower-main/examples/quickstart-tensorflow $ python3 client.py WARNING: All log messages before absl::InitializeLog() is called are written to STDERR I0000 00:00:1722175573.758676 2147 config.cc:230] gRPC experiments enabled: call_status_override_on_cancellation, event_engine_dns, event_engine_listener, http2_stats_fix, monitoring_experiment, pick_first_new, trace_record_callops, work_serializer_clears_time_cache INFO flwr 2024-07-28 22:06:13,831 | grpc.py:49 | Opened insecure gRPC connection (no certificates were passed) DEBUG flwr 2024-07-28 22:06:13,838 | connection.py:42 | ChannelConnectivity.IDLE I0000 00:00:1722175573.846650 2165 work_stealing_thread_pool.cc:320] WorkStealingThreadPoolImpl::PrepareFork DEBUG flwr 2024-07-28 22:06:13,873 | connection.py:42 | ChannelConnectivity.CONNECTING DEBUG flwr 2024-07-28 22:06:14,222 | connection.py:42 | ChannelConnectivity.READY 3/3 [==============================] - 45s 569ms/step - loss: 2.7149 - accuracy: 0.1250 313/313 [==============================] - 38s 113ms/step - loss: 2.3026 - accuracy: 0.1000 3/3 [==============================] - 2s 562ms/step - loss: 2.7303 - accuracy: 0.1146 313/313 [==============================] - 35s 112ms/step - loss: 2.3027 - accuracy: 0.1000 3/3 [==============================] - 2s 560ms/step - loss: 2.9314 - accuracy: 0.1146 313/313 [==============================] - 35s 112ms/step - loss: 2.3027 - accuracy: 0.1000 DEBUG flwr 2024-07-28 22:10:36,556 | connection.py:139 | gRPC channel closed INFO flwr 2024-07-28 22:10:36,558 | app.py:215 | Disconnect and shut down (env) rb1@raspberrypi:~/project/flower-main/examples/quickstart-tensorflow $

Raspberry pi Client-2.py log: (env) rb2@raspberrypi:~/project/flower-main/examples/quickstart-tensorflow $ python3 client.py WARNING: All log messages before absl::InitializeLog() is called are written to STDERR I0000 00:00:1722175575.644622 2121 config.cc:230] gRPC experiments enabled: call_status_override_on_cancellation, event_engine_dns, event_engine_listener, http2_stats_fix, monitoring_experiment, pick_first_new, trace_record_callops, work_serializer_clears_time_cache INFO flwr 2024-07-28 22:06:15,719 | grpc.py:49 | Opened insecure gRPC connection (no certificates were passed) I0000 00:00:1722175575.728106 2140 work_stealing_thread_pool.cc:320] WorkStealingThreadPoolImpl::PrepareFork I0000 00:00:1722175575.728758 2140 fork_posix.cc:77] Other threads are currently calling into gRPC, skipping fork() handlers DEBUG flwr 2024-07-28 22:06:15,747 | connection.py:42 | ChannelConnectivity.IDLE DEBUG flwr 2024-07-28 22:06:15,764 | connection.py:42 | ChannelConnectivity.CONNECTING DEBUG flwr 2024-07-28 22:06:16,143 | connection.py:42 | ChannelConnectivity.READY 3/3 [==============================] - 45s 567ms/step - loss: 2.7447 - accuracy: 0.1458 313/313 [==============================] - 38s 111ms/step - loss: 2.3026 - accuracy: 0.1000 3/3 [==============================] - 2s 561ms/step - loss: 2.8702 - accuracy: 0.0938 313/313 [==============================] - 35s 111ms/step - loss: 2.3027 - accuracy: 0.1000 3/3 [==============================] - 2s 567ms/step - loss: 2.8886 - accuracy: 0.1146 313/313 [==============================] - 35s 112ms/step - loss: 2.3027 - accuracy: 0.1000 DEBUG flwr 2024-07-28 22:10:36,552 | connection.py:139 | gRPC channel closed INFO flwr 2024-07-28 22:10:36,554 | app.py:215 | Disconnect and shut down (env) rb2@raspberrypi:~/project/flower-main/examples/quickstart-tensorflow $

rasb0 commented 3 months ago

Dear Ja,

Sorry, I'm not familiar with python programs and don't know how to modify the example

my question: I have a fruit data set. How do I modify the client.py program to get the picture of the fruit data set?

gubertoli commented 2 months ago

@rasb0 please check if this helps: https://flower.ai/docs/datasets/how-to-use-with-local-data.html