flwr-nightly 1.19.0.dev20250515__py3-none-any.whl → 1.19.0.dev20250516__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/common/constant.py +1 -1
- flwr/common/inflatable.py +41 -12
- flwr/common/record/array.py +1 -1
- flwr/common/record/arrayrecord.py +1 -1
- flwr/common/record/configrecord.py +1 -1
- flwr/common/record/metricrecord.py +1 -1
- flwr/common/record/recorddict.py +1 -1
- {flwr_nightly-1.19.0.dev20250515.dist-info → flwr_nightly-1.19.0.dev20250516.dist-info}/METADATA +1 -1
- {flwr_nightly-1.19.0.dev20250515.dist-info → flwr_nightly-1.19.0.dev20250516.dist-info}/RECORD +11 -11
- {flwr_nightly-1.19.0.dev20250515.dist-info → flwr_nightly-1.19.0.dev20250516.dist-info}/WHEEL +0 -0
- {flwr_nightly-1.19.0.dev20250515.dist-info → flwr_nightly-1.19.0.dev20250516.dist-info}/entry_points.txt +0 -0
flwr/common/constant.py
CHANGED
@@ -130,7 +130,7 @@ GC_THRESHOLD = 200_000_000 # 200 MB
|
|
130
130
|
|
131
131
|
# Constants for Inflatable
|
132
132
|
HEAD_BODY_DIVIDER = b"\x00"
|
133
|
-
|
133
|
+
HEAD_VALUE_DIVIDER = " "
|
134
134
|
|
135
135
|
# Constants for serialization
|
136
136
|
INT64_MAX_VALUE = 9223372036854775807 # (1 << 63) - 1
|
flwr/common/inflatable.py
CHANGED
@@ -20,9 +20,7 @@ from __future__ import annotations
|
|
20
20
|
import hashlib
|
21
21
|
from typing import TypeVar
|
22
22
|
|
23
|
-
from .constant import HEAD_BODY_DIVIDER,
|
24
|
-
|
25
|
-
T = TypeVar("T", bound="InflatableObject")
|
23
|
+
from .constant import HEAD_BODY_DIVIDER, HEAD_VALUE_DIVIDER
|
26
24
|
|
27
25
|
|
28
26
|
class InflatableObject:
|
@@ -65,6 +63,9 @@ class InflatableObject:
|
|
65
63
|
return None
|
66
64
|
|
67
65
|
|
66
|
+
T = TypeVar("T", bound=InflatableObject)
|
67
|
+
|
68
|
+
|
68
69
|
def get_object_id(object_content: bytes) -> str:
|
69
70
|
"""Return a SHA-256 hash of the (deflated) object content."""
|
70
71
|
return hashlib.sha256(object_content).hexdigest()
|
@@ -84,13 +85,21 @@ def get_object_body(object_content: bytes, cls: type[T]) -> bytes:
|
|
84
85
|
return _get_object_body(object_content)
|
85
86
|
|
86
87
|
|
87
|
-
def add_header_to_object_body(object_body: bytes,
|
88
|
+
def add_header_to_object_body(object_body: bytes, obj: InflatableObject) -> bytes:
|
88
89
|
"""Add header to object content."""
|
89
90
|
# Construct header
|
90
|
-
header = f"{
|
91
|
-
|
91
|
+
header = f"%s{HEAD_VALUE_DIVIDER}%s{HEAD_VALUE_DIVIDER}%d" % (
|
92
|
+
obj.__class__.__qualname__, # Type of object
|
93
|
+
",".join((obj.children or {}).keys()), # IDs of child objects
|
94
|
+
len(object_body), # Length of object body
|
95
|
+
)
|
96
|
+
|
92
97
|
# Concatenate header and object body
|
93
|
-
|
98
|
+
ret = bytearray()
|
99
|
+
ret.extend(header.encode(encoding="utf-8"))
|
100
|
+
ret.extend(HEAD_BODY_DIVIDER)
|
101
|
+
ret.extend(object_body)
|
102
|
+
return bytes(ret)
|
94
103
|
|
95
104
|
|
96
105
|
def _get_object_head(object_content: bytes) -> bytes:
|
@@ -108,9 +117,14 @@ def get_object_type_from_object_content(object_content: bytes) -> str:
|
|
108
117
|
return get_object_head_values_from_object_content(object_content)[0]
|
109
118
|
|
110
119
|
|
120
|
+
def get_object_children_ids_from_object_content(object_content: bytes) -> list[str]:
|
121
|
+
"""Return object children IDs from bytes."""
|
122
|
+
return get_object_head_values_from_object_content(object_content)[1]
|
123
|
+
|
124
|
+
|
111
125
|
def get_object_body_len_from_object_content(object_content: bytes) -> int:
|
112
126
|
"""Return length of the object body."""
|
113
|
-
return get_object_head_values_from_object_content(object_content)[
|
127
|
+
return get_object_head_values_from_object_content(object_content)[2]
|
114
128
|
|
115
129
|
|
116
130
|
def check_body_len_consistency(object_content: bytes) -> bool:
|
@@ -121,8 +135,23 @@ def check_body_len_consistency(object_content: bytes) -> bool:
|
|
121
135
|
|
122
136
|
def get_object_head_values_from_object_content(
|
123
137
|
object_content: bytes,
|
124
|
-
) -> tuple[str, int]:
|
125
|
-
"""Return object type and body length from object content.
|
138
|
+
) -> tuple[str, list[str], int]:
|
139
|
+
"""Return object type and body length from object content.
|
140
|
+
|
141
|
+
Parameters
|
142
|
+
----------
|
143
|
+
object_content : bytes
|
144
|
+
The deflated object content.
|
145
|
+
|
146
|
+
Returns
|
147
|
+
-------
|
148
|
+
tuple[str, list[str], int]
|
149
|
+
A tuple containing:
|
150
|
+
- The object type as a string.
|
151
|
+
- A list of child object IDs as strings.
|
152
|
+
- The length of the object body as an integer.
|
153
|
+
"""
|
126
154
|
head = _get_object_head(object_content).decode(encoding="utf-8")
|
127
|
-
obj_type, body_len = head.split(
|
128
|
-
|
155
|
+
obj_type, children_str, body_len = head.split(HEAD_VALUE_DIVIDER)
|
156
|
+
children_ids = children_str.split(",") if children_str else []
|
157
|
+
return obj_type, children_ids, int(body_len)
|
flwr/common/record/array.py
CHANGED
@@ -262,7 +262,7 @@ class Array(InflatableObject):
|
|
262
262
|
)
|
263
263
|
|
264
264
|
obj_body = array_proto.SerializeToString(deterministic=True)
|
265
|
-
return add_header_to_object_body(object_body=obj_body,
|
265
|
+
return add_header_to_object_body(object_body=obj_body, obj=self)
|
266
266
|
|
267
267
|
@classmethod
|
268
268
|
def inflate(
|
@@ -382,7 +382,7 @@ class ArrayRecord(TypedDict[str, Array], InflatableObject):
|
|
382
382
|
|
383
383
|
# Serialize references dict
|
384
384
|
object_body = json.dumps(array_refs).encode("utf-8")
|
385
|
-
return add_header_to_object_body(object_body=object_body,
|
385
|
+
return add_header_to_object_body(object_body=object_body, obj=self)
|
386
386
|
|
387
387
|
@classmethod
|
388
388
|
def inflate(
|
@@ -182,7 +182,7 @@ class ConfigRecord(TypedDict[str, ConfigRecordValues], InflatableObject):
|
|
182
182
|
ProtoConfigRecordValue,
|
183
183
|
)
|
184
184
|
).SerializeToString(deterministic=True)
|
185
|
-
return add_header_to_object_body(object_body=obj_body,
|
185
|
+
return add_header_to_object_body(object_body=obj_body, obj=self)
|
186
186
|
|
187
187
|
@classmethod
|
188
188
|
def inflate(
|
@@ -157,7 +157,7 @@ class MetricRecord(TypedDict[str, MetricRecordValues], InflatableObject):
|
|
157
157
|
obj_body = ProtoMetricRecord(
|
158
158
|
data=record_value_dict_to_proto(self, [float, int], ProtoMetricRecordValue)
|
159
159
|
).SerializeToString(deterministic=True)
|
160
|
-
return add_header_to_object_body(object_body=obj_body,
|
160
|
+
return add_header_to_object_body(object_body=obj_body, obj=self)
|
161
161
|
|
162
162
|
@classmethod
|
163
163
|
def inflate(
|
flwr/common/record/recorddict.py
CHANGED
@@ -303,7 +303,7 @@ class RecordDict(TypedDict[str, RecordType], InflatableObject):
|
|
303
303
|
|
304
304
|
# Serialize references dict
|
305
305
|
object_body = json.dumps(record_refs).encode("utf-8")
|
306
|
-
return add_header_to_object_body(object_body=object_body,
|
306
|
+
return add_header_to_object_body(object_body=object_body, obj=self)
|
307
307
|
|
308
308
|
@classmethod
|
309
309
|
def inflate(
|
{flwr_nightly-1.19.0.dev20250515.dist-info → flwr_nightly-1.19.0.dev20250516.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: flwr-nightly
|
3
|
-
Version: 1.19.0.
|
3
|
+
Version: 1.19.0.dev20250516
|
4
4
|
Summary: Flower: A Friendly Federated AI Framework
|
5
5
|
License: Apache-2.0
|
6
6
|
Keywords: Artificial Intelligence,Federated AI,Federated Analytics,Federated Evaluation,Federated Learning,Flower,Machine Learning
|
{flwr_nightly-1.19.0.dev20250515.dist-info → flwr_nightly-1.19.0.dev20250516.dist-info}/RECORD
RENAMED
@@ -115,7 +115,7 @@ flwr/common/args.py,sha256=-aX_jVnSaDrJR2KZ8Wq0Y3dQHII4R4MJtJOIXzVUA0c,5417
|
|
115
115
|
flwr/common/auth_plugin/__init__.py,sha256=m271m9YjK2QfKDOuIIhcTvGmv1GWh1PL97QB05NTSHs,887
|
116
116
|
flwr/common/auth_plugin/auth_plugin.py,sha256=GaXw4IiU2DkVNkp5S9ue821sbkU9zWSu6HSVZetEdjs,3938
|
117
117
|
flwr/common/config.py,sha256=glcZDjco-amw1YfQcYTFJ4S1pt9APoexT-mf1QscuHs,13960
|
118
|
-
flwr/common/constant.py,sha256=
|
118
|
+
flwr/common/constant.py,sha256=FeS_KqX2T3GtzMjR_lm1R1FcV9q0SIUvzdexzcq_bjs,7372
|
119
119
|
flwr/common/context.py,sha256=Be8obQR_OvEDy1OmshuUKxGRQ7Qx89mf5F4xlhkR10s,2407
|
120
120
|
flwr/common/date.py,sha256=1ZT2cRSpC2DJqprOVTLXYCR_O2_OZR0zXO_brJ3LqWc,1554
|
121
121
|
flwr/common/differential_privacy.py,sha256=FdlpdpPl_H_2HJa8CQM1iCUGBBQ5Dc8CzxmHERM-EoE,6148
|
@@ -129,19 +129,19 @@ flwr/common/exit/exit_code.py,sha256=PNEnCrZfOILjfDAFu5m-2YWEJBrk97xglq4zCUlqV7E
|
|
129
129
|
flwr/common/exit_handlers.py,sha256=MEk5_savTLphn-6lW57UQlos-XrFA39XEBn-OF1vXXg,3174
|
130
130
|
flwr/common/grpc.py,sha256=manTaHaPiyYngUq1ErZvvV2B2GxlXUUUGRy3jc3TBIQ,9798
|
131
131
|
flwr/common/heartbeat.py,sha256=SyEpNDnmJ0lni0cWO67rcoJVKasCLmkNHm3dKLeNrLU,5749
|
132
|
-
flwr/common/inflatable.py,sha256=
|
132
|
+
flwr/common/inflatable.py,sha256=ZKW4L2GMAxInUlbNK_zDZs7uW4-CuQui9TnWVglpDic,5279
|
133
133
|
flwr/common/logger.py,sha256=JbRf6E2vQxXzpDBq1T8IDUJo_usu3gjWEBPQ6uKcmdg,13049
|
134
134
|
flwr/common/message.py,sha256=znr205Erq2hkxwFbvNNCsQTRS2UKv_Qsyu0sFNEhEAw,23721
|
135
135
|
flwr/common/object_ref.py,sha256=p3SfTeqo3Aj16SkB-vsnNn01zswOPdGNBitcbRnqmUk,9134
|
136
136
|
flwr/common/parameter.py,sha256=UVw6sOgehEFhFs4uUCMl2kfVq1PD6ncmWgPLMsZPKPE,2095
|
137
137
|
flwr/common/pyproject.py,sha256=2SU6yJW7059SbMXgzjOdK1GZRWO6AixDH7BmdxbMvHI,1386
|
138
138
|
flwr/common/record/__init__.py,sha256=cNGccdDoxttqgnUgyKRIqLWULjW-NaSmOufVxtXq-sw,1197
|
139
|
-
flwr/common/record/array.py,sha256=
|
140
|
-
flwr/common/record/arrayrecord.py,sha256
|
141
|
-
flwr/common/record/configrecord.py,sha256=
|
139
|
+
flwr/common/record/array.py,sha256=bomTFJViJjeQ649Fo9CREEJdSrqiYLDYRFWogpiBKCs,10850
|
140
|
+
flwr/common/record/arrayrecord.py,sha256=1DII6iloauHvBaWPzYtgaVAT9plNRBaaInGA6p8-j20,16787
|
141
|
+
flwr/common/record/configrecord.py,sha256=SYpGR89JSDWTjdGT3jemuUW-EHATrkSDmPSgqzZ_H1M,9664
|
142
142
|
flwr/common/record/conversion_utils.py,sha256=wbNCzy7oAqaA3-arhls_EqRZYXRC4YrWIoE-Gy82fJ0,1191
|
143
|
-
flwr/common/record/metricrecord.py,sha256=
|
144
|
-
flwr/common/record/recorddict.py,sha256=
|
143
|
+
flwr/common/record/metricrecord.py,sha256=Gxl9TdVpMAHg6pNN2SxB-as8iPDnPx398KEhORU4n3A,8839
|
144
|
+
flwr/common/record/recorddict.py,sha256=p7hBimFpKM1XKUe6OAkR_7pYGzGL_EwUJUvJ8odZEcY,14986
|
145
145
|
flwr/common/record/typeddict.py,sha256=dDKgUThs2BscYUNcgP82KP8-qfAYXYftDrf2LszAC_o,3599
|
146
146
|
flwr/common/recorddict_compat.py,sha256=Znn1xRGiqLpPPgviVqyb-GPTM-pCK6tpnEmhWSXafy8,14119
|
147
147
|
flwr/common/retry_invoker.py,sha256=T6puUH3nCxdRzQHeanyr-0nTxhRiS1TH07rmef9vuLQ,14482
|
@@ -333,7 +333,7 @@ flwr/superexec/exec_servicer.py,sha256=Z0YYfs6eNPhqn8rY0x_R04XgR2mKFpggt07IH0EhU
|
|
333
333
|
flwr/superexec/exec_user_auth_interceptor.py,sha256=iqygALkOMBUu_s_R9G0mFThZA7HTUzuXCLgxLCefiwI,4440
|
334
334
|
flwr/superexec/executor.py,sha256=M5ucqSE53jfRtuCNf59WFLqQvA1Mln4741TySeZE7qQ,3112
|
335
335
|
flwr/superexec/simulation.py,sha256=j6YwUvBN7EQ09ID7MYOCVZ70PGbuyBy8f9bXU0EszEM,4088
|
336
|
-
flwr_nightly-1.19.0.
|
337
|
-
flwr_nightly-1.19.0.
|
338
|
-
flwr_nightly-1.19.0.
|
339
|
-
flwr_nightly-1.19.0.
|
336
|
+
flwr_nightly-1.19.0.dev20250516.dist-info/METADATA,sha256=UonPzdp9wmMEFyT7_6JpqX1De35aXAtDj1cUVzzcNkg,15910
|
337
|
+
flwr_nightly-1.19.0.dev20250516.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
338
|
+
flwr_nightly-1.19.0.dev20250516.dist-info/entry_points.txt,sha256=2-1L-GNKhwGw2_7_RoH55vHw2SIHjdAQy3HAVAWl9PY,374
|
339
|
+
flwr_nightly-1.19.0.dev20250516.dist-info/RECORD,,
|
{flwr_nightly-1.19.0.dev20250515.dist-info → flwr_nightly-1.19.0.dev20250516.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|