GithubHelp home page GithubHelp logo

janosh / tensorboard-reducer Goto Github PK

View Code? Open in Web Editor NEW
66.0 4.0 4.0 1.53 MB

Reduce multiple PyTorch TensorBoard runs to new event (or CSV) files.

Home Page: https://pypi.org/project/tensorboard-reducer

License: MIT License

Python 86.74% TeX 13.26%
tensorboard pytorch tensorboard-pytorch reducer machine-learning averaging csv tensorboard-reducer

tensorboard-reducer's Introduction

TensorBoard Reducer

Tests pre-commit.ci status Requires Python 3.8+ PyPI PyPI Downloads DOI

This project can ingest both PyTorch and TensorFlow event files but was mostly tested with PyTorch. For a TF-only project, see tensorboard-aggregator.

Compute statistics (mean, std, min, max, median or any other numpy operation) of multiple TensorBoard run directories. This can be used e.g. when training model ensembles to reduce noise in loss/accuracy/error curves and establish statistical significance of performance improvements or get a better idea of epistemic uncertainty. Results can be saved to disk either as new TensorBoard runs or CSV/JSON/Excel. More file formats are easy to add, PRs welcome.

Example notebooks

       
Basic Python API Demo Launch Codespace Launch Binder Open in Google Colab Demonstrates how to work with local TensorBoard event files.
Functorch MLP Ensemble Launch Codespace Launch Binder Open in Google Colab Shows how to aggregate run metrics with TensorBoard Reducer
when training model ensembles using functorch.
Weights & Biases Integration Launch Codespace Launch Binder Open in Google Colab Trains PyTorch CNN ensemble on MNIST, logs results to WandB, downloads metrics from multiple WandB runs, aggregates using tb-reducer, then re-uploads to WandB as new runs.

The mean of 3 runs shown in pink here is less noisy and better suited for comparisons between models or different training techniques than individual runs. Mean of 3 TensorBoard logs

Installation

pip install tensorboard-reducer

Excel support requires installing extra dependencies:

pip install 'tensorboard-reducer[excel]'

Usage

CLI

tb-reducer runs/of-your-model* -o output-dir -r mean,std,min,max

All positional CLI arguments are interpreted as input directories and expected to contain TensorBoard event files. These can be specified individually or with wildcards using shell expansion. You can check you're getting the right input directories by running echo runs/of-your-model* before passing them to tb-reducer.

Note: By default, TensorBoard Reducer expects event files to contain identical tags and equal number of steps for all scalars. If you trained one model for 300 epochs and another for 400 and/or recorded different sets of metrics (tags in TensorBoard lingo) for each of them, see CLI flags --lax-steps and --lax-tags to disable this safeguard. The corresponding kwargs in the Python API are strict_tags = True and strict_steps = True on load_tb_events().

In addition, tb-reducer has the following flags:

  • -o/--outpath (required): File path or directory where to write output to disk. If --outpath is a directory, output will be saved as TensorBoard runs, one new directory created for each reduction suffixed by the numpy operation, e.g. 'out/path-mean', 'out/path-max', etc. If --outpath is a file path, it must have '.csv'/'.json' or '.xlsx' (supports compression by using e.g. .csv.gz, json.bz2) in which case a single file will be created. CSVs will have a two-level header containing one column for each combination of tag (loss, accuracy, ...) and reduce operation (mean, std, ...). Tag names will be in top-level header, reduce ops in second level. Hint: When saving data as CSV or Excel, use pandas.read_csv("path/to/file.csv", header=[0, 1], index_col=0) and pandas.read_excel("path/to/file.xlsx", header=[0, 1], index_col=0) to load reduction results into a multi-index dataframe.
  • -r/--reduce-ops (optional, default: mean): Comma-separated names of numpy reduction ops (mean, std, min, max, ...). Each reduction is written to a separate outpath suffixed by its op name. E.g. if outpath='reduced-run', the mean reduction will be written to 'reduced-run-mean'.
  • -f/--overwrite (optional, default: False): Whether to overwrite existing output directories/data files (CSV, JSON, Excel). For safety, the overwrite operation will abort with an error if the file/directory to overwrite is not a known data file and does not look like a TensorBoard run directory (i.e. does not start with 'events.out').
  • --lax-tags (optional, default: False): Allow different runs have to different sets of tags. In this mode, each tag reduction will run over as many runs as are available for a given tag, even if that's just one. Proceed with caution as not all tags will have the same statistics in downstream analysis.
  • --lax-steps (optional, default: False): Allow tags across different runs to have unequal numbers of steps. In this mode, each reduction will only use as many steps as are available in the shortest run (same behavior as zip(short_list, long_list) which stops when short_list is exhausted).
  • --handle-dup-steps (optional, default: None): How to handle duplicate values recorded for the same tag and step in a single run. One of 'keep-first', 'keep-last', 'mean'. 'keep-first/last' will keep the first/last occurrence of duplicate steps while 'mean' computes their mean. Default behavior is to raise ValueError on duplicate steps.
  • --min-runs-per-step (optional, default: None): Minimum number of runs across which a given step must be recorded to be kept. Steps present across less runs are dropped. Only plays a role if lax_steps is true. Warning: Be aware that with this setting, you'll be reducing variable number of runs, however many recorded a value for a given step as long as there are at least --min-runs-per-step. In other words, the statistics of a reduction will change mid-run. Say you're plotting the mean of an error curve, the sample size of that mean will drop from, say, 10 down to 4 mid-plot if 4 of your models trained for longer than the rest. Be sure to remember when using this.
  • -v/--version (optional): Get the current version.

Python API

You can also import tensorboard_reducer into a Python script or Jupyter notebook for more complex operations. Here's a simple example that uses all of the main functions load_tb_events, reduce_events, write_data_file and write_tb_events to get you started:

from glob import glob

import tensorboard_reducer as tbr

input_event_dirs = sorted(glob("glob_pattern/of_tb_directories_to_reduce*"))
# where to write reduced TB events, each reduce operation will be in a separate subdirectory
tb_events_output_dir = "path/to/output_dir"
csv_out_path = "path/to/write/reduced-data-as.csv"
# whether to abort or overwrite when csv_out_path already exists
overwrite = False
reduce_ops = ("mean", "min", "max", "median", "std", "var")

events_dict = tbr.load_tb_events(input_event_dirs)

# number of recorded tags. e.g. would be 3 if you recorded loss, MAE and R^2
n_scalars = len(events_dict)
n_steps, n_events = list(events_dict.values())[0].shape

print(
    f"Loaded {n_events} TensorBoard runs with {n_scalars} scalars and {n_steps} steps each"
)
print(", ".join(events_dict))

reduced_events = tbr.reduce_events(events_dict, reduce_ops)

for op in reduce_ops:
    print(f"Writing '{op}' reduction to '{tb_events_output_dir}-{op}'")

tbr.write_tb_events(reduced_events, tb_events_output_dir, overwrite)

print(f"Writing results to '{csv_out_path}'")

tbr.write_data_file(reduced_events, csv_out_path, overwrite)

print("Reduction complete")

tensorboard-reducer's People

Contributors

heinrichad avatar janosh avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tensorboard-reducer's Issues

Am i doing something wrong?

I can't seem to use your tool, could you please help me

ubuntu@unity-1:~/ultron/configLoader_v4/scripts$ echo event_files/run*
event_files/run61-explore event_files/run61-explore-constrained event_files/run61-explore-constrained.events.out.tfevents.1640984794.unity-3.23065.0 event_files/run61-explore.events.out.tfevents.1640984794.unity-2.25875.0 event_files/run61-voxel event_files/run61-voxel-constrained event_files/run61-voxel-constrained.events.out.tfevents.1640984794.unity-5.23094.0 event_files/run61-voxel.events.out.tfevents.1640984794.unity-4.25035.0 event_files/run62-16 event_files/run62-16-constrained event_files/run62-16-constrained-pigeon-pathak event_files/run62-16-constrained-pigeon-pathak.events.out.tfevents.1641647188.unity-7.105591.0 event_files/run62-16-constrained.events.out.tfevents.1640984794.unity-7.22654.0 event_files/run62-16-pathak event_files/run62-16-pathak.events.out.tfevents.1641156311.unity-3.59657.0 event_files/run62-16-pathak.events.out.tfevents.1641332673.unity-3.84443.0 event_files/run62-16-pathak.events.out.tfevents.1641486791.unity-3.94913.0 event_files/run62-16-pathak.events.out.tfevents.1641646666.unity-3.120988.0 event_files/run62-16.events.out.tfevents.1640984794.unity-6.22114.0 event_files/run62-16.events.out.tfevents.1641152748.unity-6.64103.0 event_files/run62-16.events.out.tfevents.1641332776.unity-6.2450.0 event_files/run62-16.events.out.tfevents.1641486791.unity-6.34914.0 event_files/run62-4 event_files/run62-4-pathak event_files/run62-4-pathak.events.out.tfevents.1641084257.unity-1.64003.0 event_files/run62-4-pathak.events.out.tfevents.1641488596.unity-1.120929.0 event_files/run62-4-pigeon event_files/run62-4-pigeon-pathak event_files/run62-4-pigeon-pathak.events.out.tfevents.1641214429.unity-5.53019.0 event_files/run62-4-pigeon.events.out.tfevents.1641214443.unity-4.56497.0 event_files/run62-4.events.out.tfevents.1640908535.unity-1.29477.0 event_files/run62-8 event_files/run62-8-pathak event_files/run62-8-pathak.events.out.tfevents.1641166218.unity-2.2484.0 event_files/run62-8-pathak.events.out.tfevents.1641332673.unity-2.52881.0 event_files/run62-8.events.out.tfevents.1640984805.unity-8.25270.0 event_files/run63 event_files/run63++025 event_files/run63++025.events.out.tfevents.1641156311.unity-7.47443.0 event_files/run63++050 event_files/run63++050.events.out.tfevents.1641214425.unity-8.61785.0 event_files/run63++075 event_files/run63++075.events.out.tfevents.1641253795.unity-1.82901.0 event_files/run63++100 event_files/run63++100.events.out.tfevents.1641564949.unity-2.108234.0 event_files/run63.events.out.tfevents.1641582798.unity-6.58995.0 event_files/run64 event_files/run64+vision event_files/run64+vision.events.out.tfevents.1641488480.unity-5.139102.0 event_files/run64.events.out.tfevents.1641488481.unity-4.89160.0 event_files/run65 event_files/run65-pure event_files/run65-pure.events.out.tfevents.1641488480.unity-8.123582.0 event_files/run65.events.out.tfevents.1641416393.unity-7.76235.0

ubuntu@unity-1:~/ultron/configLoader_v4/scripts$ ls event_files/
run61-explore                                                                       run62-16.events.out.tfevents.1640984794.unity-6.22114.0               run63
run61-explore-constrained                                                           run62-16.events.out.tfevents.1641152748.unity-6.64103.0               run63++025
run61-explore-constrained.events.out.tfevents.1640984794.unity-3.23065.0            run62-16.events.out.tfevents.1641332776.unity-6.2450.0                run63++025.events.out.tfevents.1641156311.unity-7.47443.0
run61-explore.events.out.tfevents.1640984794.unity-2.25875.0                        run62-16.events.out.tfevents.1641486791.unity-6.34914.0               run63++050
run61-voxel                                                                         run62-4                                                               run63++050.events.out.tfevents.1641214425.unity-8.61785.0
run61-voxel-constrained                                                             run62-4-pathak                                                        run63++075
run61-voxel-constrained.events.out.tfevents.1640984794.unity-5.23094.0              run62-4-pathak.events.out.tfevents.1641084257.unity-1.64003.0         run63++075.events.out.tfevents.1641253795.unity-1.82901.0
run61-voxel.events.out.tfevents.1640984794.unity-4.25035.0                          run62-4-pathak.events.out.tfevents.1641488596.unity-1.120929.0        run63++100
run62-16                                                                            run62-4-pigeon                                                        run63++100.events.out.tfevents.1641564949.unity-2.108234.0
run62-16-constrained                                                                run62-4-pigeon-pathak                                                 run63.events.out.tfevents.1641582798.unity-6.58995.0
run62-16-constrained-pigeon-pathak                                                  run62-4-pigeon-pathak.events.out.tfevents.1641214429.unity-5.53019.0  run64
run62-16-constrained-pigeon-pathak.events.out.tfevents.1641647188.unity-7.105591.0  run62-4-pigeon.events.out.tfevents.1641214443.unity-4.56497.0         run64+vision
run62-16-constrained.events.out.tfevents.1640984794.unity-7.22654.0                 run62-4.events.out.tfevents.1640908535.unity-1.29477.0                run64+vision.events.out.tfevents.1641488480.unity-5.139102.0
run62-16-pathak                                                                     run62-8                                                               run64.events.out.tfevents.1641488481.unity-4.89160.0
run62-16-pathak.events.out.tfevents.1641156311.unity-3.59657.0                      run62-8-pathak                                                        run65
run62-16-pathak.events.out.tfevents.1641332673.unity-3.84443.0                      run62-8-pathak.events.out.tfevents.1641166218.unity-2.2484.0          run65-pure
run62-16-pathak.events.out.tfevents.1641486791.unity-3.94913.0                      run62-8-pathak.events.out.tfevents.1641332673.unity-2.52881.0         run65-pure.events.out.tfevents.1641488480.unity-8.123582.0
run62-16-pathak.events.out.tfevents.1641646666.unity-3.120988.0                     run62-8.events.out.tfevents.1640984805.unity-8.25270.0                run65.events.out.tfevents.1641416393.unity-7.76235.0

ubuntu@unity-1:~/ultron/configLoader_v4/scripts$ tb-reducer event_files/run* -o events_reduced.csv -r mean,std,min,max
usage: TensorBoard Reducer [-h] [-i INDIRS_GLOB] [-o OUTPATH] [-r REDUCE_OPS] [-f] [--lax-tags] [--lax-steps] [--handle-dup-steps {keep-first,keep-last,mean}] [--min-runs-per-step MIN_RUNS_PER_STEP] [-v]
TensorBoard Reducer: error: unrecognized arguments: event_files/run61-explore event_files/run61-explore-constrained event_files/run61-explore-constrained.events.out.tfevents.1640984794.unity-3.23065.0 event_files/run61-explore.events.out.tfevents.1640984794.unity-2.25875.0 event_files/run61-voxel event_files/run61-voxel-constrained event_files/run61-voxel-constrained.events.out.tfevents.1640984794.unity-5.23094.0 event_files/run61-voxel.events.out.tfevents.1640984794.unity-4.25035.0 event_files/run62-16 event_files/run62-16-constrained event_files/run62-16-constrained-pigeon-pathak event_files/run62-16-constrained-pigeon-pathak.events.out.tfevents.1641647188.unity-7.105591.0 event_files/run62-16-constrained.events.out.tfevents.1640984794.unity-7.22654.0 event_files/run62-16-pathak event_files/run62-16-pathak.events.out.tfevents.1641156311.unity-3.59657.0 event_files/run62-16-pathak.events.out.tfevents.1641332673.unity-3.84443.0 event_files/run62-16-pathak.events.out.tfevents.1641486791.unity-3.94913.0 event_files/run62-16-pathak.events.out.tfevents.1641646666.unity-3.120988.0 event_files/run62-16.events.out.tfevents.1640984794.unity-6.22114.0 event_files/run62-16.events.out.tfevents.1641152748.unity-6.64103.0 event_files/run62-16.events.out.tfevents.1641332776.unity-6.2450.0 event_files/run62-16.events.out.tfevents.1641486791.unity-6.34914.0 event_files/run62-4 event_files/run62-4-pathak event_files/run62-4-pathak.events.out.tfevents.1641084257.unity-1.64003.0 event_files/run62-4-pathak.events.out.tfevents.1641488596.unity-1.120929.0 event_files/run62-4-pigeon event_files/run62-4-pigeon-pathak event_files/run62-4-pigeon-pathak.events.out.tfevents.1641214429.unity-5.53019.0 event_files/run62-4-pigeon.events.out.tfevents.1641214443.unity-4.56497.0 event_files/run62-4.events.out.tfevents.1640908535.unity-1.29477.0 event_files/run62-8 event_files/run62-8-pathak event_files/run62-8-pathak.events.out.tfevents.1641166218.unity-2.2484.0 event_files/run62-8-pathak.events.out.tfevents.1641332673.unity-2.52881.0 event_files/run62-8.events.out.tfevents.1640984805.unity-8.25270.0 event_files/run63 event_files/run63++025 event_files/run63++025.events.out.tfevents.1641156311.unity-7.47443.0 event_files/run63++050 event_files/run63++050.events.out.tfevents.1641214425.unity-8.61785.0 event_files/run63++075 event_files/run63++075.events.out.tfevents.1641253795.unity-1.82901.0 event_files/run63++100 event_files/run63++100.events.out.tfevents.1641564949.unity-2.108234.0 event_files/run63.events.out.tfevents.1641582798.unity-6.58995.0 event_files/run64 event_files/run64+vision event_files/run64+vision.events.out.tfevents.1641488480.unity-5.139102.0 event_files/run64.events.out.tfevents.1641488481.unity-4.89160.0 event_files/run65 event_files/run65-pure event_files/run65-pure.events.out.tfevents.1641488480.unity-8.123582.0 event_files/run65.events.out.tfevents.1641416393.unity-7.76235.0

Not entirely sure whats going wrong??

image
PS C:\Users\shadow\Desktop\tb> tb-reducer -i 'seed?/*' -o out
Loaded 2 TensorBoard runs with 99 scalars and 383 steps each

  • eval-SuperMarioBros-1-1-v1
  • eval-lives-SuperMarioBros-1-1-v1
  • eval-x-SuperMarioBros-1-1-v1
  • eval-SuperMarioBros-2-1-v1
  • eval-lives-SuperMarioBros-2-1-v1
  • eval-x-SuperMarioBros-2-1-v1
  • eval-SuperMarioBros-3-2-v1
  • eval-lives-SuperMarioBros-3-2-v1
  • eval-x-SuperMarioBros-3-2-v1
  • eval-SuperMarioBros-6-4-v1
  • eval-lives-SuperMarioBros-6-4-v1
  • eval-x-SuperMarioBros-6-4-v1
  • new episodes per training epoch
  • new sequences per training epoch
  • multienvironment efficiency
  • self.score
  • self.eval_score
  • self.x
  • self.finishing_rate
  • self.loss
  • eps
  • eval-SuperMarioBros-1-2-v1
  • eval-lives-SuperMarioBros-1-2-v1
  • eval-x-SuperMarioBros-1-2-v1
  • eval-SuperMarioBros-1-3-v1
  • eval-lives-SuperMarioBros-1-3-v1
  • eval-x-SuperMarioBros-1-3-v1
  • eval-SuperMarioBros-1-4-v1
  • eval-lives-SuperMarioBros-1-4-v1
  • eval-x-SuperMarioBros-1-4-v1
  • eval-SuperMarioBros-2-2-v1
  • eval-lives-SuperMarioBros-2-2-v1
  • eval-x-SuperMarioBros-2-2-v1
  • eval-SuperMarioBros-2-3-v1
  • eval-lives-SuperMarioBros-2-3-v1
  • eval-x-SuperMarioBros-2-3-v1
  • eval-SuperMarioBros-2-4-v1
  • eval-lives-SuperMarioBros-2-4-v1
  • eval-x-SuperMarioBros-2-4-v1
  • eval-SuperMarioBros-3-1-v1
  • eval-lives-SuperMarioBros-3-1-v1
  • eval-x-SuperMarioBros-3-1-v1
  • eval-SuperMarioBros-3-3-v1
  • eval-lives-SuperMarioBros-3-3-v1
  • eval-x-SuperMarioBros-3-3-v1
  • eval-SuperMarioBros-3-4-v1
  • eval-lives-SuperMarioBros-3-4-v1
  • eval-x-SuperMarioBros-3-4-v1
  • eval-SuperMarioBros-4-1-v1
  • eval-lives-SuperMarioBros-4-1-v1
  • eval-x-SuperMarioBros-4-1-v1
  • eval-SuperMarioBros-4-2-v1
  • eval-lives-SuperMarioBros-4-2-v1
  • eval-x-SuperMarioBros-4-2-v1
  • eval-SuperMarioBros-4-3-v1
  • eval-lives-SuperMarioBros-4-3-v1
  • eval-x-SuperMarioBros-4-3-v1
  • eval-SuperMarioBros-4-4-v1
  • eval-lives-SuperMarioBros-4-4-v1
  • eval-x-SuperMarioBros-4-4-v1
  • eval-SuperMarioBros-5-1-v1
  • eval-lives-SuperMarioBros-5-1-v1
  • eval-x-SuperMarioBros-5-1-v1
  • eval-SuperMarioBros-5-2-v1
  • eval-lives-SuperMarioBros-5-2-v1
  • eval-x-SuperMarioBros-5-2-v1
  • eval-SuperMarioBros-5-3-v1
  • eval-lives-SuperMarioBros-5-3-v1
  • eval-x-SuperMarioBros-5-3-v1
  • eval-SuperMarioBros-5-4-v1
  • eval-lives-SuperMarioBros-5-4-v1
  • eval-x-SuperMarioBros-5-4-v1
  • eval-SuperMarioBros-6-1-v1
  • eval-lives-SuperMarioBros-6-1-v1
  • eval-x-SuperMarioBros-6-1-v1
  • eval-SuperMarioBros-6-2-v1
  • eval-lives-SuperMarioBros-6-2-v1
  • eval-x-SuperMarioBros-6-2-v1
  • eval-SuperMarioBros-6-3-v1
  • eval-lives-SuperMarioBros-6-3-v1
  • eval-x-SuperMarioBros-6-3-v1
  • eval-SuperMarioBros-7-1-v1
  • eval-lives-SuperMarioBros-7-1-v1
  • eval-x-SuperMarioBros-7-1-v1
  • eval-SuperMarioBros-7-2-v1
  • eval-lives-SuperMarioBros-7-2-v1
  • eval-x-SuperMarioBros-7-2-v1
  • eval-SuperMarioBros-7-3-v1
  • eval-lives-SuperMarioBros-7-3-v1
  • eval-x-SuperMarioBros-7-3-v1
  • eval-SuperMarioBros-8-1-v1
  • eval-lives-SuperMarioBros-8-1-v1
  • eval-x-SuperMarioBros-8-1-v1
  • eval-SuperMarioBros-8-2-v1
  • eval-lives-SuperMarioBros-8-2-v1
  • eval-x-SuperMarioBros-8-2-v1
  • eval-SuperMarioBros-8-3-v1
  • eval-lives-SuperMarioBros-8-3-v1
  • eval-x-SuperMarioBros-8-3-v1
    Writing 'mean' reduction to 'out-mean'
    PS C:\Users\shadow\Desktop\tb>

Issue with restarting runs from checkpoint mid run (I believe)?

PS C:\Users\shadow\Desktop\tb> tb-reducer -i 'whole game no double*' -o 'whole game no double' --lax-steps --lax-tags
Traceback (most recent call last):
  File "c:\users\shadow\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\shadow\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\shadow\AppData\Local\Programs\Python\Python38\Scripts\tb-reducer.exe\__main__.py", line 7, in <module>
  File "c:\users\shadow\appdata\local\programs\python\python38\lib\site-packages\tensorboard_reducer\main.py", line 102, in main
    events_dict = load_tb_events(
  File "c:\users\shadow\appdata\local\programs\python\python38\lib\site-packages\tensorboard_reducer\io.py", line 104, in load_tb_events
    return {key: pd.concat(lst, join="inner", axis=1) for key, lst in out_dict.items()}
  File "c:\users\shadow\appdata\local\programs\python\python38\lib\site-packages\tensorboard_reducer\io.py", line 104, in <dictcomp>
    return {key: pd.concat(lst, join="inner", axis=1) for key, lst in out_dict.items()}
  File "c:\users\shadow\appdata\local\programs\python\python38\lib\site-packages\pandas\core\reshape\concat.py", line 298, in concat
    return op.get_result()
  File "c:\users\shadow\appdata\local\programs\python\python38\lib\site-packages\pandas\core\reshape\concat.py", line 516, in get_result
    indexers[ax] = obj_labels.get_indexer(new_labels)
  File "c:\users\shadow\appdata\local\programs\python\python38\lib\site-packages\pandas\core\indexes\base.py", line 3171, in get_indexer
    raise InvalidIndexError(
pandas.errors.InvalidIndexError: Reindexing only valid with uniquely valued Index objects

files1.zip

Help would be much appreciated, as I'm using this for my dissertation which is due in a couple of weeks! Thanks, and keep up the good work!

Some tags only contain one data point

tb-reducer ant_sac/*seed*/log/serial/ -o out -r mean,std,min,max --lax-steps
Although I used --lax-steps flag, some tags only contain one data point. Others are fine.
image
image
collector_step/reward_mean is actually containing more data points than evaluator_step/reward_mean

handle-dup-steps bug

PS C:\Users\shadow\Desktop\tb> tb-reducer -i '1-1 full*' -o '1-1' --lax-steps --lax-tag --handle-dup-steps mean
Traceback (most recent call last):
File "c:\users\shadow\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\shadow\appdata\local\programs\python\python38\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\shadow\AppData\Local\Programs\Python\Python38\Scripts\tb-reducer.exe_main
.py", line 7, in
File "c:\users\shadow\appdata\local\programs\python\python38\lib\site-packages\tensorboard_reducer\main.py", line 109, in main
events_dict = load_tb_events(
File "c:\users\shadow\appdata\local\programs\python\python38\lib\site-packages\tensorboard_reducer\io.py", line 82, in load_tb_events
assert df.index.is_unique, (
AssertionError: Tag 'new episodes per training epoch' from run directory '1-1 full' contains duplicate steps. Please make sure your data wasn't corrupted. If this is expected/you want to proceed anyway, specify how to handle duplicate values recorded for the same tag and step in a single run by passing --handle-dup-steps to the CLI or handle_dup_steps='keep-first'|'keep-last'|'mean' to the Python API. This will keep the first/last occurrence of duplicate steps or take their mean.

same with keep-first

f.zip

Can't import

Hey, I think the version in pip is different from what I briefly leafed through on Github... anyway, when I try to import and follow your example, I get the following import error:

from glob import glob
from tensorboard_reducer import load_tb_events, reduce_events, write_csv, write_tb_events

  File "/Users/alex/opt/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  File "<ipython-input-2-d171cc7f8b6d>", line 2, in <module>
    from tensorboard_reducer import load_tb_events, reduce_events, write_csv, write_tb_events

  File "/Users/alex/opt/anaconda3/lib/python3.7/site-packages/tensorboard_reducer/__init__.py", line 1, in <module>
    from .io import load_tb_events, write_csv, write_tb_events

  File "<fstring>", line 1
    (overwrite=)
              ^
SyntaxError: invalid syntax```

Feature Request: a toggle between pessimism and optimism using lax-steps with reductions

I believe as general practice having the reduction cut off at the lowest step count is a good idea.
However I also believe that there are some cases in which it would be very helpful to be able to be able to cut off the averaging at the highest step count i.e. optimistic,
Thus a switch option for this would be very helpful
, or potentially an integer input for the minimum number of remaining runs at which to cut off and stop averaging, however this would obviously be more work.

Let me know what you think.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.