event_prediction#

(s3prl.task.event_prediction)

EventPredictionTask#

class s3prl.task.event_prediction.EventPredictionTask(model: Module, category: CategoryEncoder, prediction_type: str, scores: List[str], postprocessing_grid: Dict[str, List[float]], valid_target_events: Optional[Dict[str, List[Dict[str, Any]]]] = None, test_target_events: Optional[Dict[str, List[Dict[str, Any]]]] = None)[source][source]#

Bases: Task

get_state()[source][source]#
set_state(state: dict)[source][source]#
predict(x, x_len)[source][source]#
train_step(x, x_len, y, y_len, labels, record_id: List[str], chunk_id: List[int], unique_name: List[str], _dump_dir: Optional[str] = None)[source][source]#
train_reduction(batch_results: list, _dump_dir: Optional[str] = None)[source][source]#
valid_step(*args, **kwds)[source][source]#
test_step(*args, **kwds)[source][source]#
log_scores(score_args)[source][source]#

Logs the metric score value for each score defined for the model

valid_reduction(cached_results: list, _dump_dir: Optional[str] = None)[source][source]#
call_super_init: bool = False[source]#
dump_patches: bool = False[source]#
forward(mode: str, *args, **kwargs)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

parse_cached_results(cached_results: List[dict])[source]#
reduction(mode: str, *args, **kwargs)[source]#
test_reduction(cached_results: list, _dump_dir: Optional[str] = None)[source][source]#
training: bool[source]#
eval_reduction(_mode: str, cached_results: list, _dump_dir: Optional[str] = None)[source][source]#