def __init__( self, input_key: str = "features", target_key: str = "target", loss_key: str = "loss", augemention_prefix: str = "augment", projection_prefix: str = "projection", embedding_prefix: str = "embedding", ): """Init.""" IRunner.__init__(self) self._target_key = target_key self._loss_key = loss_key self._projection_prefix = projection_prefix self._augemention_prefix = augemention_prefix self._embedding_prefix = embedding_prefix self._input_key = input_key
def __init__( self, input_key: Any = "features", output_key: Any = "logits", target_key: str = "targets", loss_key: str = "loss", ): """Init.""" IRunner.__init__(self) self._input_key = input_key self._output_key = output_key self._target_key = target_key self._loss_key = loss_key if isinstance(self._input_key, str): # when model expects value self._process_input = self._process_input_str elif isinstance(self._input_key, (list, tuple)): # when model expects tuple self._process_input = self._process_input_list elif self._input_key is None: # when model expects dict self._process_input = self._process_input_none else: raise NotImplementedError() if isinstance(output_key, str): # when model returns value self._process_output = self._process_output_str elif isinstance(output_key, (list, tuple)): # when model returns tuple self._process_output = self._process_output_list elif self._output_key is None: # when model returns dict self._process_output = self._process_output_none else: raise NotImplementedError()