Skip to content

Commit

Permalink
temp commit
Browse files Browse the repository at this point in the history
  • Loading branch information
YuanTingHsieh committed Jan 23, 2024
1 parent d5c7d4e commit e543153
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nvflare/app_common/abstract/params_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@
from abc import ABC, abstractmethod
from typing import Any, List

from nvflare.apis.fl_constant import FLContextKey
from nvflare.apis.dxo import from_shareable
from nvflare.apis.filter import Filter
from nvflare.apis.fl_context import FLContext
from nvflare.apis.shareable import Shareable


class ParamsConverter(Filter, ABC):
class ParamsConverter(ABC):
def __init__(self, supported_tasks: List[str] = None):
self.supported_tasks = supported_tasks

def process(self, task_name: str, shareable: Shareable, fl_ctx: FLContext) -> Shareable:
task_name = fl_ctx.get_prop(FLContextKey.TASK_NAME)
print("\n\n {task_name=} in ParamsConverter \n\n")
if not self.supported_tasks or task_name in self.supported_tasks:
dxo = from_shareable(shareable)
dxo.data = self.convert(dxo.data, fl_ctx)
Expand Down

0 comments on commit e543153

Please sign in to comment.