flwr-nightly 1.18.0.dev20250421__py3-none-any.whl → 1.18.0.dev20250422__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flwr/cli/new/templates/app/code/flwr_tune/client_app.py.tpl +4 -4
- flwr/common/message.py +27 -10
- flwr/common/record/recorddict.py +107 -58
- {flwr_nightly-1.18.0.dev20250421.dist-info → flwr_nightly-1.18.0.dev20250422.dist-info}/METADATA +1 -1
- {flwr_nightly-1.18.0.dev20250421.dist-info → flwr_nightly-1.18.0.dev20250422.dist-info}/RECORD +7 -7
- {flwr_nightly-1.18.0.dev20250421.dist-info → flwr_nightly-1.18.0.dev20250422.dist-info}/WHEEL +0 -0
- {flwr_nightly-1.18.0.dev20250421.dist-info → flwr_nightly-1.18.0.dev20250422.dist-info}/entry_points.txt +0 -0
@@ -49,7 +49,7 @@ class FlowerClient(NumPyClient):
|
|
49
49
|
): # pylint: disable=too-many-arguments
|
50
50
|
self.device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
51
51
|
self.train_cfg = train_cfg
|
52
|
-
self.
|
52
|
+
self.training_arguments = TrainingArguments(**train_cfg.training_arguments)
|
53
53
|
self.tokenizer = tokenizer
|
54
54
|
self.formatting_prompts_func = formatting_prompts_func
|
55
55
|
self.data_collator = data_collator
|
@@ -72,14 +72,14 @@ class FlowerClient(NumPyClient):
|
|
72
72
|
self.train_cfg.learning_rate_min,
|
73
73
|
)
|
74
74
|
|
75
|
-
self.
|
76
|
-
self.
|
75
|
+
self.training_arguments.learning_rate = new_lr
|
76
|
+
self.training_arguments.output_dir = config["save_path"]
|
77
77
|
|
78
78
|
# Construct trainer
|
79
79
|
trainer = SFTTrainer(
|
80
80
|
model=self.model,
|
81
81
|
tokenizer=self.tokenizer,
|
82
|
-
args=self.
|
82
|
+
args=self.training_arguments,
|
83
83
|
max_seq_length=self.train_cfg.seq_length,
|
84
84
|
train_dataset=self.trainset,
|
85
85
|
formatting_func=self.formatting_prompts_func,
|
flwr/common/message.py
CHANGED
@@ -36,6 +36,19 @@ MESSAGE_INIT_ERROR_MESSAGE = (
|
|
36
36
|
)
|
37
37
|
|
38
38
|
|
39
|
+
class _WarningTracker:
|
40
|
+
"""A class to track warnings for deprecated properties."""
|
41
|
+
|
42
|
+
def __init__(self) -> None:
|
43
|
+
# These variables are used to ensure that the deprecation warnings
|
44
|
+
# for the deprecated properties/class are logged only once.
|
45
|
+
self.create_error_reply_logged = False
|
46
|
+
self.create_reply_logged = False
|
47
|
+
|
48
|
+
|
49
|
+
_warning_tracker = _WarningTracker()
|
50
|
+
|
51
|
+
|
39
52
|
class MessageInitializationError(TypeError):
|
40
53
|
"""Error raised when initializing a message with invalid arguments."""
|
41
54
|
|
@@ -456,11 +469,13 @@ class Message:
|
|
456
469
|
message : Message
|
457
470
|
A Message containing only the relevant error and metadata.
|
458
471
|
"""
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
472
|
+
if not _warning_tracker.create_error_reply_logged:
|
473
|
+
_warning_tracker.create_error_reply_logged = True
|
474
|
+
warn_deprecated_feature(
|
475
|
+
"`Message.create_error_reply` is deprecated. "
|
476
|
+
"Instead of calling `some_message.create_error_reply(some_error, "
|
477
|
+
"ttl=...)`, use `Message(some_error, reply_to=some_message, ttl=...)`."
|
478
|
+
)
|
464
479
|
if ttl is not None:
|
465
480
|
return Message(error, reply_to=self, ttl=ttl)
|
466
481
|
return Message(error, reply_to=self)
|
@@ -488,11 +503,13 @@ class Message:
|
|
488
503
|
Message
|
489
504
|
A new `Message` instance representing the reply.
|
490
505
|
"""
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
506
|
+
if not _warning_tracker.create_reply_logged:
|
507
|
+
_warning_tracker.create_reply_logged = True
|
508
|
+
warn_deprecated_feature(
|
509
|
+
"`Message.create_reply` is deprecated. "
|
510
|
+
"Instead of calling `some_message.create_reply(some_content, ttl=...)`"
|
511
|
+
", use `Message(some_content, reply_to=some_message, ttl=...)`."
|
512
|
+
)
|
496
513
|
if ttl is not None:
|
497
514
|
return Message(content, reply_to=self, ttl=ttl)
|
498
515
|
return Message(content, reply_to=self)
|
flwr/common/record/recorddict.py
CHANGED
@@ -29,6 +29,22 @@ from .typeddict import TypedDict
|
|
29
29
|
|
30
30
|
RecordType = Union[ArrayRecord, MetricRecord, ConfigRecord]
|
31
31
|
|
32
|
+
|
33
|
+
class _WarningTracker:
|
34
|
+
"""A class to track warnings for deprecated properties."""
|
35
|
+
|
36
|
+
def __init__(self) -> None:
|
37
|
+
# These variables are used to ensure that the deprecation warnings
|
38
|
+
# for the deprecated properties/class are logged only once.
|
39
|
+
self.recordset_init_logged = False
|
40
|
+
self.recorddict_init_logged = False
|
41
|
+
self.parameters_records_logged = False
|
42
|
+
self.metrics_records_logged = False
|
43
|
+
self.configs_records_logged = False
|
44
|
+
|
45
|
+
|
46
|
+
_warning_tracker = _WarningTracker()
|
47
|
+
|
32
48
|
T = TypeVar("T")
|
33
49
|
|
34
50
|
|
@@ -143,8 +159,34 @@ class RecordDict(TypedDict[str, RecordType]):
|
|
143
159
|
:code:`MetricRecord` and :code:`ArrayRecord`.
|
144
160
|
"""
|
145
161
|
|
146
|
-
def __init__(
|
162
|
+
def __init__(
|
163
|
+
self,
|
164
|
+
records: dict[str, RecordType] | None = None,
|
165
|
+
*,
|
166
|
+
parameters_records: dict[str, ArrayRecord] | None = None,
|
167
|
+
metrics_records: dict[str, MetricRecord] | None = None,
|
168
|
+
configs_records: dict[str, ConfigRecord] | None = None,
|
169
|
+
) -> None:
|
147
170
|
super().__init__(_check_key, _check_value)
|
171
|
+
|
172
|
+
# Warning for deprecated usage
|
173
|
+
if (
|
174
|
+
parameters_records is not None
|
175
|
+
or metrics_records is not None
|
176
|
+
or configs_records is not None
|
177
|
+
):
|
178
|
+
log(
|
179
|
+
WARN,
|
180
|
+
"The arguments `parameters_records`, `metrics_records`, and "
|
181
|
+
"`configs_records` of `RecordDict` are deprecated and will "
|
182
|
+
"be removed in a future release. "
|
183
|
+
"Please pass all records using the `records` argument instead.",
|
184
|
+
)
|
185
|
+
records = records or {}
|
186
|
+
records.update(parameters_records or {})
|
187
|
+
records.update(metrics_records or {})
|
188
|
+
records.update(configs_records or {})
|
189
|
+
|
148
190
|
if records is not None:
|
149
191
|
for key, record in records.items():
|
150
192
|
self[key] = record
|
@@ -196,6 +238,54 @@ class RecordDict(TypedDict[str, RecordType]):
|
|
196
238
|
type(value).__name__,
|
197
239
|
)
|
198
240
|
|
241
|
+
@property
|
242
|
+
def parameters_records(self) -> TypedDict[str, ArrayRecord]:
|
243
|
+
"""Deprecated property.
|
244
|
+
|
245
|
+
Use ``array_records`` instead.
|
246
|
+
"""
|
247
|
+
if _warning_tracker.parameters_records_logged:
|
248
|
+
_warning_tracker.parameters_records_logged = True
|
249
|
+
log(
|
250
|
+
WARN,
|
251
|
+
"The `parameters_records` property of `RecordDict` "
|
252
|
+
"(formerly `RecordSet`) is deprecated and will be removed in a "
|
253
|
+
"future release. Please use the `array_records` property instead.",
|
254
|
+
)
|
255
|
+
return self.array_records
|
256
|
+
|
257
|
+
@property
|
258
|
+
def metrics_records(self) -> TypedDict[str, MetricRecord]:
|
259
|
+
"""Deprecated property.
|
260
|
+
|
261
|
+
Use ``metric_records`` instead.
|
262
|
+
"""
|
263
|
+
if not _warning_tracker.metrics_records_logged:
|
264
|
+
_warning_tracker.metrics_records_logged = True
|
265
|
+
log(
|
266
|
+
WARN,
|
267
|
+
"The `metrics_records` property of `RecordDict` "
|
268
|
+
"(formerly `RecordSet`) is deprecated and will be removed in a "
|
269
|
+
"future release. Please use the `metric_records` property instead.",
|
270
|
+
)
|
271
|
+
return self.metric_records
|
272
|
+
|
273
|
+
@property
|
274
|
+
def configs_records(self) -> TypedDict[str, ConfigRecord]:
|
275
|
+
"""Deprecated property.
|
276
|
+
|
277
|
+
Use ``config_records`` instead.
|
278
|
+
"""
|
279
|
+
if not _warning_tracker.configs_records_logged:
|
280
|
+
_warning_tracker.configs_records_logged = True
|
281
|
+
log(
|
282
|
+
WARN,
|
283
|
+
"The `configs_records` property of `RecordDict` "
|
284
|
+
"(formerly `RecordSet`) is deprecated and will be removed in a "
|
285
|
+
"future release. Please use the `config_records` property instead.",
|
286
|
+
)
|
287
|
+
return self.config_records
|
288
|
+
|
199
289
|
|
200
290
|
class RecordSet(RecordDict):
|
201
291
|
"""Deprecated class ``RecordSet``, use ``RecordDict`` instead.
|
@@ -223,66 +313,25 @@ class RecordSet(RecordDict):
|
|
223
313
|
my_content = RecordDict()
|
224
314
|
"""
|
225
315
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
316
|
+
def __init__(
|
317
|
+
self,
|
318
|
+
records: dict[str, RecordType] | None = None,
|
319
|
+
*,
|
320
|
+
parameters_records: dict[str, ArrayRecord] | None = None,
|
321
|
+
metrics_records: dict[str, MetricRecord] | None = None,
|
322
|
+
configs_records: dict[str, ConfigRecord] | None = None,
|
323
|
+
) -> None:
|
324
|
+
if not _warning_tracker.recordset_init_logged:
|
325
|
+
_warning_tracker.recordset_init_logged = True
|
234
326
|
log(
|
235
327
|
WARN,
|
236
328
|
"The `RecordSet` class has been renamed to `RecordDict`. "
|
237
329
|
"Support for `RecordSet` will be removed in a future release. "
|
238
330
|
"Please update your code accordingly.",
|
239
331
|
)
|
240
|
-
super().__init__(
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
Use ``array_records`` instead.
|
247
|
-
"""
|
248
|
-
if not RecordSet._warning_logged_params:
|
249
|
-
RecordSet._warning_logged_params = True
|
250
|
-
log(
|
251
|
-
WARN,
|
252
|
-
"`RecordSet.parameters_records` has been deprecated "
|
253
|
-
"and will be removed in a future release. Please use "
|
254
|
-
"`RecordDict.array_records` instead.",
|
255
|
-
)
|
256
|
-
return self.array_records
|
257
|
-
|
258
|
-
@property
|
259
|
-
def metrics_records(self) -> TypedDict[str, MetricRecord]:
|
260
|
-
"""Deprecated property.
|
261
|
-
|
262
|
-
Use ``metric_records`` instead.
|
263
|
-
"""
|
264
|
-
if not RecordSet._warning_logged_metrics:
|
265
|
-
RecordSet._warning_logged_metrics = True
|
266
|
-
log(
|
267
|
-
WARN,
|
268
|
-
"`RecordSet.metrics_records` has been deprecated "
|
269
|
-
"and will be removed in a future release. Please use "
|
270
|
-
"`RecordDict.metric_records` instead.",
|
271
|
-
)
|
272
|
-
return self.metric_records
|
273
|
-
|
274
|
-
@property
|
275
|
-
def configs_records(self) -> TypedDict[str, ConfigRecord]:
|
276
|
-
"""Deprecated property.
|
277
|
-
|
278
|
-
Use ``config_records`` instead.
|
279
|
-
"""
|
280
|
-
if not RecordSet._warning_logged_configs:
|
281
|
-
RecordSet._warning_logged_configs = True
|
282
|
-
log(
|
283
|
-
WARN,
|
284
|
-
"`RecordSet.configs_records` has been deprecated "
|
285
|
-
"and will be removed in a future release. Please use "
|
286
|
-
"`RecordDict.config_records` instead.",
|
287
|
-
)
|
288
|
-
return self.config_records
|
332
|
+
super().__init__(
|
333
|
+
records,
|
334
|
+
parameters_records=parameters_records,
|
335
|
+
metrics_records=metrics_records,
|
336
|
+
configs_records=configs_records,
|
337
|
+
)
|
{flwr_nightly-1.18.0.dev20250421.dist-info → flwr_nightly-1.18.0.dev20250422.dist-info}/RECORD
RENAMED
@@ -35,7 +35,7 @@ flwr/cli/new/templates/app/code/client.sklearn.py.tpl,sha256=MfhMN-hayGCc3cZ1XpN
|
|
35
35
|
flwr/cli/new/templates/app/code/client.tensorflow.py.tpl,sha256=yBiiU7B9Kf70U52cPkNs_dUpYrrTwbUi2os-PAyheaM,1680
|
36
36
|
flwr/cli/new/templates/app/code/dataset.baseline.py.tpl,sha256=jbd_exHAk2-Blu_kVutjPO6a_dkJQWb232zxSeXIZ1k,1453
|
37
37
|
flwr/cli/new/templates/app/code/flwr_tune/__init__.py,sha256=Xq5fEn5yZkw6HAJi10T_3HRBoqN5_5pNqJHY4wXvD5k,748
|
38
|
-
flwr/cli/new/templates/app/code/flwr_tune/client_app.py.tpl,sha256=
|
38
|
+
flwr/cli/new/templates/app/code/flwr_tune/client_app.py.tpl,sha256=vJ-cbxwaNmDr9eDAVINy_qUJzA2FirSXKsrkUnlFWYU,3759
|
39
39
|
flwr/cli/new/templates/app/code/flwr_tune/dataset.py.tpl,sha256=1NA2Sf-EviNtOaYN4dnFk6v2tcZVsY3-eXY84wOXVng,3059
|
40
40
|
flwr/cli/new/templates/app/code/flwr_tune/models.py.tpl,sha256=ONJw_BgBWEofVNGRDu8KAIThb8saRQlUEK4uS2u_6To,2449
|
41
41
|
flwr/cli/new/templates/app/code/flwr_tune/server_app.py.tpl,sha256=xkmmBKr0oGmewP56SP3s_6FG6JOVlGlquhg3a9nYMis,3270
|
@@ -130,7 +130,7 @@ flwr/common/exit/exit_code.py,sha256=PNEnCrZfOILjfDAFu5m-2YWEJBrk97xglq4zCUlqV7E
|
|
130
130
|
flwr/common/exit_handlers.py,sha256=MEk5_savTLphn-6lW57UQlos-XrFA39XEBn-OF1vXXg,3174
|
131
131
|
flwr/common/grpc.py,sha256=manTaHaPiyYngUq1ErZvvV2B2GxlXUUUGRy3jc3TBIQ,9798
|
132
132
|
flwr/common/logger.py,sha256=JbRf6E2vQxXzpDBq1T8IDUJo_usu3gjWEBPQ6uKcmdg,13049
|
133
|
-
flwr/common/message.py,sha256=
|
133
|
+
flwr/common/message.py,sha256=znr205Erq2hkxwFbvNNCsQTRS2UKv_Qsyu0sFNEhEAw,23721
|
134
134
|
flwr/common/object_ref.py,sha256=p3SfTeqo3Aj16SkB-vsnNn01zswOPdGNBitcbRnqmUk,9134
|
135
135
|
flwr/common/parameter.py,sha256=UVw6sOgehEFhFs4uUCMl2kfVq1PD6ncmWgPLMsZPKPE,2095
|
136
136
|
flwr/common/pyproject.py,sha256=2SU6yJW7059SbMXgzjOdK1GZRWO6AixDH7BmdxbMvHI,1386
|
@@ -139,7 +139,7 @@ flwr/common/record/arrayrecord.py,sha256=zwZudP0POkPK0xy3IxED0lYEjzTXvCEmlF6qISv
|
|
139
139
|
flwr/common/record/configrecord.py,sha256=U9Jsuc5TWxYKaVQvaXiKn2mrqZxeVixsnyRqOnmWsWM,7743
|
140
140
|
flwr/common/record/conversion_utils.py,sha256=aW-DsFzpFTDqdT4AgdDFHM81fNdTGA_KcRL_jlLsePY,1197
|
141
141
|
flwr/common/record/metricrecord.py,sha256=9mMaphD4W5aWL2IYt2DjzWM_uFGCYAcTSzdgWKfLGqs,7008
|
142
|
-
flwr/common/record/recorddict.py,sha256=
|
142
|
+
flwr/common/record/recorddict.py,sha256=zo7TiVZCH_LB9gwUP7-Jo-jLpFLrvxYSryovwZANQiw,12386
|
143
143
|
flwr/common/record/typeddict.py,sha256=dDKgUThs2BscYUNcgP82KP8-qfAYXYftDrf2LszAC_o,3599
|
144
144
|
flwr/common/recorddict_compat.py,sha256=Znn1xRGiqLpPPgviVqyb-GPTM-pCK6tpnEmhWSXafy8,14119
|
145
145
|
flwr/common/retry_invoker.py,sha256=T6puUH3nCxdRzQHeanyr-0nTxhRiS1TH07rmef9vuLQ,14482
|
@@ -326,7 +326,7 @@ flwr/superexec/exec_servicer.py,sha256=Z0YYfs6eNPhqn8rY0x_R04XgR2mKFpggt07IH0EhU
|
|
326
326
|
flwr/superexec/exec_user_auth_interceptor.py,sha256=iqygALkOMBUu_s_R9G0mFThZA7HTUzuXCLgxLCefiwI,4440
|
327
327
|
flwr/superexec/executor.py,sha256=M5ucqSE53jfRtuCNf59WFLqQvA1Mln4741TySeZE7qQ,3112
|
328
328
|
flwr/superexec/simulation.py,sha256=j6YwUvBN7EQ09ID7MYOCVZ70PGbuyBy8f9bXU0EszEM,4088
|
329
|
-
flwr_nightly-1.18.0.
|
330
|
-
flwr_nightly-1.18.0.
|
331
|
-
flwr_nightly-1.18.0.
|
332
|
-
flwr_nightly-1.18.0.
|
329
|
+
flwr_nightly-1.18.0.dev20250422.dist-info/METADATA,sha256=AlGHeBQJQHbe_VwF-65yclEzgFiB2zU4D4kAl_j_qxk,15868
|
330
|
+
flwr_nightly-1.18.0.dev20250422.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
331
|
+
flwr_nightly-1.18.0.dev20250422.dist-info/entry_points.txt,sha256=2-1L-GNKhwGw2_7_RoH55vHw2SIHjdAQy3HAVAWl9PY,374
|
332
|
+
flwr_nightly-1.18.0.dev20250422.dist-info/RECORD,,
|
{flwr_nightly-1.18.0.dev20250421.dist-info → flwr_nightly-1.18.0.dev20250422.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|