pytorch_pfn_extras.training.extensions.ProfileReport

class pytorch_pfn_extras.training.extensions.ProfileReport(store_keys=None, report_keys=None, trigger=(1, 'epoch'), filename=None, append=False, format=None, **kwargs)

Writes the profile results to a file.

Times are reported by using the pytorch_pfn_extras.profiler.TimeSummary.report() context manager.

Parameters
  • store_keys (iterable of strs) – Keys of values to write to the profiler report file.

  • report_keys (iterable of strs) – Keys of values that will be reported.

  • trigger (Optional[Union[pytorch_pfn_extras.training._trigger_util.Trigger, Callable[[pytorch_pfn_extras.training._manager_protocol.ExtensionsManagerProtocol], bool], Tuple[float, str]]]) – Trigger that decides when to aggregate the result and output the values. This is distinct from the trigger of this extension itself. If it is a tuple in the form <int>, 'epoch' or <int>, 'iteration', it is passed to IntervalTrigger.

  • filename (str) – Name of the log file under the output directory. It can be a format string: the last result dictionary is passed for the formatting. For example, users can use ‘{iteration}’ to separate the log files for different iterations. If the log name is None, it does not output the log to any file.

  • append (bool, optionsl) – If the file is JSON Lines or YAML, contents will be appended instead of rewriting the file every call.

  • format (str, optional) – accepted values are ‘json’, ‘json-lines’ and ‘yaml’.

  • writer (writer object, optional) – must be callable. object to dump the log to. If specified, it needs to have a correct savefun defined. The writer can override the save location in the pytorch_pfn_extras.training.ExtensionsManager object

  • entries (list) – list of str

  • kwargs (Any) –

Returns

header string templates (str): template string for print values.

Return type

header (str)

__init__(store_keys=None, report_keys=None, trigger=(1, 'epoch'), filename=None, append=False, format=None, **kwargs)
Parameters
  • store_keys (Optional[Iterable[str]]) –

  • report_keys (Optional[Iterable[str]]) –

  • trigger (Optional[Union[pytorch_pfn_extras.training._trigger_util.Trigger, Callable[[pytorch_pfn_extras.training._manager_protocol.ExtensionsManagerProtocol], bool], Tuple[float, str]]]) –

  • filename (Optional[str]) –

  • append (bool) –

  • format (Optional[str]) –

  • kwargs (Any) –

Methods

__init__([store_keys, report_keys, trigger, …])

finalize()

Finalizes the extension.

initialize(manager)

Initializes up the manager state.

load_state_dict(to_load)

on_error(manager, exc, tb)

Handles the error raised during training before finalization.

state_dict()

Serializes the extension state.

Attributes

default_name

Default name of the extension.

is_async

name

needs_model_state

priority

trigger