flwr-nightly 1.7.0.dev20240122__py3-none-any.whl → 1.7.0.dev20240123__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,401 @@
1
+ # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ # ==============================================================================
15
+ """RecordSet utilities."""
16
+
17
+
18
+ from typing import Dict, Mapping, OrderedDict, Tuple, Union, cast, get_args
19
+
20
+ from .configsrecord import ConfigsRecord
21
+ from .metricsrecord import MetricsRecord
22
+ from .parametersrecord import Array, ParametersRecord
23
+ from .recordset import RecordSet
24
+ from .typing import (
25
+ Code,
26
+ ConfigsRecordValues,
27
+ EvaluateIns,
28
+ EvaluateRes,
29
+ FitIns,
30
+ FitRes,
31
+ GetParametersIns,
32
+ GetParametersRes,
33
+ GetPropertiesIns,
34
+ GetPropertiesRes,
35
+ MetricsRecordValues,
36
+ Parameters,
37
+ Scalar,
38
+ Status,
39
+ )
40
+
41
+
42
+ def parametersrecord_to_parameters(
43
+ record: ParametersRecord, keep_input: bool = False
44
+ ) -> Parameters:
45
+ """Convert ParameterRecord to legacy Parameters.
46
+
47
+ Warning: Because `Arrays` in `ParametersRecord` encode more information of the
48
+ array-like or tensor-like data (e.g their datatype, shape) than `Parameters` it
49
+ might not be possible to reconstruct such data structures from `Parameters` objects
50
+ alone. Additional information or metadta must be provided from elsewhere.
51
+
52
+ Parameters
53
+ ----------
54
+ record : ParametersRecord
55
+ The record to be conveted into Parameters.
56
+ keep_input : bool (default: False)
57
+ A boolean indicating whether entries in the record should be deleted from the
58
+ input dictionary immediately after adding them to the record.
59
+ """
60
+ parameters = Parameters(tensors=[], tensor_type="")
61
+
62
+ for key in list(record.data.keys()):
63
+ parameters.tensors.append(record[key].data)
64
+
65
+ if not parameters.tensor_type:
66
+ # Setting from first array in record. Recall the warning in the docstrings
67
+ # of this function.
68
+ parameters.tensor_type = record[key].stype
69
+
70
+ if not keep_input:
71
+ del record.data[key]
72
+
73
+ return parameters
74
+
75
+
76
+ def parameters_to_parametersrecord(
77
+ parameters: Parameters, keep_input: bool = False
78
+ ) -> ParametersRecord:
79
+ """Convert legacy Parameters into a single ParametersRecord.
80
+
81
+ Because there is no concept of names in the legacy Parameters, arbitrary keys will
82
+ be used when constructing the ParametersRecord. Similarly, the shape and data type
83
+ won't be recorded in the Array objects.
84
+
85
+ Parameters
86
+ ----------
87
+ parameters : Parameters
88
+ Parameters object to be represented as a ParametersRecord.
89
+ keep_input : bool (default: False)
90
+ A boolean indicating whether parameters should be deleted from the input
91
+ Parameters object (i.e. a list of serialized NumPy arrays) immediately after
92
+ adding them to the record.
93
+ """
94
+ tensor_type = parameters.tensor_type
95
+
96
+ p_record = ParametersRecord()
97
+
98
+ num_arrays = len(parameters.tensors)
99
+ for idx in range(num_arrays):
100
+ if keep_input:
101
+ tensor = parameters.tensors[idx]
102
+ else:
103
+ tensor = parameters.tensors.pop(0)
104
+ p_record.set_parameters(
105
+ OrderedDict(
106
+ {str(idx): Array(data=tensor, dtype="", stype=tensor_type, shape=[])}
107
+ )
108
+ )
109
+
110
+ return p_record
111
+
112
+
113
+ def _check_mapping_from_recordscalartype_to_scalar(
114
+ record_data: Mapping[str, Union[ConfigsRecordValues, MetricsRecordValues]]
115
+ ) -> Dict[str, Scalar]:
116
+ """Check mapping `common.*RecordValues` into `common.Scalar` is possible."""
117
+ for value in record_data.values():
118
+ if not isinstance(value, get_args(Scalar)):
119
+ raise TypeError(
120
+ "There is not a 1:1 mapping between `common.Scalar` types and those "
121
+ "supported in `common.ConfigsRecordValues` or "
122
+ "`common.ConfigsRecordValues`. Consider casting your values to a type "
123
+ "supported by the `common.RecordSet` infrastructure. "
124
+ f"You used type: {type(value)}"
125
+ )
126
+ return cast(Dict[str, Scalar], record_data)
127
+
128
+
129
+ def _recordset_to_fit_or_evaluate_ins_components(
130
+ recordset: RecordSet,
131
+ ins_str: str,
132
+ keep_input: bool,
133
+ ) -> Tuple[Parameters, Dict[str, Scalar]]:
134
+ """Derive Fit/Evaluate Ins from a RecordSet."""
135
+ # get Array and construct Parameters
136
+ parameters_record = recordset.get_parameters(f"{ins_str}.parameters")
137
+
138
+ parameters = parametersrecord_to_parameters(
139
+ parameters_record, keep_input=keep_input
140
+ )
141
+
142
+ # get config dict
143
+ config_record = recordset.get_configs(f"{ins_str}.config")
144
+
145
+ config_dict = _check_mapping_from_recordscalartype_to_scalar(config_record.data)
146
+
147
+ return parameters, config_dict
148
+
149
+
150
+ def _fit_or_evaluate_ins_to_recordset(
151
+ ins: Union[FitIns, EvaluateIns], keep_input: bool
152
+ ) -> RecordSet:
153
+ recordset = RecordSet()
154
+
155
+ ins_str = "fitins" if isinstance(ins, FitIns) else "evaluateins"
156
+ recordset.set_parameters(
157
+ name=f"{ins_str}.parameters",
158
+ record=parameters_to_parametersrecord(ins.parameters, keep_input=keep_input),
159
+ )
160
+
161
+ recordset.set_configs(
162
+ name=f"{ins_str}.config", record=ConfigsRecord(ins.config) # type: ignore
163
+ )
164
+
165
+ return recordset
166
+
167
+
168
+ def _embed_status_into_recordset(
169
+ res_str: str, status: Status, recordset: RecordSet
170
+ ) -> RecordSet:
171
+ status_dict: Dict[str, ConfigsRecordValues] = {
172
+ "code": int(status.code.value),
173
+ "message": status.message,
174
+ }
175
+ # we add it to a `ConfigsRecord`` because the `status.message`` is a string
176
+ # and `str` values aren't supported in `MetricsRecords`
177
+ recordset.set_configs(f"{res_str}.status", record=ConfigsRecord(status_dict))
178
+ return recordset
179
+
180
+
181
+ def _extract_status_from_recordset(res_str: str, recordset: RecordSet) -> Status:
182
+ status = recordset.get_configs(f"{res_str}.status")
183
+ code = cast(int, status["code"])
184
+ return Status(code=Code(code), message=str(status["message"]))
185
+
186
+
187
+ def recordset_to_fitins(recordset: RecordSet, keep_input: bool) -> FitIns:
188
+ """Derive FitIns from a RecordSet object."""
189
+ parameters, config = _recordset_to_fit_or_evaluate_ins_components(
190
+ recordset,
191
+ ins_str="fitins",
192
+ keep_input=keep_input,
193
+ )
194
+
195
+ return FitIns(parameters=parameters, config=config)
196
+
197
+
198
+ def fitins_to_recordset(fitins: FitIns, keep_input: bool) -> RecordSet:
199
+ """Construct a RecordSet from a FitIns object."""
200
+ return _fit_or_evaluate_ins_to_recordset(fitins, keep_input)
201
+
202
+
203
+ def recordset_to_fitres(recordset: RecordSet, keep_input: bool) -> FitRes:
204
+ """Derive FitRes from a RecordSet object."""
205
+ ins_str = "fitres"
206
+ parameters = parametersrecord_to_parameters(
207
+ recordset.get_parameters(f"{ins_str}.parameters"), keep_input=keep_input
208
+ )
209
+
210
+ num_examples = cast(
211
+ int, recordset.get_metrics(f"{ins_str}.num_examples")["num_examples"]
212
+ )
213
+ configs_record = recordset.get_configs(f"{ins_str}.metrics")
214
+
215
+ metrics = _check_mapping_from_recordscalartype_to_scalar(configs_record.data)
216
+ status = _extract_status_from_recordset(ins_str, recordset)
217
+
218
+ return FitRes(
219
+ status=status, parameters=parameters, num_examples=num_examples, metrics=metrics
220
+ )
221
+
222
+
223
+ def fitres_to_recordset(fitres: FitRes, keep_input: bool) -> RecordSet:
224
+ """Construct a RecordSet from a FitRes object."""
225
+ recordset = RecordSet()
226
+
227
+ res_str = "fitres"
228
+
229
+ recordset.set_configs(
230
+ name=f"{res_str}.metrics", record=ConfigsRecord(fitres.metrics) # type: ignore
231
+ )
232
+ recordset.set_metrics(
233
+ name=f"{res_str}.num_examples",
234
+ record=MetricsRecord({"num_examples": fitres.num_examples}),
235
+ )
236
+ recordset.set_parameters(
237
+ name=f"{res_str}.parameters",
238
+ record=parameters_to_parametersrecord(fitres.parameters, keep_input),
239
+ )
240
+
241
+ # status
242
+ recordset = _embed_status_into_recordset(res_str, fitres.status, recordset)
243
+
244
+ return recordset
245
+
246
+
247
+ def recordset_to_evaluateins(recordset: RecordSet, keep_input: bool) -> EvaluateIns:
248
+ """Derive EvaluateIns from a RecordSet object."""
249
+ parameters, config = _recordset_to_fit_or_evaluate_ins_components(
250
+ recordset,
251
+ ins_str="evaluateins",
252
+ keep_input=keep_input,
253
+ )
254
+
255
+ return EvaluateIns(parameters=parameters, config=config)
256
+
257
+
258
+ def evaluateins_to_recordset(evaluateins: EvaluateIns, keep_input: bool) -> RecordSet:
259
+ """Construct a RecordSet from a EvaluateIns object."""
260
+ return _fit_or_evaluate_ins_to_recordset(evaluateins, keep_input)
261
+
262
+
263
+ def recordset_to_evaluateres(recordset: RecordSet) -> EvaluateRes:
264
+ """Derive EvaluateRes from a RecordSet object."""
265
+ ins_str = "evaluateres"
266
+
267
+ loss = cast(int, recordset.get_metrics(f"{ins_str}.loss")["loss"])
268
+
269
+ num_examples = cast(
270
+ int, recordset.get_metrics(f"{ins_str}.num_examples")["num_examples"]
271
+ )
272
+ configs_record = recordset.get_configs(f"{ins_str}.metrics")
273
+
274
+ metrics = _check_mapping_from_recordscalartype_to_scalar(configs_record.data)
275
+ status = _extract_status_from_recordset(ins_str, recordset)
276
+
277
+ return EvaluateRes(
278
+ status=status, loss=loss, num_examples=num_examples, metrics=metrics
279
+ )
280
+
281
+
282
+ def evaluateres_to_recordset(evaluateres: EvaluateRes) -> RecordSet:
283
+ """Construct a RecordSet from a EvaluateRes object."""
284
+ recordset = RecordSet()
285
+
286
+ res_str = "evaluateres"
287
+ # loss
288
+ recordset.set_metrics(
289
+ name=f"{res_str}.loss",
290
+ record=MetricsRecord({"loss": evaluateres.loss}),
291
+ )
292
+
293
+ # num_examples
294
+ recordset.set_metrics(
295
+ name=f"{res_str}.num_examples",
296
+ record=MetricsRecord({"num_examples": evaluateres.num_examples}),
297
+ )
298
+
299
+ # metrics
300
+ recordset.set_configs(
301
+ name=f"{res_str}.metrics",
302
+ record=ConfigsRecord(evaluateres.metrics), # type: ignore
303
+ )
304
+
305
+ # status
306
+ recordset = _embed_status_into_recordset(
307
+ f"{res_str}", evaluateres.status, recordset
308
+ )
309
+
310
+ return recordset
311
+
312
+
313
+ def recordset_to_getparametersins(recordset: RecordSet) -> GetParametersIns:
314
+ """Derive GetParametersIns from a RecordSet object."""
315
+ config_record = recordset.get_configs("getparametersins.config")
316
+
317
+ config_dict = _check_mapping_from_recordscalartype_to_scalar(config_record.data)
318
+
319
+ return GetParametersIns(config=config_dict)
320
+
321
+
322
+ def getparametersins_to_recordset(getparameters_ins: GetParametersIns) -> RecordSet:
323
+ """Construct a RecordSet from a GetParametersIns object."""
324
+ recordset = RecordSet()
325
+
326
+ recordset.set_configs(
327
+ name="getparametersins.config",
328
+ record=ConfigsRecord(getparameters_ins.config), # type: ignore
329
+ )
330
+ return recordset
331
+
332
+
333
+ def getparametersres_to_recordset(getparametersres: GetParametersRes) -> RecordSet:
334
+ """Construct a RecordSet from a GetParametersRes object."""
335
+ recordset = RecordSet()
336
+ res_str = "getparametersres"
337
+ parameters_record = parameters_to_parametersrecord(getparametersres.parameters)
338
+ recordset.set_parameters(f"{res_str}.parameters", parameters_record)
339
+
340
+ # status
341
+ recordset = _embed_status_into_recordset(
342
+ res_str, getparametersres.status, recordset
343
+ )
344
+
345
+ return recordset
346
+
347
+
348
+ def recordset_to_getparametersres(recordset: RecordSet) -> GetParametersRes:
349
+ """Derive GetParametersRes from a RecordSet object."""
350
+ res_str = "getparametersres"
351
+ parameters = parametersrecord_to_parameters(
352
+ recordset.get_parameters(f"{res_str}.parameters")
353
+ )
354
+
355
+ status = _extract_status_from_recordset(res_str, recordset)
356
+ return GetParametersRes(status=status, parameters=parameters)
357
+
358
+
359
+ def recordset_to_getpropertiesins(recordset: RecordSet) -> GetPropertiesIns:
360
+ """Derive GetPropertiesIns from a RecordSet object."""
361
+ config_record = recordset.get_configs("getpropertiesins.config")
362
+ config_dict = _check_mapping_from_recordscalartype_to_scalar(config_record.data)
363
+
364
+ return GetPropertiesIns(config=config_dict)
365
+
366
+
367
+ def getpropertiesins_to_recordset(getpropertiesins: GetPropertiesIns) -> RecordSet:
368
+ """Construct a RecordSet from a GetPropertiesRes object."""
369
+ recordset = RecordSet()
370
+ recordset.set_configs(
371
+ name="getpropertiesins.config",
372
+ record=ConfigsRecord(getpropertiesins.config), # type: ignore
373
+ )
374
+ return recordset
375
+
376
+
377
+ def recordset_to_getpropertiesres(recordset: RecordSet) -> GetPropertiesRes:
378
+ """Derive GetPropertiesRes from a RecordSet object."""
379
+ res_str = "getpropertiesres"
380
+ config_record = recordset.get_configs(f"{res_str}.properties")
381
+ properties = _check_mapping_from_recordscalartype_to_scalar(config_record.data)
382
+
383
+ status = _extract_status_from_recordset(res_str, recordset=recordset)
384
+
385
+ return GetPropertiesRes(status=status, properties=properties)
386
+
387
+
388
+ def getpropertiesres_to_recordset(getpropertiesres: GetPropertiesRes) -> RecordSet:
389
+ """Construct a RecordSet from a GetPropertiesRes object."""
390
+ recordset = RecordSet()
391
+ res_str = "getpropertiesres"
392
+ recordset.set_configs(
393
+ name=f"{res_str}.properties",
394
+ record=ConfigsRecord(getpropertiesres.properties), # type: ignore
395
+ )
396
+ # status
397
+ recordset = _embed_status_into_recordset(
398
+ res_str, getpropertiesres.status, recordset
399
+ )
400
+
401
+ return recordset
flwr/common/serde.py CHANGED
@@ -28,6 +28,7 @@ from flwr.proto.recordset_pb2 import DoubleList
28
28
  from flwr.proto.recordset_pb2 import MetricsRecord as ProtoMetricsRecord
29
29
  from flwr.proto.recordset_pb2 import MetricsRecordValue as ProtoMetricsRecordValue
30
30
  from flwr.proto.recordset_pb2 import ParametersRecord as ProtoParametersRecord
31
+ from flwr.proto.recordset_pb2 import RecordSet as ProtoRecordSet
31
32
  from flwr.proto.recordset_pb2 import Sint64List, StringList
32
33
  from flwr.proto.task_pb2 import Value
33
34
  from flwr.proto.transport_pb2 import (
@@ -45,6 +46,7 @@ from . import typing
45
46
  from .configsrecord import ConfigsRecord
46
47
  from .metricsrecord import MetricsRecord
47
48
  from .parametersrecord import Array, ParametersRecord
49
+ from .recordset import RecordSet
48
50
 
49
51
  # === ServerMessage message ===
50
52
 
@@ -719,3 +721,33 @@ def configs_record_from_proto(record_proto: ProtoConfigsRecord) -> ConfigsRecord
719
721
  ),
720
722
  keep_input=False,
721
723
  )
724
+
725
+
726
+ # === RecordSet message ===
727
+
728
+
729
+ def recordset_to_proto(recordset: RecordSet) -> ProtoRecordSet:
730
+ """Serialize RecordSet to ProtoBuf."""
731
+ return ProtoRecordSet(
732
+ parameters={
733
+ k: parameters_record_to_proto(v) for k, v in recordset.parameters.items()
734
+ },
735
+ metrics={k: metrics_record_to_proto(v) for k, v in recordset.metrics.items()},
736
+ configs={k: configs_record_to_proto(v) for k, v in recordset.configs.items()},
737
+ )
738
+
739
+
740
+ def recordset_from_proto(recordset_proto: ProtoRecordSet) -> RecordSet:
741
+ """Deserialize RecordSet from ProtoBuf."""
742
+ return RecordSet(
743
+ parameters={
744
+ k: parameters_record_from_proto(v)
745
+ for k, v in recordset_proto.parameters.items()
746
+ },
747
+ metrics={
748
+ k: metrics_record_from_proto(v) for k, v in recordset_proto.metrics.items()
749
+ },
750
+ configs={
751
+ k: configs_record_from_proto(v) for k, v in recordset_proto.configs.items()
752
+ },
753
+ )
@@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default()
14
14
 
15
15
 
16
16
 
17
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1a\x66lwr/proto/recordset.proto\x12\nflwr.proto\"\x1a\n\nDoubleList\x12\x0c\n\x04vals\x18\x01 \x03(\x01\"\x1a\n\nSint64List\x12\x0c\n\x04vals\x18\x01 \x03(\x12\"\x18\n\x08\x42oolList\x12\x0c\n\x04vals\x18\x01 \x03(\x08\"\x1a\n\nStringList\x12\x0c\n\x04vals\x18\x01 \x03(\t\"\x19\n\tBytesList\x12\x0c\n\x04vals\x18\x01 \x03(\x0c\"B\n\x05\x41rray\x12\r\n\x05\x64type\x18\x01 \x01(\t\x12\r\n\x05shape\x18\x02 \x03(\x05\x12\r\n\x05stype\x18\x03 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\x0c\"\x9f\x01\n\x12MetricsRecordValue\x12\x10\n\x06\x64ouble\x18\x01 \x01(\x01H\x00\x12\x10\n\x06sint64\x18\x02 \x01(\x12H\x00\x12-\n\x0b\x64ouble_list\x18\x15 \x01(\x0b\x32\x16.flwr.proto.DoubleListH\x00\x12-\n\x0bsint64_list\x18\x16 \x01(\x0b\x32\x16.flwr.proto.Sint64ListH\x00\x42\x07\n\x05value\"\xd9\x02\n\x12\x43onfigsRecordValue\x12\x10\n\x06\x64ouble\x18\x01 \x01(\x01H\x00\x12\x10\n\x06sint64\x18\x02 \x01(\x12H\x00\x12\x0e\n\x04\x62ool\x18\x03 \x01(\x08H\x00\x12\x10\n\x06string\x18\x04 \x01(\tH\x00\x12\x0f\n\x05\x62ytes\x18\x05 \x01(\x0cH\x00\x12-\n\x0b\x64ouble_list\x18\x15 \x01(\x0b\x32\x16.flwr.proto.DoubleListH\x00\x12-\n\x0bsint64_list\x18\x16 \x01(\x0b\x32\x16.flwr.proto.Sint64ListH\x00\x12)\n\tbool_list\x18\x17 \x01(\x0b\x32\x14.flwr.proto.BoolListH\x00\x12-\n\x0bstring_list\x18\x18 \x01(\x0b\x32\x16.flwr.proto.StringListH\x00\x12+\n\nbytes_list\x18\x19 \x01(\x0b\x32\x15.flwr.proto.BytesListH\x00\x42\x07\n\x05value\"M\n\x10ParametersRecord\x12\x11\n\tdata_keys\x18\x01 \x03(\t\x12&\n\x0b\x64\x61ta_values\x18\x02 \x03(\x0b\x32\x11.flwr.proto.Array\"\x8f\x01\n\rMetricsRecord\x12\x31\n\x04\x64\x61ta\x18\x01 \x03(\x0b\x32#.flwr.proto.MetricsRecord.DataEntry\x1aK\n\tDataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12-\n\x05value\x18\x02 \x01(\x0b\x32\x1e.flwr.proto.MetricsRecordValue:\x02\x38\x01\"\x8f\x01\n\rConfigsRecord\x12\x31\n\x04\x64\x61ta\x18\x01 \x03(\x0b\x32#.flwr.proto.ConfigsRecord.DataEntry\x1aK\n\tDataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12-\n\x05value\x18\x02 \x01(\x0b\x32\x1e.flwr.proto.ConfigsRecordValue:\x02\x38\x01\x62\x06proto3')
17
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1a\x66lwr/proto/recordset.proto\x12\nflwr.proto\"\x1a\n\nDoubleList\x12\x0c\n\x04vals\x18\x01 \x03(\x01\"\x1a\n\nSint64List\x12\x0c\n\x04vals\x18\x01 \x03(\x12\"\x18\n\x08\x42oolList\x12\x0c\n\x04vals\x18\x01 \x03(\x08\"\x1a\n\nStringList\x12\x0c\n\x04vals\x18\x01 \x03(\t\"\x19\n\tBytesList\x12\x0c\n\x04vals\x18\x01 \x03(\x0c\"B\n\x05\x41rray\x12\r\n\x05\x64type\x18\x01 \x01(\t\x12\r\n\x05shape\x18\x02 \x03(\x05\x12\r\n\x05stype\x18\x03 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x04 \x01(\x0c\"\x9f\x01\n\x12MetricsRecordValue\x12\x10\n\x06\x64ouble\x18\x01 \x01(\x01H\x00\x12\x10\n\x06sint64\x18\x02 \x01(\x12H\x00\x12-\n\x0b\x64ouble_list\x18\x15 \x01(\x0b\x32\x16.flwr.proto.DoubleListH\x00\x12-\n\x0bsint64_list\x18\x16 \x01(\x0b\x32\x16.flwr.proto.Sint64ListH\x00\x42\x07\n\x05value\"\xd9\x02\n\x12\x43onfigsRecordValue\x12\x10\n\x06\x64ouble\x18\x01 \x01(\x01H\x00\x12\x10\n\x06sint64\x18\x02 \x01(\x12H\x00\x12\x0e\n\x04\x62ool\x18\x03 \x01(\x08H\x00\x12\x10\n\x06string\x18\x04 \x01(\tH\x00\x12\x0f\n\x05\x62ytes\x18\x05 \x01(\x0cH\x00\x12-\n\x0b\x64ouble_list\x18\x15 \x01(\x0b\x32\x16.flwr.proto.DoubleListH\x00\x12-\n\x0bsint64_list\x18\x16 \x01(\x0b\x32\x16.flwr.proto.Sint64ListH\x00\x12)\n\tbool_list\x18\x17 \x01(\x0b\x32\x14.flwr.proto.BoolListH\x00\x12-\n\x0bstring_list\x18\x18 \x01(\x0b\x32\x16.flwr.proto.StringListH\x00\x12+\n\nbytes_list\x18\x19 \x01(\x0b\x32\x15.flwr.proto.BytesListH\x00\x42\x07\n\x05value\"M\n\x10ParametersRecord\x12\x11\n\tdata_keys\x18\x01 \x03(\t\x12&\n\x0b\x64\x61ta_values\x18\x02 \x03(\x0b\x32\x11.flwr.proto.Array\"\x8f\x01\n\rMetricsRecord\x12\x31\n\x04\x64\x61ta\x18\x01 \x03(\x0b\x32#.flwr.proto.MetricsRecord.DataEntry\x1aK\n\tDataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12-\n\x05value\x18\x02 \x01(\x0b\x32\x1e.flwr.proto.MetricsRecordValue:\x02\x38\x01\"\x8f\x01\n\rConfigsRecord\x12\x31\n\x04\x64\x61ta\x18\x01 \x03(\x0b\x32#.flwr.proto.ConfigsRecord.DataEntry\x1aK\n\tDataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12-\n\x05value\x18\x02 \x01(\x0b\x32\x1e.flwr.proto.ConfigsRecordValue:\x02\x38\x01\"\x97\x03\n\tRecordSet\x12\x39\n\nparameters\x18\x01 \x03(\x0b\x32%.flwr.proto.RecordSet.ParametersEntry\x12\x33\n\x07metrics\x18\x02 \x03(\x0b\x32\".flwr.proto.RecordSet.MetricsEntry\x12\x33\n\x07\x63onfigs\x18\x03 \x03(\x0b\x32\".flwr.proto.RecordSet.ConfigsEntry\x1aO\n\x0fParametersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12+\n\x05value\x18\x02 \x01(\x0b\x32\x1c.flwr.proto.ParametersRecord:\x02\x38\x01\x1aI\n\x0cMetricsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12(\n\x05value\x18\x02 \x01(\x0b\x32\x19.flwr.proto.MetricsRecord:\x02\x38\x01\x1aI\n\x0c\x43onfigsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12(\n\x05value\x18\x02 \x01(\x0b\x32\x19.flwr.proto.ConfigsRecord:\x02\x38\x01\x62\x06proto3')
18
18
 
19
19
  _globals = globals()
20
20
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -25,6 +25,12 @@ if _descriptor._USE_C_DESCRIPTORS == False:
25
25
  _globals['_METRICSRECORD_DATAENTRY']._serialized_options = b'8\001'
26
26
  _globals['_CONFIGSRECORD_DATAENTRY']._options = None
27
27
  _globals['_CONFIGSRECORD_DATAENTRY']._serialized_options = b'8\001'
28
+ _globals['_RECORDSET_PARAMETERSENTRY']._options = None
29
+ _globals['_RECORDSET_PARAMETERSENTRY']._serialized_options = b'8\001'
30
+ _globals['_RECORDSET_METRICSENTRY']._options = None
31
+ _globals['_RECORDSET_METRICSENTRY']._serialized_options = b'8\001'
32
+ _globals['_RECORDSET_CONFIGSENTRY']._options = None
33
+ _globals['_RECORDSET_CONFIGSENTRY']._serialized_options = b'8\001'
28
34
  _globals['_DOUBLELIST']._serialized_start=42
29
35
  _globals['_DOUBLELIST']._serialized_end=68
30
36
  _globals['_SINT64LIST']._serialized_start=70
@@ -51,4 +57,12 @@ if _descriptor._USE_C_DESCRIPTORS == False:
51
57
  _globals['_CONFIGSRECORD']._serialized_end=1126
52
58
  _globals['_CONFIGSRECORD_DATAENTRY']._serialized_start=1051
53
59
  _globals['_CONFIGSRECORD_DATAENTRY']._serialized_end=1126
60
+ _globals['_RECORDSET']._serialized_start=1129
61
+ _globals['_RECORDSET']._serialized_end=1536
62
+ _globals['_RECORDSET_PARAMETERSENTRY']._serialized_start=1307
63
+ _globals['_RECORDSET_PARAMETERSENTRY']._serialized_end=1386
64
+ _globals['_RECORDSET_METRICSENTRY']._serialized_start=1388
65
+ _globals['_RECORDSET_METRICSENTRY']._serialized_end=1461
66
+ _globals['_RECORDSET_CONFIGSENTRY']._serialized_start=1463
67
+ _globals['_RECORDSET_CONFIGSENTRY']._serialized_end=1536
54
68
  # @@protoc_insertion_point(module_scope)
@@ -238,3 +238,68 @@ class ConfigsRecord(google.protobuf.message.Message):
238
238
  ) -> None: ...
239
239
  def ClearField(self, field_name: typing_extensions.Literal["data",b"data"]) -> None: ...
240
240
  global___ConfigsRecord = ConfigsRecord
241
+
242
+ class RecordSet(google.protobuf.message.Message):
243
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
244
+ class ParametersEntry(google.protobuf.message.Message):
245
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
246
+ KEY_FIELD_NUMBER: builtins.int
247
+ VALUE_FIELD_NUMBER: builtins.int
248
+ key: typing.Text
249
+ @property
250
+ def value(self) -> global___ParametersRecord: ...
251
+ def __init__(self,
252
+ *,
253
+ key: typing.Text = ...,
254
+ value: typing.Optional[global___ParametersRecord] = ...,
255
+ ) -> None: ...
256
+ def HasField(self, field_name: typing_extensions.Literal["value",b"value"]) -> builtins.bool: ...
257
+ def ClearField(self, field_name: typing_extensions.Literal["key",b"key","value",b"value"]) -> None: ...
258
+
259
+ class MetricsEntry(google.protobuf.message.Message):
260
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
261
+ KEY_FIELD_NUMBER: builtins.int
262
+ VALUE_FIELD_NUMBER: builtins.int
263
+ key: typing.Text
264
+ @property
265
+ def value(self) -> global___MetricsRecord: ...
266
+ def __init__(self,
267
+ *,
268
+ key: typing.Text = ...,
269
+ value: typing.Optional[global___MetricsRecord] = ...,
270
+ ) -> None: ...
271
+ def HasField(self, field_name: typing_extensions.Literal["value",b"value"]) -> builtins.bool: ...
272
+ def ClearField(self, field_name: typing_extensions.Literal["key",b"key","value",b"value"]) -> None: ...
273
+
274
+ class ConfigsEntry(google.protobuf.message.Message):
275
+ DESCRIPTOR: google.protobuf.descriptor.Descriptor
276
+ KEY_FIELD_NUMBER: builtins.int
277
+ VALUE_FIELD_NUMBER: builtins.int
278
+ key: typing.Text
279
+ @property
280
+ def value(self) -> global___ConfigsRecord: ...
281
+ def __init__(self,
282
+ *,
283
+ key: typing.Text = ...,
284
+ value: typing.Optional[global___ConfigsRecord] = ...,
285
+ ) -> None: ...
286
+ def HasField(self, field_name: typing_extensions.Literal["value",b"value"]) -> builtins.bool: ...
287
+ def ClearField(self, field_name: typing_extensions.Literal["key",b"key","value",b"value"]) -> None: ...
288
+
289
+ PARAMETERS_FIELD_NUMBER: builtins.int
290
+ METRICS_FIELD_NUMBER: builtins.int
291
+ CONFIGS_FIELD_NUMBER: builtins.int
292
+ @property
293
+ def parameters(self) -> google.protobuf.internal.containers.MessageMap[typing.Text, global___ParametersRecord]: ...
294
+ @property
295
+ def metrics(self) -> google.protobuf.internal.containers.MessageMap[typing.Text, global___MetricsRecord]: ...
296
+ @property
297
+ def configs(self) -> google.protobuf.internal.containers.MessageMap[typing.Text, global___ConfigsRecord]: ...
298
+ def __init__(self,
299
+ *,
300
+ parameters: typing.Optional[typing.Mapping[typing.Text, global___ParametersRecord]] = ...,
301
+ metrics: typing.Optional[typing.Mapping[typing.Text, global___MetricsRecord]] = ...,
302
+ configs: typing.Optional[typing.Mapping[typing.Text, global___ConfigsRecord]] = ...,
303
+ ) -> None: ...
304
+ def ClearField(self, field_name: typing_extensions.Literal["configs",b"configs","metrics",b"metrics","parameters",b"parameters"]) -> None: ...
305
+ global___RecordSet = RecordSet
flwr/proto/task_pb2.py CHANGED
@@ -17,7 +17,7 @@ from flwr.proto import recordset_pb2 as flwr_dot_proto_dot_recordset__pb2
17
17
  from flwr.proto import transport_pb2 as flwr_dot_proto_dot_transport__pb2
18
18
 
19
19
 
20
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15\x66lwr/proto/task.proto\x12\nflwr.proto\x1a\x15\x66lwr/proto/node.proto\x1a\x1a\x66lwr/proto/recordset.proto\x1a\x1a\x66lwr/proto/transport.proto\"\xd1\x02\n\x04Task\x12\"\n\x08producer\x18\x01 \x01(\x0b\x32\x10.flwr.proto.Node\x12\"\n\x08\x63onsumer\x18\x02 \x01(\x0b\x32\x10.flwr.proto.Node\x12\x12\n\ncreated_at\x18\x03 \x01(\t\x12\x14\n\x0c\x64\x65livered_at\x18\x04 \x01(\t\x12\x0b\n\x03ttl\x18\x05 \x01(\t\x12\x10\n\x08\x61ncestry\x18\x06 \x03(\t\x12\x11\n\ttask_type\x18\x07 \x01(\t\x12)\n\x02sa\x18\x08 \x01(\x0b\x32\x1d.flwr.proto.SecureAggregation\x12<\n\x15legacy_server_message\x18\x65 \x01(\x0b\x32\x19.flwr.proto.ServerMessageB\x02\x18\x01\x12<\n\x15legacy_client_message\x18\x66 \x01(\x0b\x32\x19.flwr.proto.ClientMessageB\x02\x18\x01\"\\\n\x07TaskIns\x12\x0f\n\x07task_id\x18\x01 \x01(\t\x12\x10\n\x08group_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\x12\x12\x1e\n\x04task\x18\x04 \x01(\x0b\x32\x10.flwr.proto.Task\"\\\n\x07TaskRes\x12\x0f\n\x07task_id\x18\x01 \x01(\t\x12\x10\n\x08group_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\x12\x12\x1e\n\x04task\x18\x04 \x01(\x0b\x32\x10.flwr.proto.Task\"\xcc\x02\n\x05Value\x12\x10\n\x06\x64ouble\x18\x01 \x01(\x01H\x00\x12\x10\n\x06sint64\x18\x02 \x01(\x12H\x00\x12\x0e\n\x04\x62ool\x18\x03 \x01(\x08H\x00\x12\x10\n\x06string\x18\x04 \x01(\tH\x00\x12\x0f\n\x05\x62ytes\x18\x05 \x01(\x0cH\x00\x12-\n\x0b\x64ouble_list\x18\x15 \x01(\x0b\x32\x16.flwr.proto.DoubleListH\x00\x12-\n\x0bsint64_list\x18\x16 \x01(\x0b\x32\x16.flwr.proto.Sint64ListH\x00\x12)\n\tbool_list\x18\x17 \x01(\x0b\x32\x14.flwr.proto.BoolListH\x00\x12-\n\x0bstring_list\x18\x18 \x01(\x0b\x32\x16.flwr.proto.StringListH\x00\x12+\n\nbytes_list\x18\x19 \x01(\x0b\x32\x15.flwr.proto.BytesListH\x00\x42\x07\n\x05value\"\xa0\x01\n\x11SecureAggregation\x12\x44\n\x0cnamed_values\x18\x01 \x03(\x0b\x32..flwr.proto.SecureAggregation.NamedValuesEntry\x1a\x45\n\x10NamedValuesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12 \n\x05value\x18\x02 \x01(\x0b\x32\x11.flwr.proto.Value:\x02\x38\x01\x62\x06proto3')
20
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15\x66lwr/proto/task.proto\x12\nflwr.proto\x1a\x15\x66lwr/proto/node.proto\x1a\x1a\x66lwr/proto/recordset.proto\x1a\x1a\x66lwr/proto/transport.proto\"\xff\x02\n\x04Task\x12\"\n\x08producer\x18\x01 \x01(\x0b\x32\x10.flwr.proto.Node\x12\"\n\x08\x63onsumer\x18\x02 \x01(\x0b\x32\x10.flwr.proto.Node\x12\x12\n\ncreated_at\x18\x03 \x01(\t\x12\x14\n\x0c\x64\x65livered_at\x18\x04 \x01(\t\x12\x0b\n\x03ttl\x18\x05 \x01(\t\x12\x10\n\x08\x61ncestry\x18\x06 \x03(\t\x12\x11\n\ttask_type\x18\x07 \x01(\t\x12(\n\trecordset\x18\x08 \x01(\x0b\x32\x15.flwr.proto.RecordSet\x12<\n\x15legacy_server_message\x18\x65 \x01(\x0b\x32\x19.flwr.proto.ServerMessageB\x02\x18\x01\x12<\n\x15legacy_client_message\x18\x66 \x01(\x0b\x32\x19.flwr.proto.ClientMessageB\x02\x18\x01\x12-\n\x02sa\x18g \x01(\x0b\x32\x1d.flwr.proto.SecureAggregationB\x02\x18\x01\"\\\n\x07TaskIns\x12\x0f\n\x07task_id\x18\x01 \x01(\t\x12\x10\n\x08group_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\x12\x12\x1e\n\x04task\x18\x04 \x01(\x0b\x32\x10.flwr.proto.Task\"\\\n\x07TaskRes\x12\x0f\n\x07task_id\x18\x01 \x01(\t\x12\x10\n\x08group_id\x18\x02 \x01(\t\x12\x0e\n\x06run_id\x18\x03 \x01(\x12\x12\x1e\n\x04task\x18\x04 \x01(\x0b\x32\x10.flwr.proto.Task\"\xcc\x02\n\x05Value\x12\x10\n\x06\x64ouble\x18\x01 \x01(\x01H\x00\x12\x10\n\x06sint64\x18\x02 \x01(\x12H\x00\x12\x0e\n\x04\x62ool\x18\x03 \x01(\x08H\x00\x12\x10\n\x06string\x18\x04 \x01(\tH\x00\x12\x0f\n\x05\x62ytes\x18\x05 \x01(\x0cH\x00\x12-\n\x0b\x64ouble_list\x18\x15 \x01(\x0b\x32\x16.flwr.proto.DoubleListH\x00\x12-\n\x0bsint64_list\x18\x16 \x01(\x0b\x32\x16.flwr.proto.Sint64ListH\x00\x12)\n\tbool_list\x18\x17 \x01(\x0b\x32\x14.flwr.proto.BoolListH\x00\x12-\n\x0bstring_list\x18\x18 \x01(\x0b\x32\x16.flwr.proto.StringListH\x00\x12+\n\nbytes_list\x18\x19 \x01(\x0b\x32\x15.flwr.proto.BytesListH\x00\x42\x07\n\x05value\"\xa0\x01\n\x11SecureAggregation\x12\x44\n\x0cnamed_values\x18\x01 \x03(\x0b\x32..flwr.proto.SecureAggregation.NamedValuesEntry\x1a\x45\n\x10NamedValuesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12 \n\x05value\x18\x02 \x01(\x0b\x32\x11.flwr.proto.Value:\x02\x38\x01\x62\x06proto3')
21
21
 
22
22
  _globals = globals()
23
23
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -28,18 +28,20 @@ if _descriptor._USE_C_DESCRIPTORS == False:
28
28
  _globals['_TASK'].fields_by_name['legacy_server_message']._serialized_options = b'\030\001'
29
29
  _globals['_TASK'].fields_by_name['legacy_client_message']._options = None
30
30
  _globals['_TASK'].fields_by_name['legacy_client_message']._serialized_options = b'\030\001'
31
+ _globals['_TASK'].fields_by_name['sa']._options = None
32
+ _globals['_TASK'].fields_by_name['sa']._serialized_options = b'\030\001'
31
33
  _globals['_SECUREAGGREGATION_NAMEDVALUESENTRY']._options = None
32
34
  _globals['_SECUREAGGREGATION_NAMEDVALUESENTRY']._serialized_options = b'8\001'
33
35
  _globals['_TASK']._serialized_start=117
34
- _globals['_TASK']._serialized_end=454
35
- _globals['_TASKINS']._serialized_start=456
36
- _globals['_TASKINS']._serialized_end=548
37
- _globals['_TASKRES']._serialized_start=550
38
- _globals['_TASKRES']._serialized_end=642
39
- _globals['_VALUE']._serialized_start=645
40
- _globals['_VALUE']._serialized_end=977
41
- _globals['_SECUREAGGREGATION']._serialized_start=980
42
- _globals['_SECUREAGGREGATION']._serialized_end=1140
43
- _globals['_SECUREAGGREGATION_NAMEDVALUESENTRY']._serialized_start=1071
44
- _globals['_SECUREAGGREGATION_NAMEDVALUESENTRY']._serialized_end=1140
36
+ _globals['_TASK']._serialized_end=500
37
+ _globals['_TASKINS']._serialized_start=502
38
+ _globals['_TASKINS']._serialized_end=594
39
+ _globals['_TASKRES']._serialized_start=596
40
+ _globals['_TASKRES']._serialized_end=688
41
+ _globals['_VALUE']._serialized_start=691
42
+ _globals['_VALUE']._serialized_end=1023
43
+ _globals['_SECUREAGGREGATION']._serialized_start=1026
44
+ _globals['_SECUREAGGREGATION']._serialized_end=1186
45
+ _globals['_SECUREAGGREGATION_NAMEDVALUESENTRY']._serialized_start=1117
46
+ _globals['_SECUREAGGREGATION_NAMEDVALUESENTRY']._serialized_end=1186
45
47
  # @@protoc_insertion_point(module_scope)
flwr/proto/task_pb2.pyi CHANGED
@@ -23,9 +23,10 @@ class Task(google.protobuf.message.Message):
23
23
  TTL_FIELD_NUMBER: builtins.int
24
24
  ANCESTRY_FIELD_NUMBER: builtins.int
25
25
  TASK_TYPE_FIELD_NUMBER: builtins.int
26
- SA_FIELD_NUMBER: builtins.int
26
+ RECORDSET_FIELD_NUMBER: builtins.int
27
27
  LEGACY_SERVER_MESSAGE_FIELD_NUMBER: builtins.int
28
28
  LEGACY_CLIENT_MESSAGE_FIELD_NUMBER: builtins.int
29
+ SA_FIELD_NUMBER: builtins.int
29
30
  @property
30
31
  def producer(self) -> flwr.proto.node_pb2.Node: ...
31
32
  @property
@@ -37,11 +38,13 @@ class Task(google.protobuf.message.Message):
37
38
  def ancestry(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[typing.Text]: ...
38
39
  task_type: typing.Text
39
40
  @property
40
- def sa(self) -> global___SecureAggregation: ...
41
+ def recordset(self) -> flwr.proto.recordset_pb2.RecordSet: ...
41
42
  @property
42
43
  def legacy_server_message(self) -> flwr.proto.transport_pb2.ServerMessage: ...
43
44
  @property
44
45
  def legacy_client_message(self) -> flwr.proto.transport_pb2.ClientMessage: ...
46
+ @property
47
+ def sa(self) -> global___SecureAggregation: ...
45
48
  def __init__(self,
46
49
  *,
47
50
  producer: typing.Optional[flwr.proto.node_pb2.Node] = ...,
@@ -51,12 +54,13 @@ class Task(google.protobuf.message.Message):
51
54
  ttl: typing.Text = ...,
52
55
  ancestry: typing.Optional[typing.Iterable[typing.Text]] = ...,
53
56
  task_type: typing.Text = ...,
54
- sa: typing.Optional[global___SecureAggregation] = ...,
57
+ recordset: typing.Optional[flwr.proto.recordset_pb2.RecordSet] = ...,
55
58
  legacy_server_message: typing.Optional[flwr.proto.transport_pb2.ServerMessage] = ...,
56
59
  legacy_client_message: typing.Optional[flwr.proto.transport_pb2.ClientMessage] = ...,
60
+ sa: typing.Optional[global___SecureAggregation] = ...,
57
61
  ) -> None: ...
58
- def HasField(self, field_name: typing_extensions.Literal["consumer",b"consumer","legacy_client_message",b"legacy_client_message","legacy_server_message",b"legacy_server_message","producer",b"producer","sa",b"sa"]) -> builtins.bool: ...
59
- def ClearField(self, field_name: typing_extensions.Literal["ancestry",b"ancestry","consumer",b"consumer","created_at",b"created_at","delivered_at",b"delivered_at","legacy_client_message",b"legacy_client_message","legacy_server_message",b"legacy_server_message","producer",b"producer","sa",b"sa","task_type",b"task_type","ttl",b"ttl"]) -> None: ...
62
+ def HasField(self, field_name: typing_extensions.Literal["consumer",b"consumer","legacy_client_message",b"legacy_client_message","legacy_server_message",b"legacy_server_message","producer",b"producer","recordset",b"recordset","sa",b"sa"]) -> builtins.bool: ...
63
+ def ClearField(self, field_name: typing_extensions.Literal["ancestry",b"ancestry","consumer",b"consumer","created_at",b"created_at","delivered_at",b"delivered_at","legacy_client_message",b"legacy_client_message","legacy_server_message",b"legacy_server_message","producer",b"producer","recordset",b"recordset","sa",b"sa","task_type",b"task_type","ttl",b"ttl"]) -> None: ...
60
64
  global___Task = Task
61
65
 
62
66
  class TaskIns(google.protobuf.message.Message):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flwr-nightly
3
- Version: 1.7.0.dev20240122
3
+ Version: 1.7.0.dev20240123
4
4
  Summary: Flower: A Friendly Federated Learning Framework
5
5
  Home-page: https://flower.dev
6
6
  License: Apache-2.0
@@ -36,7 +36,7 @@ flwr/common/metricsrecord.py,sha256=n9789VVdjEPX0o7Je_1wRuzs7LkLh5d37QRyN0iVmRY,
36
36
  flwr/common/parameter.py,sha256=-bFAUayToYDF50FZGrBC1hQYJCQDtB2bbr3ZuVLMtdE,2095
37
37
  flwr/common/parametersrecord.py,sha256=v5RmvJI1Y5iJhgIhdatZj7FItRRuaEmTKkCGDRFPQDU,4413
38
38
  flwr/common/recordset.py,sha256=OeRcBMGqx9vutWRz1xkujBPHlVpU58R1EcFRHEQrePo,2351
39
- flwr/common/recordset_utils.py,sha256=FgNuuAgbxtLgjB1vVmcYsTG8kqIW1ZpmYrcUEKAOH_A,3122
39
+ flwr/common/recordset_compat.py,sha256=6j9NWzb_DJ4RApPnsHtKQnB2jKs-ToUjkSVeTxt3XBI,13611
40
40
  flwr/common/retry_invoker.py,sha256=H_hKqKaEI8vZPywWmoAtJYkcUnKhlYc4kV63zRY0kWA,10856
41
41
  flwr/common/secure_aggregation/__init__.py,sha256=29nHIUO2L8-KhNHQ2KmIgRo_4CPkq4LgLCUN0on5FgI,731
42
42
  flwr/common/secure_aggregation/crypto/__init__.py,sha256=dz7pVx2aPrHxr_AwgO5mIiTzu4PcvUxRq9NLBbFcsf8,738
@@ -46,7 +46,7 @@ flwr/common/secure_aggregation/ndarrays_arithmetic.py,sha256=KAHCEHGSTJ6mCgnC8dT
46
46
  flwr/common/secure_aggregation/quantization.py,sha256=appui7GGrkRPsupF59TkapeV4Na_CyPi73JtJ1pimdI,2310
47
47
  flwr/common/secure_aggregation/secaggplus_constants.py,sha256=m5UDo7IgRkMS3yixhzz7DhhAv6VAQMCghglMygSPU_k,1606
48
48
  flwr/common/secure_aggregation/secaggplus_utils.py,sha256=PleDyDu7jHNAfbRoEaoQiOjxG6iMl9yA8rNKYTfnyFw,3155
49
- flwr/common/serde.py,sha256=blyDUBefl5euZmp4f2wxAqacYrByoI_pKbh_neX2UM8,23761
49
+ flwr/common/serde.py,sha256=WGTBE1uj0iUYLMWFAV-798qJq8ThA9TZf6WvNLQAHXc,24844
50
50
  flwr/common/telemetry.py,sha256=se_-pHgEWcmN09ChSpTeek72l1UJHf7GbwXBB1KXBjQ,7683
51
51
  flwr/common/typing.py,sha256=3Wu6Ol1Ja6Gb0WdlcXVEn1EHYJbc4oRRJA81vEegxBo,4382
52
52
  flwr/common/version.py,sha256=A0MKvyKPrV8wLg0YCAODTqM71v26NEH36c6JYtfgg0o,667
@@ -69,12 +69,12 @@ flwr/proto/node_pb2.py,sha256=1zfXEvgGObglIcaVb4SLFmOcHZvA8eHzEtMFM5A6FYY,1081
69
69
  flwr/proto/node_pb2.pyi,sha256=aX3BHhgXvJE1rvcRnEE_gB-5GcaFQ0SJ88yTE223bjI,751
70
70
  flwr/proto/node_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
71
71
  flwr/proto/node_pb2_grpc.pyi,sha256=ff2TSiLVnG6IVQcTGzb2DIH3XRSoAvAo_RMcvbMFyc0,76
72
- flwr/proto/recordset_pb2.py,sha256=78ti7wxqaflp7lQeIwW-O0RmsGd6UFRpKvjoIeTXg-Y,4491
73
- flwr/proto/recordset_pb2.pyi,sha256=Mub8_DeQslNwjsOILOyFfDUwMhtNIU8EhDtGmEpGTCM,10968
72
+ flwr/proto/recordset_pb2.py,sha256=un8L0kvBcgFXQIiQweOseeIJBjlOozUvQY9uTQ42Dqo,6009
73
+ flwr/proto/recordset_pb2.pyi,sha256=NPzCJWAj1xLWzeZ_xZ6uaObQjQfWGnnqlLtn4J-SoFY,14161
74
74
  flwr/proto/recordset_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
75
75
  flwr/proto/recordset_pb2_grpc.pyi,sha256=ff2TSiLVnG6IVQcTGzb2DIH3XRSoAvAo_RMcvbMFyc0,76
76
- flwr/proto/task_pb2.py,sha256=TkL6gHED-DEhpw9DXMTcUcU-Fsf9EFCU_Yfrl9CHg2k,4184
77
- flwr/proto/task_pb2.pyi,sha256=TZXbPoKv04-m4XrA1GG7ho6PdxpP9272ulHAwVnEPtQ,8501
76
+ flwr/proto/task_pb2.py,sha256=oaDHLj9hNK6Ms8xN5cMQUWXppYErhka8b-DWrgsr4xg,4393
77
+ flwr/proto/task_pb2.pyi,sha256=RsKe-sLiAPApxf_byX4C0m5rIOIJlX7Nw6fGFP3MpuE,8751
78
78
  flwr/proto/task_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
79
79
  flwr/proto/task_pb2_grpc.pyi,sha256=ff2TSiLVnG6IVQcTGzb2DIH3XRSoAvAo_RMcvbMFyc0,76
80
80
  flwr/proto/transport_pb2.py,sha256=cURzfpCgZvH7GEvBPLvTYijE3HvhK1MePjINk4xYArk,9781
@@ -141,8 +141,8 @@ flwr/simulation/ray_transport/__init__.py,sha256=FsaAnzC4cw4DqoouBCix6496k29jACk
141
141
  flwr/simulation/ray_transport/ray_actor.py,sha256=S_E-7Bk0ONWx12b0ObP3CtzJSEL3yPxpFVcYfkDx6Es,17044
142
142
  flwr/simulation/ray_transport/ray_client_proxy.py,sha256=RziUVY9PmuI8fJEbra-Vk9oWwRxALDZOeF1fAW-a9wg,9430
143
143
  flwr/simulation/ray_transport/utils.py,sha256=e0mkFOgOXSJHSQdiipoggF-DLBXaJZVytx9auQ35fCg,3368
144
- flwr_nightly-1.7.0.dev20240122.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
145
- flwr_nightly-1.7.0.dev20240122.dist-info/METADATA,sha256=U0h3hcS274tDU7J3mSUOK1E7jlqph7shYe-MT44bv14,13440
146
- flwr_nightly-1.7.0.dev20240122.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
147
- flwr_nightly-1.7.0.dev20240122.dist-info/entry_points.txt,sha256=1uLlD5tIunkzALMfMWnqjdE_D5hRUX_I1iMmOMv6tZI,181
148
- flwr_nightly-1.7.0.dev20240122.dist-info/RECORD,,
144
+ flwr_nightly-1.7.0.dev20240123.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
145
+ flwr_nightly-1.7.0.dev20240123.dist-info/METADATA,sha256=XF_ER6sHNCXFEBtGfpBAVv-UiWDsxDuZUgE5J-Vaado,13440
146
+ flwr_nightly-1.7.0.dev20240123.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
147
+ flwr_nightly-1.7.0.dev20240123.dist-info/entry_points.txt,sha256=1uLlD5tIunkzALMfMWnqjdE_D5hRUX_I1iMmOMv6tZI,181
148
+ flwr_nightly-1.7.0.dev20240123.dist-info/RECORD,,
@@ -1,87 +0,0 @@
1
- # Copyright 2024 Flower Labs GmbH. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- # ==============================================================================
15
- """RecordSet utilities."""
16
-
17
-
18
- from typing import OrderedDict
19
-
20
- from .parametersrecord import Array, ParametersRecord
21
- from .typing import Parameters
22
-
23
-
24
- def parametersrecord_to_parameters(
25
- record: ParametersRecord, keep_input: bool = False
26
- ) -> Parameters:
27
- """Convert ParameterRecord to legacy Parameters.
28
-
29
- Warning: Because `Arrays` in `ParametersRecord` encode more information of the
30
- array-like or tensor-like data (e.g their datatype, shape) than `Parameters` it
31
- might not be possible to reconstruct such data structures from `Parameters` objects
32
- alone. Additional information or metadta must be provided from elsewhere.
33
-
34
- Parameters
35
- ----------
36
- record : ParametersRecord
37
- The record to be conveted into Parameters.
38
- keep_input : bool (default: False)
39
- A boolean indicating whether entries in the record should be deleted from the
40
- input dictionary immediately after adding them to the record.
41
- """
42
- parameters = Parameters(tensors=[], tensor_type="")
43
-
44
- for key in list(record.data.keys()):
45
- parameters.tensors.append(record.data[key].data)
46
-
47
- if not keep_input:
48
- del record.data[key]
49
-
50
- return parameters
51
-
52
-
53
- def parameters_to_parametersrecord(
54
- parameters: Parameters, keep_input: bool = False
55
- ) -> ParametersRecord:
56
- """Convert legacy Parameters into a single ParametersRecord.
57
-
58
- Because there is no concept of names in the legacy Parameters, arbitrary keys will
59
- be used when constructing the ParametersRecord. Similarly, the shape and data type
60
- won't be recorded in the Array objects.
61
-
62
- Parameters
63
- ----------
64
- parameters : Parameters
65
- Parameters object to be represented as a ParametersRecord.
66
- keep_input : bool (default: False)
67
- A boolean indicating whether parameters should be deleted from the input
68
- Parameters object (i.e. a list of serialized NumPy arrays) immediately after
69
- adding them to the record.
70
- """
71
- tensor_type = parameters.tensor_type
72
-
73
- p_record = ParametersRecord()
74
-
75
- num_arrays = len(parameters.tensors)
76
- for idx in range(num_arrays):
77
- if keep_input:
78
- tensor = parameters.tensors[idx]
79
- else:
80
- tensor = parameters.tensors.pop(0)
81
- p_record.set_parameters(
82
- OrderedDict(
83
- {str(idx): Array(data=tensor, dtype="", stype=tensor_type, shape=[])}
84
- )
85
- )
86
-
87
- return p_record