Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
Hi Community, Is There A Way To Download All The Logged Scalars/Plots Using Code Itself?

Hi community,
Is there a way to download all the logged scalars/plots using code itself?

  
  
Posted 2 years ago
Votes Newest

Answers 5


hey TenderCoyote78
Here is an example of how to dump the plots to jpeg files

` from clearml.backend_api.session.client import APIClient
from clearml import Task
import plotly.io as plio

task = Task.get_task(task_id='xxxxxx')

client = APIClient()

t = client.events.get_task_plots(task=task.id)

for i, plot in enumerate(t.plots):
fig = plio.from_json(plot['plot_str'])
plio.write_image(fig=fig, file=f'./my_plot_{i}.jpeg') `

  
  
Posted 2 years ago

SweetBadger76

  
  
Posted 2 years ago

for the scalars :

` import pandas as pd
import plotly.graph_objects as go

scalars = client.events.scalar_metrics_iter_histogram(task=task.id).to_dict()['metrics']

for graph in scalars.keys():
for i, metric in enumerate(scalars[graph].keys()):
df = pd.DataFrame(scalars[graph][metric]).iloc[:, 1:]
fig = go.Scatter(
scalars[graph][metric],
mode='lines',
name=metric,
showlegend=True
)
plio.write_image(fig=go.Figure(fig), file=f'./my_metric_{i}.jpeg') `

  
  
Posted 2 years ago

How do I save these as pngs?

  
  
Posted 2 years ago

Hi TenderCoyote78
Here is a snippet to illustrate how to retrieve the scalars and the plots from a task

` from clearml.backend_api.session.client import APIClient
from clearml import Task

task = Task.get_task(project_name=xxxx, task.name=xxxx) #or task_id=xxxx
client = APIClient()

#retrieving the scalars
client.events.scalar_metrics_iter_histogram(task=task.id)

#retrieving the plots
client.events.get_task_plots(task=task.id) `

  
  
Posted 2 years ago