Skip to content

Commit

Permalink
Merge branch 'main' into fds-add-shard-partitioner
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-narozniak authored Jan 16, 2024
2 parents bb90fd9 + 9dd5298 commit 3b1147f
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 1 deletion.
2 changes: 1 addition & 1 deletion datasets/e2e/tensorflow/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "Flower Datasets with TensorFlow"
authors = ["The Flower Authors <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.8"
python = ">=3.8,<3.11"
flwr-datasets = { path = "./../../", extras = ["vision"] }
tensorflow-cpu = "^2.9.1, !=2.11.1"
parameterized = "==0.9.0"
78 changes: 78 additions & 0 deletions src/py/flwr/common/recordset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Copyright 2024 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""RecordSet."""

from dataclasses import dataclass
from typing import Dict


@dataclass
class ParametersRecord:
"""Parameters record."""


@dataclass
class MetricsRecord:
"""Metrics record."""


@dataclass
class ConfigsRecord:
"""Configs record."""


@dataclass
class RecordSet:
"""Definition of RecordSet."""

parameters: Dict[str, ParametersRecord] = {}
metrics: Dict[str, MetricsRecord] = {}
configs: Dict[str, ConfigsRecord] = {}

def set_parameters(self, name: str, record: ParametersRecord) -> None:
"""Add a ParametersRecord."""
self.parameters[name] = record

def get_parameters(self, name: str) -> ParametersRecord:
"""Get a ParametesRecord."""
return self.parameters[name]

def del_parameters(self, name: str) -> None:
"""Delete a ParametersRecord."""
del self.parameters[name]

def set_metrics(self, name: str, record: MetricsRecord) -> None:
"""Add a MetricsRecord."""
self.metrics[name] = record

def get_metrics(self, name: str) -> MetricsRecord:
"""Get a MetricsRecord."""
return self.metrics[name]

def del_metrics(self, name: str) -> None:
"""Delete a MetricsRecord."""
del self.metrics[name]

def set_configs(self, name: str, record: ConfigsRecord) -> None:
"""Add a ConfigsRecord."""
self.configs[name] = record

def get_configs(self, name: str) -> ConfigsRecord:
"""Get a ConfigsRecord."""
return self.configs[name]

def del_configs(self, name: str) -> None:
"""Delete a ConfigsRecord."""
del self.configs[name]

0 comments on commit 3b1147f

Please sign in to comment.