seqio.loggers package#
Classes for logging evaluation metrics and inference results.
- class seqio.loggers.JSONLogger(output_dir, write_n_results=None, json_encoder_cls=<class 'seqio.loggers.TensorAndNumpyEncoder'>)[source]#
A logger that writes metrics and model outputs to JSONL files.
- class seqio.loggers.Logger(output_dir)[source]#
Abstract base class for logging.
- output_dir#
a directory to save the logging results (e.g., TensorBoard summary) as well as the evaluation results (e.g., “inputs_pretokenized”, “target_pretokenize” and “prediction”).
- class seqio.loggers.PyLoggingLogger(output_dir, level=0)[source]#
A logger that writes metrics using the standard Python log.
- class seqio.loggers.TensorAndNumpyEncoder(*args, max_ndarray_size=32, **kwargs)[source]#
JSON Encoder to use when encoding dicts with tensors and numpy arrays.
- default(obj)[source]#
Implement this method in a subclass such that it returns a serializable object for
o, or calls the base implementation (to raise aTypeError).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o)
- class seqio.loggers.TensorBoardLogger(output_dir)[source]#
A logger that writes metrics to TensorBoard summaries.