Guild does not catch scalar outputs when formatting values

Hi,

Thank you very much for making this fantastic experiment manager and making it free!

I noticed an unexpected behavior of Guild’s output scalar, so I report it here. Shortly, when the output strings are formatted with ‘.e’, they can not be caught by Guild. Below is a script to reproduce with Guild 0.8.1

In scalar.py, I had

import argparse


def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("--a", type=float, default=1.0)
    args = parser.parse_args()
    print(f"step: {100}")
    print(f"value: {args.a:.2e}")


if __name__ == "__main__":
    main()

and in guild.yml, I had

scalar:
  main: scalar
  flags-dest: args
  flags-import: all

Then in console, I got

(.venv) ➜  gscalar guild run scalar
You are about to run scalar
  a: 1.0
Continue? (Y/n)
step: 100
value: 1.00e+00
(.venv) ➜  gscalar guild runs info
id: 0b6abb0dc8bc4bb2914c01e504a5865e
operation: scalar
from: ~/project/gscalar/guild.yml
status: completed
started: 2022-06-16 19:58:39
stopped: 2022-06-16 19:58:39
marked: no
label: a=1.0
sourcecode_digest: 59509472e567014859244cbc4ce14ccd
vcs_commit:
run_dir: ~/project/gscalar/guild_home/runs/0b6abb0dc8bc4bb2914c01e504a5865e
command: /Users/kyika/project/gscalar/.venv/bin/python -um guild.op_main scalar -- --a 1.0
exit_status: 0
pid:
tags:
flags:
  a: 1.0
scalars:

The last line above shown that Guild records no scalar. I guess this is because values was formatted with “e+00”, which was not recognized by Guild.

Good old scientific notation. Thanks for the report. We will look into a fix for the next release.

1 Like