Пример #1
0
def test_make_output(_format):
    """
    test make output

    :param _format: (str) output format
    """
    writer = make_output_format(_format, LOG_DIR)
    writer.writekvs(KEY_VALUES)
    if _format == 'tensorboard':
        read_tb(LOG_DIR)
    elif _format == "csv":
        read_csv(LOG_DIR + 'progress.csv')
    elif _format == 'json':
        read_json(LOG_DIR + 'progress.json')
    writer.close()
Пример #2
0
def _build_output_formats(
    folder: str,
    format_strs: Sequence[str] = None,
) -> Sequence[sb_logger.KVWriter]:
    """Build output formats for initializing a Stable Baselines Logger.

    Args:
      folder: Path to directory that logs are written to.
      format_strs: An list of output format strings. For details on available
        output formats see `stable_baselines.logger.make_output_format`.
    """
    os.makedirs(folder, exist_ok=True)
    output_formats = [
        sb_logger.make_output_format(f, folder) for f in format_strs
    ]
    return output_formats
Пример #3
0
def test_make_output_fail():
    """
    test value error on logger
    """
    with pytest.raises(ValueError):
        make_output_format('dummy_format', LOG_DIR)