flwr-nightly 1.17.0.dev20250320__py3-none-any.whl → 1.17.0.dev20250321__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.
Files changed (49) hide show
  1. flwr/cli/run/run.py +5 -9
  2. flwr/client/client_app.py +10 -12
  3. flwr/client/grpc_client/connection.py +3 -3
  4. flwr/client/message_handler/message_handler.py +3 -3
  5. flwr/client/mod/__init__.py +2 -2
  6. flwr/client/mod/comms_mods.py +16 -22
  7. flwr/client/mod/secure_aggregation/secaggplus_mod.py +26 -26
  8. flwr/common/__init__.py +10 -4
  9. flwr/common/config.py +4 -4
  10. flwr/common/constant.py +1 -1
  11. flwr/common/record/__init__.py +6 -3
  12. flwr/common/record/{parametersrecord.py → arrayrecord.py} +74 -31
  13. flwr/common/record/{configsrecord.py → configrecord.py} +73 -27
  14. flwr/common/record/conversion_utils.py +1 -1
  15. flwr/common/record/{metricsrecord.py → metricrecord.py} +77 -31
  16. flwr/common/record/recorddict.py +95 -56
  17. flwr/common/recorddict_compat.py +54 -62
  18. flwr/common/secure_aggregation/secaggplus_constants.py +1 -1
  19. flwr/common/serde.py +42 -43
  20. flwr/common/typing.py +8 -8
  21. flwr/proto/exec_pb2.py +30 -30
  22. flwr/proto/exec_pb2.pyi +2 -2
  23. flwr/proto/recorddict_pb2.py +29 -29
  24. flwr/proto/recorddict_pb2.pyi +33 -33
  25. flwr/proto/run_pb2.py +2 -2
  26. flwr/proto/run_pb2.pyi +2 -2
  27. flwr/server/compat/grid_client_proxy.py +1 -1
  28. flwr/server/superlink/fleet/vce/backend/backend.py +2 -2
  29. flwr/server/superlink/fleet/vce/backend/raybackend.py +2 -2
  30. flwr/server/superlink/linkstate/in_memory_linkstate.py +4 -4
  31. flwr/server/superlink/linkstate/linkstate.py +4 -4
  32. flwr/server/superlink/linkstate/sqlite_linkstate.py +7 -7
  33. flwr/server/superlink/linkstate/utils.py +9 -9
  34. flwr/server/superlink/serverappio/serverappio_servicer.py +2 -2
  35. flwr/server/superlink/simulation/simulationio_servicer.py +2 -2
  36. flwr/server/workflow/default_workflows.py +27 -34
  37. flwr/server/workflow/secure_aggregation/secaggplus_workflow.py +32 -34
  38. flwr/simulation/app.py +2 -2
  39. flwr/simulation/ray_transport/ray_actor.py +4 -2
  40. flwr/simulation/run_simulation.py +2 -2
  41. flwr/superexec/deployment.py +3 -3
  42. flwr/superexec/exec_servicer.py +2 -2
  43. flwr/superexec/executor.py +3 -3
  44. flwr/superexec/simulation.py +2 -2
  45. {flwr_nightly-1.17.0.dev20250320.dist-info → flwr_nightly-1.17.0.dev20250321.dist-info}/METADATA +1 -1
  46. {flwr_nightly-1.17.0.dev20250320.dist-info → flwr_nightly-1.17.0.dev20250321.dist-info}/RECORD +49 -49
  47. {flwr_nightly-1.17.0.dev20250320.dist-info → flwr_nightly-1.17.0.dev20250321.dist-info}/LICENSE +0 -0
  48. {flwr_nightly-1.17.0.dev20250320.dist-info → flwr_nightly-1.17.0.dev20250321.dist-info}/WHEEL +0 -0
  49. {flwr_nightly-1.17.0.dev20250320.dist-info → flwr_nightly-1.17.0.dev20250321.dist-info}/entry_points.txt +0 -0
@@ -22,12 +22,12 @@ from textwrap import indent
22
22
  from typing import TypeVar, Union, cast
23
23
 
24
24
  from ..logger import log
25
- from .configsrecord import ConfigsRecord
26
- from .metricsrecord import MetricsRecord
27
- from .parametersrecord import ParametersRecord
25
+ from .arrayrecord import ArrayRecord
26
+ from .configrecord import ConfigRecord
27
+ from .metricrecord import MetricRecord
28
28
  from .typeddict import TypedDict
29
29
 
30
- RecordType = Union[ParametersRecord, MetricsRecord, ConfigsRecord]
30
+ RecordType = Union[ArrayRecord, MetricRecord, ConfigRecord]
31
31
 
32
32
  T = TypeVar("T")
33
33
 
@@ -41,10 +41,10 @@ def _check_key(key: str) -> None:
41
41
 
42
42
 
43
43
  def _check_value(value: RecordType) -> None:
44
- if not isinstance(value, (ParametersRecord, MetricsRecord, ConfigsRecord)):
44
+ if not isinstance(value, (ArrayRecord, MetricRecord, ConfigRecord)):
45
45
  raise TypeError(
46
- f"Expected `{ParametersRecord.__name__}`, `{MetricsRecord.__name__}`, "
47
- f"or `{ConfigsRecord.__name__}` but received "
46
+ f"Expected `{ArrayRecord.__name__}`, `{MetricRecord.__name__}`, "
47
+ f"or `{ConfigRecord.__name__}` but received "
48
48
  f"`{type(value).__name__}` for the value."
49
49
  )
50
50
 
@@ -58,9 +58,7 @@ class _SyncedDict(TypedDict[str, T]):
58
58
  """
59
59
 
60
60
  def __init__(self, ref_recorddict: RecordDict, allowed_type: type[T]) -> None:
61
- if not issubclass(
62
- allowed_type, (ParametersRecord, MetricsRecord, ConfigsRecord)
63
- ):
61
+ if not issubclass(allowed_type, (ArrayRecord, MetricRecord, ConfigRecord)):
64
62
  raise TypeError(f"{allowed_type} is not a valid type.")
65
63
  super().__init__(_check_key, self.check_value)
66
64
  self.recorddict = ref_recorddict
@@ -84,27 +82,19 @@ class _SyncedDict(TypedDict[str, T]):
84
82
 
85
83
 
86
84
  class RecordDict(TypedDict[str, RecordType]):
87
- """RecordDict stores groups of parameters, metrics and configs.
85
+ """RecordDict stores groups of arrays, metrics and configs.
88
86
 
89
- A :class:`RecordDict` is the unified mechanism by which parameters,
87
+ A :class:`RecordDict` is the unified mechanism by which arrays,
90
88
  metrics and configs can be either stored as part of a :class:`Context`
91
89
  in your apps or communicated as part of a :class:`Message` between
92
90
  your apps.
93
91
 
94
92
  Parameters
95
93
  ----------
96
- parameters_records : Optional[Dict[str, ParametersRecord]]
97
- A dictionary of :code:`ParametersRecords` that can be used to record
98
- and communicate model parameters and high-dimensional arrays.
99
- metrics_records : Optional[Dict[str, MetricsRecord]]
100
- A dictionary of :code:`MetricsRecord` that can be used to record
101
- and communicate scalar-valued metrics that are the result of performing
102
- and action, for example, by a :code:`ClientApp`.
103
- configs_records : Optional[Dict[str, ConfigsRecord]]
104
- A dictionary of :code:`ConfigsRecord` that can be used to record
105
- and communicate configuration values to an entity (e.g. to a
106
- :code:`ClientApp`)
107
- for it to adjust how an action is performed.
94
+ records : Optional[dict[str, RecordType]]
95
+ A dictionary mapping string keys to record instances, where each value
96
+ is either a :class:`ParametersRecord`, :class:`MetricsRecord`,
97
+ or :class:`ConfigsRecord`.
108
98
 
109
99
  Examples
110
100
  --------
@@ -116,43 +106,41 @@ class RecordDict(TypedDict[str, RecordType]):
116
106
  Let's see an example.
117
107
 
118
108
  >>> from flwr.common import RecordDict
119
- >>> from flwr.common import ConfigsRecord, MetricsRecord, ParametersRecord
109
+ >>> from flwr.common import ArrayRecord, ConfigRecord, MetricRecord
120
110
  >>>
121
111
  >>> # Let's begin with an empty record
122
112
  >>> my_records = RecordDict()
123
113
  >>>
124
- >>> # We can create a ConfigsRecord
125
- >>> c_record = ConfigsRecord({"lr": 0.1, "batch-size": 128})
126
- >>> # Adding it to the record_set would look like this
114
+ >>> # We can create a ConfigRecord
115
+ >>> c_record = ConfigRecord({"lr": 0.1, "batch-size": 128})
116
+ >>> # Adding it to the RecordDict would look like this
127
117
  >>> my_records["my_config"] = c_record
128
118
  >>>
129
- >>> # We can create a MetricsRecord following a similar process
130
- >>> m_record = MetricsRecord({"accuracy": 0.93, "losses": [0.23, 0.1]})
131
- >>> # Adding it to the record_set would look like this
119
+ >>> # We can create a MetricRecord following a similar process
120
+ >>> m_record = MetricRecord({"accuracy": 0.93, "losses": [0.23, 0.1]})
121
+ >>> # Adding it to the RecordDict would look like this
132
122
  >>> my_records["my_metrics"] = m_record
133
123
 
134
- Adding a :code:`ParametersRecord` follows the same steps as above but first,
124
+ Adding an :code:`ArrayRecord` follows the same steps as above but first,
135
125
  the array needs to be serialized and represented as a :code:`flwr.common.Array`.
136
- If the array is a :code:`NumPy` array, you can use the built-in utility function
137
- `array_from_numpy <flwr.common.array_from_numpy.html>`_. It is often possible to
138
- convert an array first to :code:`NumPy` and then use the aforementioned function.
126
+ For example:
139
127
 
140
- >>> from flwr.common import array_from_numpy
141
- >>> # Creating a ParametersRecord would look like this
128
+ >>> from flwr.common import Array
129
+ >>> # Creating an ArrayRecord would look like this
142
130
  >>> arr_np = np.random.randn(3, 3)
143
131
  >>>
144
132
  >>> # You can use the built-in tool to serialize the array
145
- >>> arr = array_from_numpy(arr_np)
133
+ >>> arr = Array(arr_np)
146
134
  >>>
147
135
  >>> # Finally, create the record
148
- >>> p_record = ParametersRecord({"my_array": arr})
136
+ >>> arr_record = ArrayRecord({"my_array": arr})
149
137
  >>>
150
- >>> # Adding it to the record_set would look like this
151
- >>> my_records["my_parameters"] = p_record
138
+ >>> # Adding it to the RecordDict would look like this
139
+ >>> my_records["my_parameters"] = arr_record
152
140
 
153
141
  For additional examples on how to construct each of the records types shown
154
- above, please refer to the documentation for :code:`ConfigsRecord`,
155
- :code:`MetricsRecord` and :code:`ParametersRecord`.
142
+ above, please refer to the documentation for :code:`ConfigRecord`,
143
+ :code:`MetricRecord` and :code:`ArrayRecord`.
156
144
  """
157
145
 
158
146
  def __init__(self, records: dict[str, RecordType] | None = None) -> None:
@@ -162,35 +150,35 @@ class RecordDict(TypedDict[str, RecordType]):
162
150
  self[key] = record
163
151
 
164
152
  @property
165
- def parameters_records(self) -> TypedDict[str, ParametersRecord]:
166
- """Dictionary holding only ParametersRecord instances."""
167
- synced_dict = _SyncedDict[ParametersRecord](self, ParametersRecord)
153
+ def array_records(self) -> TypedDict[str, ArrayRecord]:
154
+ """Dictionary holding only ArrayRecord instances."""
155
+ synced_dict = _SyncedDict[ArrayRecord](self, ArrayRecord)
168
156
  for key, record in self.items():
169
- if isinstance(record, ParametersRecord):
157
+ if isinstance(record, ArrayRecord):
170
158
  synced_dict[key] = record
171
159
  return synced_dict
172
160
 
173
161
  @property
174
- def metrics_records(self) -> TypedDict[str, MetricsRecord]:
175
- """Dictionary holding only MetricsRecord instances."""
176
- synced_dict = _SyncedDict[MetricsRecord](self, MetricsRecord)
162
+ def metric_records(self) -> TypedDict[str, MetricRecord]:
163
+ """Dictionary holding only MetricRecord instances."""
164
+ synced_dict = _SyncedDict[MetricRecord](self, MetricRecord)
177
165
  for key, record in self.items():
178
- if isinstance(record, MetricsRecord):
166
+ if isinstance(record, MetricRecord):
179
167
  synced_dict[key] = record
180
168
  return synced_dict
181
169
 
182
170
  @property
183
- def configs_records(self) -> TypedDict[str, ConfigsRecord]:
184
- """Dictionary holding only ConfigsRecord instances."""
185
- synced_dict = _SyncedDict[ConfigsRecord](self, ConfigsRecord)
171
+ def config_records(self) -> TypedDict[str, ConfigRecord]:
172
+ """Dictionary holding only ConfigRecord instances."""
173
+ synced_dict = _SyncedDict[ConfigRecord](self, ConfigRecord)
186
174
  for key, record in self.items():
187
- if isinstance(record, ConfigsRecord):
175
+ if isinstance(record, ConfigRecord):
188
176
  synced_dict[key] = record
189
177
  return synced_dict
190
178
 
191
179
  def __repr__(self) -> str:
192
180
  """Return a string representation of this instance."""
193
- flds = ("parameters_records", "metrics_records", "configs_records")
181
+ flds = ("array_records", "metric_records", "config_records")
194
182
  fld_views = [f"{fld}={dict(getattr(self, fld))!r}" for fld in flds]
195
183
  view = indent(",\n".join(fld_views), " ")
196
184
  return f"{self.__class__.__qualname__}(\n{view}\n)"
@@ -236,6 +224,9 @@ class RecordSet(RecordDict):
236
224
  """
237
225
 
238
226
  _warning_logged = False
227
+ _warning_logged_params = False
228
+ _warning_logged_metrics = False
229
+ _warning_logged_configs = False
239
230
 
240
231
  def __init__(self, records: dict[str, RecordType] | None = None) -> None:
241
232
  if not RecordSet._warning_logged:
@@ -247,3 +238,51 @@ class RecordSet(RecordDict):
247
238
  "Please update your code accordingly.",
248
239
  )
249
240
  super().__init__(records)
241
+
242
+ @property
243
+ def parameters_records(self) -> TypedDict[str, ArrayRecord]:
244
+ """Deprecated property.
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
@@ -19,10 +19,10 @@ from collections import OrderedDict
19
19
  from collections.abc import Mapping
20
20
  from typing import Union, cast, get_args
21
21
 
22
- from . import Array, ConfigsRecord, MetricsRecord, ParametersRecord, RecordDict
22
+ from . import Array, ArrayRecord, ConfigRecord, MetricRecord, RecordDict
23
23
  from .typing import (
24
24
  Code,
25
- ConfigsRecordValues,
25
+ ConfigRecordValues,
26
26
  EvaluateIns,
27
27
  EvaluateRes,
28
28
  FitIns,
@@ -31,7 +31,7 @@ from .typing import (
31
31
  GetParametersRes,
32
32
  GetPropertiesIns,
33
33
  GetPropertiesRes,
34
- MetricsRecordValues,
34
+ MetricRecordValues,
35
35
  Parameters,
36
36
  Scalar,
37
37
  Status,
@@ -40,21 +40,19 @@ from .typing import (
40
40
  EMPTY_TENSOR_KEY = "_empty"
41
41
 
42
42
 
43
- def parametersrecord_to_parameters(
44
- record: ParametersRecord, keep_input: bool
45
- ) -> Parameters:
43
+ def arrayrecord_to_parameters(record: ArrayRecord, keep_input: bool) -> Parameters:
46
44
  """Convert ParameterRecord to legacy Parameters.
47
45
 
48
46
  Warnings
49
47
  --------
50
- Because `Arrays` in `ParametersRecord` encode more information of the
48
+ Because `Array`s in `ArrayRecord` encode more information of the
51
49
  array-like or tensor-like data (e.g their datatype, shape) than `Parameters` it
52
50
  might not be possible to reconstruct such data structures from `Parameters` objects
53
51
  alone. Additional information or metadata must be provided from elsewhere.
54
52
 
55
53
  Parameters
56
54
  ----------
57
- record : ParametersRecord
55
+ record : ArrayRecord
58
56
  The record to be conveted into Parameters.
59
57
  keep_input : bool
60
58
  A boolean indicating whether entries in the record should be deleted from the
@@ -82,19 +80,17 @@ def parametersrecord_to_parameters(
82
80
  return parameters
83
81
 
84
82
 
85
- def parameters_to_parametersrecord(
86
- parameters: Parameters, keep_input: bool
87
- ) -> ParametersRecord:
88
- """Convert legacy Parameters into a single ParametersRecord.
83
+ def parameters_to_arrayrecord(parameters: Parameters, keep_input: bool) -> ArrayRecord:
84
+ """Convert legacy Parameters into a single ArrayRecord.
89
85
 
90
86
  Because there is no concept of names in the legacy Parameters, arbitrary keys will
91
- be used when constructing the ParametersRecord. Similarly, the shape and data type
87
+ be used when constructing the ArrayRecord. Similarly, the shape and data type
92
88
  won't be recorded in the Array objects.
93
89
 
94
90
  Parameters
95
91
  ----------
96
92
  parameters : Parameters
97
- Parameters object to be represented as a ParametersRecord.
93
+ Parameters object to be represented as a ArrayRecord.
98
94
  keep_input : bool
99
95
  A boolean indicating whether parameters should be deleted from the input
100
96
  Parameters object (i.e. a list of serialized NumPy arrays) immediately after
@@ -102,8 +98,8 @@ def parameters_to_parametersrecord(
102
98
 
103
99
  Returns
104
100
  -------
105
- ParametersRecord
106
- The ParametersRecord containing the provided parameters.
101
+ ArrayRecord
102
+ The ArrayRecord containing the provided parameters.
107
103
  """
108
104
  tensor_type = parameters.tensor_type
109
105
 
@@ -122,19 +118,19 @@ def parameters_to_parametersrecord(
122
118
  ordered_dict[EMPTY_TENSOR_KEY] = Array(
123
119
  data=b"", dtype="", stype=tensor_type, shape=[]
124
120
  )
125
- return ParametersRecord(ordered_dict, keep_input=keep_input)
121
+ return ArrayRecord(ordered_dict, keep_input=keep_input)
126
122
 
127
123
 
128
124
  def _check_mapping_from_recordscalartype_to_scalar(
129
- record_data: Mapping[str, Union[ConfigsRecordValues, MetricsRecordValues]]
125
+ record_data: Mapping[str, Union[ConfigRecordValues, MetricRecordValues]]
130
126
  ) -> dict[str, Scalar]:
131
127
  """Check mapping `common.*RecordValues` into `common.Scalar` is possible."""
132
128
  for value in record_data.values():
133
129
  if not isinstance(value, get_args(Scalar)):
134
130
  raise TypeError(
135
131
  "There is not a 1:1 mapping between `common.Scalar` types and those "
136
- "supported in `common.ConfigsRecordValues` or "
137
- "`common.ConfigsRecordValues`. Consider casting your values to a type "
132
+ "supported in `common.ConfigRecordValues` or "
133
+ "`common.ConfigRecordValues`. Consider casting your values to a type "
138
134
  "supported by the `common.RecordDict` infrastructure. "
139
135
  f"You used type: {type(value)}"
140
136
  )
@@ -148,14 +144,12 @@ def _recorddict_to_fit_or_evaluate_ins_components(
148
144
  ) -> tuple[Parameters, dict[str, Scalar]]:
149
145
  """Derive Fit/Evaluate Ins from a RecordDict."""
150
146
  # get Array and construct Parameters
151
- parameters_record = recorddict.parameters_records[f"{ins_str}.parameters"]
147
+ array_record = recorddict.array_records[f"{ins_str}.parameters"]
152
148
 
153
- parameters = parametersrecord_to_parameters(
154
- parameters_record, keep_input=keep_input
155
- )
149
+ parameters = arrayrecord_to_parameters(array_record, keep_input=keep_input)
156
150
 
157
151
  # get config dict
158
- config_record = recorddict.configs_records[f"{ins_str}.config"]
152
+ config_record = recorddict.config_records[f"{ins_str}.config"]
159
153
  # pylint: disable-next=protected-access
160
154
  config_dict = _check_mapping_from_recordscalartype_to_scalar(config_record)
161
155
 
@@ -168,10 +162,10 @@ def _fit_or_evaluate_ins_to_recorddict(
168
162
  recorddict = RecordDict()
169
163
 
170
164
  ins_str = "fitins" if isinstance(ins, FitIns) else "evaluateins"
171
- parametersrecord = parameters_to_parametersrecord(ins.parameters, keep_input)
172
- recorddict.parameters_records[f"{ins_str}.parameters"] = parametersrecord
165
+ arr_record = parameters_to_arrayrecord(ins.parameters, keep_input)
166
+ recorddict.array_records[f"{ins_str}.parameters"] = arr_record
173
167
 
174
- recorddict.configs_records[f"{ins_str}.config"] = ConfigsRecord(
168
+ recorddict.config_records[f"{ins_str}.config"] = ConfigRecord(
175
169
  ins.config # type: ignore
176
170
  )
177
171
 
@@ -181,18 +175,18 @@ def _fit_or_evaluate_ins_to_recorddict(
181
175
  def _embed_status_into_recorddict(
182
176
  res_str: str, status: Status, recorddict: RecordDict
183
177
  ) -> RecordDict:
184
- status_dict: dict[str, ConfigsRecordValues] = {
178
+ status_dict: dict[str, ConfigRecordValues] = {
185
179
  "code": int(status.code.value),
186
180
  "message": status.message,
187
181
  }
188
- # we add it to a `ConfigsRecord`` because the `status.message`` is a string
189
- # and `str` values aren't supported in `MetricsRecords`
190
- recorddict.configs_records[f"{res_str}.status"] = ConfigsRecord(status_dict)
182
+ # we add it to a `ConfigRecord` because the `status.message` is a string
183
+ # and `str` values aren't supported in `MetricRecords`
184
+ recorddict.config_records[f"{res_str}.status"] = ConfigRecord(status_dict)
191
185
  return recorddict
192
186
 
193
187
 
194
188
  def _extract_status_from_recorddict(res_str: str, recorddict: RecordDict) -> Status:
195
- status = recorddict.configs_records[f"{res_str}.status"]
189
+ status = recorddict.config_records[f"{res_str}.status"]
196
190
  code = cast(int, status["code"])
197
191
  return Status(code=Code(code), message=str(status["message"]))
198
192
 
@@ -216,16 +210,16 @@ def fitins_to_recorddict(fitins: FitIns, keep_input: bool) -> RecordDict:
216
210
  def recorddict_to_fitres(recorddict: RecordDict, keep_input: bool) -> FitRes:
217
211
  """Derive FitRes from a RecordDict object."""
218
212
  ins_str = "fitres"
219
- parameters = parametersrecord_to_parameters(
220
- recorddict.parameters_records[f"{ins_str}.parameters"], keep_input=keep_input
213
+ parameters = arrayrecord_to_parameters(
214
+ recorddict.array_records[f"{ins_str}.parameters"], keep_input=keep_input
221
215
  )
222
216
 
223
217
  num_examples = cast(
224
- int, recorddict.metrics_records[f"{ins_str}.num_examples"]["num_examples"]
218
+ int, recorddict.metric_records[f"{ins_str}.num_examples"]["num_examples"]
225
219
  )
226
- configs_record = recorddict.configs_records[f"{ins_str}.metrics"]
220
+ config_record = recorddict.config_records[f"{ins_str}.metrics"]
227
221
  # pylint: disable-next=protected-access
228
- metrics = _check_mapping_from_recordscalartype_to_scalar(configs_record)
222
+ metrics = _check_mapping_from_recordscalartype_to_scalar(config_record)
229
223
  status = _extract_status_from_recorddict(ins_str, recorddict)
230
224
 
231
225
  return FitRes(
@@ -239,17 +233,15 @@ def fitres_to_recorddict(fitres: FitRes, keep_input: bool) -> RecordDict:
239
233
 
240
234
  res_str = "fitres"
241
235
 
242
- recorddict.configs_records[f"{res_str}.metrics"] = ConfigsRecord(
236
+ recorddict.config_records[f"{res_str}.metrics"] = ConfigRecord(
243
237
  fitres.metrics # type: ignore
244
238
  )
245
- recorddict.metrics_records[f"{res_str}.num_examples"] = MetricsRecord(
239
+ recorddict.metric_records[f"{res_str}.num_examples"] = MetricRecord(
246
240
  {"num_examples": fitres.num_examples},
247
241
  )
248
- recorddict.parameters_records[f"{res_str}.parameters"] = (
249
- parameters_to_parametersrecord(
250
- fitres.parameters,
251
- keep_input,
252
- )
242
+ recorddict.array_records[f"{res_str}.parameters"] = parameters_to_arrayrecord(
243
+ fitres.parameters,
244
+ keep_input,
253
245
  )
254
246
 
255
247
  # status
@@ -278,15 +270,15 @@ def recorddict_to_evaluateres(recorddict: RecordDict) -> EvaluateRes:
278
270
  """Derive EvaluateRes from a RecordDict object."""
279
271
  ins_str = "evaluateres"
280
272
 
281
- loss = cast(int, recorddict.metrics_records[f"{ins_str}.loss"]["loss"])
273
+ loss = cast(int, recorddict.metric_records[f"{ins_str}.loss"]["loss"])
282
274
 
283
275
  num_examples = cast(
284
- int, recorddict.metrics_records[f"{ins_str}.num_examples"]["num_examples"]
276
+ int, recorddict.metric_records[f"{ins_str}.num_examples"]["num_examples"]
285
277
  )
286
- configs_record = recorddict.configs_records[f"{ins_str}.metrics"]
278
+ config_record = recorddict.config_records[f"{ins_str}.metrics"]
287
279
 
288
280
  # pylint: disable-next=protected-access
289
- metrics = _check_mapping_from_recordscalartype_to_scalar(configs_record)
281
+ metrics = _check_mapping_from_recordscalartype_to_scalar(config_record)
290
282
  status = _extract_status_from_recorddict(ins_str, recorddict)
291
283
 
292
284
  return EvaluateRes(
@@ -300,17 +292,17 @@ def evaluateres_to_recorddict(evaluateres: EvaluateRes) -> RecordDict:
300
292
 
301
293
  res_str = "evaluateres"
302
294
  # loss
303
- recorddict.metrics_records[f"{res_str}.loss"] = MetricsRecord(
295
+ recorddict.metric_records[f"{res_str}.loss"] = MetricRecord(
304
296
  {"loss": evaluateres.loss},
305
297
  )
306
298
 
307
299
  # num_examples
308
- recorddict.metrics_records[f"{res_str}.num_examples"] = MetricsRecord(
300
+ recorddict.metric_records[f"{res_str}.num_examples"] = MetricRecord(
309
301
  {"num_examples": evaluateres.num_examples},
310
302
  )
311
303
 
312
304
  # metrics
313
- recorddict.configs_records[f"{res_str}.metrics"] = ConfigsRecord(
305
+ recorddict.config_records[f"{res_str}.metrics"] = ConfigRecord(
314
306
  evaluateres.metrics, # type: ignore
315
307
  )
316
308
 
@@ -324,7 +316,7 @@ def evaluateres_to_recorddict(evaluateres: EvaluateRes) -> RecordDict:
324
316
 
325
317
  def recorddict_to_getparametersins(recorddict: RecordDict) -> GetParametersIns:
326
318
  """Derive GetParametersIns from a RecordDict object."""
327
- config_record = recorddict.configs_records["getparametersins.config"]
319
+ config_record = recorddict.config_records["getparametersins.config"]
328
320
  # pylint: disable-next=protected-access
329
321
  config_dict = _check_mapping_from_recordscalartype_to_scalar(config_record)
330
322
 
@@ -335,7 +327,7 @@ def getparametersins_to_recorddict(getparameters_ins: GetParametersIns) -> Recor
335
327
  """Construct a RecordDict from a GetParametersIns object."""
336
328
  recorddict = RecordDict()
337
329
 
338
- recorddict.configs_records["getparametersins.config"] = ConfigsRecord(
330
+ recorddict.config_records["getparametersins.config"] = ConfigRecord(
339
331
  getparameters_ins.config, # type: ignore
340
332
  )
341
333
  return recorddict
@@ -347,10 +339,10 @@ def getparametersres_to_recorddict(
347
339
  """Construct a RecordDict from a GetParametersRes object."""
348
340
  recorddict = RecordDict()
349
341
  res_str = "getparametersres"
350
- parameters_record = parameters_to_parametersrecord(
342
+ array_record = parameters_to_arrayrecord(
351
343
  getparametersres.parameters, keep_input=keep_input
352
344
  )
353
- recorddict.parameters_records[f"{res_str}.parameters"] = parameters_record
345
+ recorddict.array_records[f"{res_str}.parameters"] = array_record
354
346
 
355
347
  # status
356
348
  recorddict = _embed_status_into_recorddict(
@@ -365,8 +357,8 @@ def recorddict_to_getparametersres(
365
357
  ) -> GetParametersRes:
366
358
  """Derive GetParametersRes from a RecordDict object."""
367
359
  res_str = "getparametersres"
368
- parameters = parametersrecord_to_parameters(
369
- recorddict.parameters_records[f"{res_str}.parameters"], keep_input=keep_input
360
+ parameters = arrayrecord_to_parameters(
361
+ recorddict.array_records[f"{res_str}.parameters"], keep_input=keep_input
370
362
  )
371
363
 
372
364
  status = _extract_status_from_recorddict(res_str, recorddict)
@@ -375,7 +367,7 @@ def recorddict_to_getparametersres(
375
367
 
376
368
  def recorddict_to_getpropertiesins(recorddict: RecordDict) -> GetPropertiesIns:
377
369
  """Derive GetPropertiesIns from a RecordDict object."""
378
- config_record = recorddict.configs_records["getpropertiesins.config"]
370
+ config_record = recorddict.config_records["getpropertiesins.config"]
379
371
  # pylint: disable-next=protected-access
380
372
  config_dict = _check_mapping_from_recordscalartype_to_scalar(config_record)
381
373
 
@@ -385,7 +377,7 @@ def recorddict_to_getpropertiesins(recorddict: RecordDict) -> GetPropertiesIns:
385
377
  def getpropertiesins_to_recorddict(getpropertiesins: GetPropertiesIns) -> RecordDict:
386
378
  """Construct a RecordDict from a GetPropertiesRes object."""
387
379
  recorddict = RecordDict()
388
- recorddict.configs_records["getpropertiesins.config"] = ConfigsRecord(
380
+ recorddict.config_records["getpropertiesins.config"] = ConfigRecord(
389
381
  getpropertiesins.config, # type: ignore
390
382
  )
391
383
  return recorddict
@@ -394,7 +386,7 @@ def getpropertiesins_to_recorddict(getpropertiesins: GetPropertiesIns) -> Record
394
386
  def recorddict_to_getpropertiesres(recorddict: RecordDict) -> GetPropertiesRes:
395
387
  """Derive GetPropertiesRes from a RecordDict object."""
396
388
  res_str = "getpropertiesres"
397
- config_record = recorddict.configs_records[f"{res_str}.properties"]
389
+ config_record = recorddict.config_records[f"{res_str}.properties"]
398
390
  # pylint: disable-next=protected-access
399
391
  properties = _check_mapping_from_recordscalartype_to_scalar(config_record)
400
392
 
@@ -407,7 +399,7 @@ def getpropertiesres_to_recorddict(getpropertiesres: GetPropertiesRes) -> Record
407
399
  """Construct a RecordDict from a GetPropertiesRes object."""
408
400
  recorddict = RecordDict()
409
401
  res_str = "getpropertiesres"
410
- recorddict.configs_records[f"{res_str}.properties"] = ConfigsRecord(
402
+ recorddict.config_records[f"{res_str}.properties"] = ConfigRecord(
411
403
  getpropertiesres.properties, # type: ignore
412
404
  )
413
405
  # status
@@ -42,7 +42,7 @@ class Stage:
42
42
 
43
43
 
44
44
  class Key:
45
- """Keys for the configs in the ConfigsRecord."""
45
+ """Keys for the configs in the ConfigRecord."""
46
46
 
47
47
  STAGE = "stage"
48
48
  SAMPLE_NUMBER = "sample_num"