deepr.hooks package
Submodules
deepr.hooks.base module
Base Hooks Factories
Some TensorFlow hooks cannot be defined before runtime. For example, a
TensorLoggingHook
requires tensors to be initialized.
To resolve this issue, we provide abstractions for Hooks factories, that allow you to parametrize the creation of hooks that will be created at runtime.
See the LoggingTensorHookFactory
for instance.
deepr.hooks.early_stopping module
Early Stopping Hook
- class deepr.hooks.early_stopping.EarlyStoppingHookFactory(metric, max_steps_without_improvement, min_steps=0, mode=BestMode.DECREASE, run_every_secs=None, run_every_steps=None, final_step=None)[source]
Bases:
EstimatorHookFactory
Early Stopping Hook Factory
deepr.hooks.log_variables_init module
Log Variables Statistics after initialization.
deepr.hooks.logging_tensor module
MLFlow Metrics Hook
- class deepr.hooks.logging_tensor.LoggingTensorHook(tensors, functions=None, name=None, use_mlflow=False, use_graphite=False, skip_after_step=None, every_n_iter=None, every_n_secs=None, at_end=False, formatter=<function _default_formatter>)[source]
Bases:
LoggingTensorHook
Logging Hook (tensors and custom metrics as functions)
- class deepr.hooks.logging_tensor.LoggingTensorHookFactory(tensors=None, functions=None, name=None, use_mlflow=False, use_graphite=False, skip_after_step=None, every_n_iter=None, every_n_secs=None, at_end=False, formatter=<function _default_formatter>)[source]
Bases:
TensorHookFactory
Parametrize the creation of a LoggingTensorHook factory.
Arguments for instantiation should be provided as keyword arguments.
- tensors
Name of the tensors to use at runtime. If None (default), log all scalars.
- Type:
List[str], Optional
- functions
Additional “python” metrics. Each function should return a float
- class deepr.hooks.logging_tensor.MaxResidentMemory(unit='gb')[source]
Bases:
ResidentMemory
Measure maximum resident memory of the current process
deepr.hooks.num_params module
Log Number of Parameters after session creation
- class deepr.hooks.num_params.NumParamsHook(use_mlflow=False)[source]
Bases:
SessionRunHook
Log Number of Parameters after session creation
- after_create_session(session, coord)[source]
Called when new TensorFlow session is created.
This is called to signal the hooks that a new session has been created. This has two essential differences with the situation in which begin is called:
- When this is called, the graph is finalized and ops can no longer be added
to the graph.
- This method will also be called as a result of recovering a wrapped
session, not only at the beginning of the overall session.
- Parameters:
session – A TensorFlow Session that has been created.
coord – A Coordinator object which keeps track of all threads.
deepr.hooks.steps_per_sec module
Steps Per Second Hook
deepr.hooks.summary module
Summary Saver Hook
- class deepr.hooks.summary.SummarySaverHookFactory(tensors=None, save_steps=None, save_secs=None, output_dir=None, summary_writer=None, scaffold=None)[source]
Bases:
TensorHookFactory
Summary Saver Hook