Skip to content

Commit

Permalink
Metrics now log durations, timestamp; fixed bug in os.path.join()
Browse files Browse the repository at this point in the history
  • Loading branch information
dsblank committed Sep 18, 2023
1 parent d2978c0 commit 3b9e8c4
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions cometx/cli/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
import sys

from comet_ml import Experiment, API, APIExperiment
from comet_ml.messages import StandardOutputMessage, InstalledPackagesMessage, HtmlMessage
from comet_ml.messages import StandardOutputMessage, InstalledPackagesMessage, HtmlMessage, MetricMessage


from cometx.utils import get_file_extension

Expand Down Expand Up @@ -232,7 +233,10 @@ def log_assets(experiment, path, assets_metadata):
for log_filename in assets_metadata:
asset_type = assets_metadata[log_filename].get("type", None)
asset_type = asset_type if asset_type else "asset"
filename = os.path.join(path, asset_type, log_filename)
if log_filename.startswith("/"):
filename = os.path.join(path, asset_type, log_filename[1:])
else:
filename = os.path.join(path, asset_type, log_filename)

metadata = assets_metadata[log_filename].get("metadata")
metadata = json.loads(metadata) if metadata else {}
Expand Down Expand Up @@ -289,8 +293,16 @@ def log_metrics(experiment, filename):
value = dict_line["metricValue"]
step = dict_line["step"]
epoch = dict_line["epoch"]
context = dict_line["runContext"]
timestamp = dict_line["timestamp"]
# FIXME: does not log time, duration
experiment.log_metric(name, value, step=step, epoch=epoch)
message = MetricMessage.create(
context=context,
use_http_messages=experiment.streamer.use_http_messages,
timestamp=timestamp,
)
message.set_metric(name, value, step=step, epoch=epoch)
experiment._enqueue_message(message)

def log_parameters(experiment, filename):
"""
Expand Down

0 comments on commit 3b9e8c4

Please sign in to comment.