Example #1
0
 def test_dataframe(self):
     events = LoggedEventListSpec(
         name="foo",
         kind="dataframe",
         events=[
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 10:24:57"),
                 dataframe=V1EventDataframe(path="path",
                                            content_type="parquet"),
                 step=12,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 11:24:57"),
                 dataframe=V1EventDataframe(path="path",
                                            content_type="pickle"),
                 step=13,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 12:24:57"),
                 dataframe=V1EventDataframe(path="path"),
                 step=14,
             ),
         ],
     )
     events_dict = events.to_dict()
     assert events_dict == events.from_dict(events_dict).to_dict()
Example #2
0
 def test_audio(self):
     events = LoggedEventListSpec(
         name="foo",
         kind="audio",
         events=[
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 10:24:57"),
                 audio=V1EventAudio(sample_rate=1.1,
                                    num_channels=2,
                                    length_frames=2,
                                    path="test"),
                 step=12,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 11:24:57"),
                 audio=V1EventAudio(sample_rate=1.1,
                                    num_channels=2,
                                    length_frames=2,
                                    path="test"),
                 step=13,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 12:24:57"),
                 audio=V1EventAudio(sample_rate=1.12,
                                    num_channels=22,
                                    length_frames=22,
                                    path="test"),
                 step=14,
             ),
         ],
     )
     events_dict = events.to_dict()
     assert events_dict == events.from_dict(events_dict).to_dict()
Example #3
0
 def test_video(self):
     events = LoggedEventListSpec(
         name="foo",
         kind="video",
         events=[
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 10:24:57"),
                 video=V1EventVideo(height=1,
                                    width=1,
                                    colorspace=1,
                                    path="path"),
                 step=12,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 11:24:57"),
                 video=V1EventVideo(height=10,
                                    width=1,
                                    colorspace=0,
                                    path="path"),
                 step=13,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 12:24:57"),
                 video=V1EventVideo(height=1,
                                    width=10,
                                    colorspace=2,
                                    path="path"),
                 step=14,
             ),
         ],
     )
     events_dict = events.to_dict()
     assert events_dict == events.from_dict(events_dict).to_dict()
Example #4
0
 def test_curve(self):
     events = LoggedEventListSpec(
         name="foo",
         kind="curve",
         events=[
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 10:24:57"),
                 curve=V1EventCurve(
                     kind="roc",
                     x=[1.1, 3.1, 5.1],
                     y=[0.1, 0.3, 0.4],
                     annotation="0.1",
                 ),
                 step=12,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 11:24:57"),
                 curve=V1EventCurve(
                     kind="pr",
                     x=[1.1, 3.1, 5.1],
                     y=[0.1, 0.3, 0.4],
                     annotation="0.21",
                 ),
                 step=13,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 12:24:57"),
                 curve=V1EventCurve(
                     kind="custom",
                     x=[1.1, 3.1, 5.1],
                     y=[0.1, 0.3, 0.4],
                     annotation="0.1",
                 ),
                 step=14,
             ),
         ],
     )
     events_dict = events.to_dict()
     assert events_dict == events.from_dict(events_dict).to_dict()
Example #5
0
 def test_metrics(self):
     events = LoggedEventListSpec(
         name="foo",
         kind="metric",
         events=[
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 10:24:57"),
                 metric=0.1,
                 step=12,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 12:24:57"),
                 metric=0.112,
                 step=13,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 11:24:57"),
                 metric=0.1,
                 step=14,
             ),
         ],
     )
     events_dict = events.to_dict()
     assert events_dict == events.from_dict(events_dict).to_dict()
Example #6
0
 def test_model(self):
     events = LoggedEventListSpec(
         name="foo",
         kind="model",
         events=[
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 10:24:57"),
                 model=V1EventModel(framework="tensorflow", path="path"),
                 step=12,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 11:24:57"),
                 model=V1EventModel(framework="pytorch", path="path"),
                 step=13,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 12:24:57"),
                 model=V1EventModel(framework="onnx", path="path"),
                 step=14,
             ),
         ],
     )
     events_dict = events.to_dict()
     assert events_dict == events.from_dict(events_dict).to_dict()
Example #7
0
 def test_artifact(self):
     events = LoggedEventListSpec(
         name="foo",
         kind="artifact",
         events=[
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 10:24:57"),
                 artifact=V1EventArtifact(kind="dataframe", path="path"),
                 step=12,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 11:24:57"),
                 artifact=V1EventArtifact(kind="tsv", path="path"),
                 step=13,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 12:24:57"),
                 artifact=V1EventArtifact(kind="csv", path="path"),
                 step=14,
             ),
         ],
     )
     events_dict = events.to_dict()
     assert events_dict == events.from_dict(events_dict).to_dict()
Example #8
0
 def test_chart(self):
     events = LoggedEventListSpec(
         name="foo",
         kind="chart",
         events=[
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 10:24:57"),
                 chart=V1EventChart(kind="plotly", figure={"foo": "bar"}),
                 step=12,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 11:24:57"),
                 chart=V1EventChart(kind="vega", figure={"foo": "bar"}),
                 step=13,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 12:24:57"),
                 chart=V1EventChart(kind="bokeh", figure={"foo": "bar"}),
                 step=14,
             ),
         ],
     )
     events_dict = events.to_dict()
     assert events_dict == events.from_dict(events_dict).to_dict()
Example #9
0
 def test_html(self):
     events = LoggedEventListSpec(
         name="foo",
         kind="html",
         events=[
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 10:24:57"),
                 html="<div>1</div>",
                 step=12,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 11:24:57"),
                 html="<div>2</div>",
                 step=13,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 12:24:57"),
                 html="<div>3</div>",
                 step=14,
             ),
         ],
     )
     events_dict = events.to_dict()
     assert events_dict == events.from_dict(events_dict).to_dict()
Example #10
0
 def test_histogram(self):
     events = LoggedEventListSpec(
         name="foo",
         kind="histogram",
         events=[
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 10:24:57"),
                 histogram=V1EventHistogram(values=[10], counts=[1]),
                 step=12,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 11:24:57"),
                 histogram=V1EventHistogram(values=[10], counts=[1]),
                 step=13,
             ),
             V1Event(
                 timestamp=dt_parser.parse("2018-12-11 12:24:57"),
                 histogram=V1EventHistogram(values=[10], counts=[1]),
                 step=14,
             ),
         ],
     )
     events_dict = events.to_dict()
     assert events_dict == events.from_dict(events_dict).to_dict()
Example #11
0
 def test_images(self):
     events = LoggedEventListSpec(
         name="foo",
         kind="metric",
         events=[
             V1Event(
                 timestamp=parse_datetime("2018-12-11 10:24:57"),
                 image=V1EventImage(height=1, width=1, colorspace=1, path="path"),
                 step=12,
             ),
             V1Event(
                 timestamp=parse_datetime("2018-12-11 11:24:57"),
                 image=V1EventImage(height=10, width=1, colorspace=0, path="path"),
                 step=13,
             ),
             V1Event(
                 timestamp=parse_datetime("2018-12-11 12:24:57"),
                 image=V1EventImage(height=1, width=10, colorspace=2, path="path"),
                 step=14,
             ),
         ],
     )
     events_dict = events.to_dict()
     assert events_dict == events.from_dict(events_dict).to_dict()