Spaces:
Paused
Paused
Fix paths
Browse files
opendashboards/assets/io.py
CHANGED
@@ -5,8 +5,6 @@ import streamlit as st
|
|
5 |
|
6 |
import opendashboards.utils.utils as utils
|
7 |
|
8 |
-
BASE_DIR = '.'#os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
9 |
-
print(f'BASE_DIR = {BASE_DIR}')
|
10 |
|
11 |
@st.cache_data
|
12 |
def load_runs(project, filters, min_steps=10):
|
@@ -49,17 +47,19 @@ def load_data(selected_runs, load=True, save=False):
|
|
49 |
|
50 |
frames = []
|
51 |
n_events = 0
|
|
|
52 |
progress = st.progress(0, 'Loading data')
|
53 |
info = st.empty()
|
|
|
|
|
54 |
for i, idx in enumerate(selected_runs.index):
|
55 |
run = selected_runs.loc[idx]
|
56 |
-
prog_msg = f'Loading data {i/len(selected_runs)*100:.0f}% ({
|
57 |
|
58 |
-
|
59 |
-
file_path = os.path.join(BASE_DIR,rel_path)
|
60 |
|
61 |
if load and os.path.exists(file_path):
|
62 |
-
progress.progress(i/len(selected_runs),f'{prog_msg}... **reading** `{
|
63 |
try:
|
64 |
df = utils.load_data(file_path)
|
65 |
except Exception as e:
|
@@ -71,9 +71,8 @@ def load_data(selected_runs, load=True, save=False):
|
|
71 |
try:
|
72 |
# Download the history from wandb
|
73 |
df = utils.download_data(run.path)
|
|
|
74 |
df.assign(**run.to_dict())
|
75 |
-
if not os.path.exists('data/'):
|
76 |
-
os.makedirs(file_path)
|
77 |
|
78 |
if save and run.state != 'running':
|
79 |
df.to_csv(file_path, index=False)
|
@@ -85,6 +84,7 @@ def load_data(selected_runs, load=True, save=False):
|
|
85 |
|
86 |
frames.append(df)
|
87 |
n_events += df.shape[0]
|
|
|
88 |
|
89 |
progress.empty()
|
90 |
if not frames:
|
|
|
5 |
|
6 |
import opendashboards.utils.utils as utils
|
7 |
|
|
|
|
|
8 |
|
9 |
@st.cache_data
|
10 |
def load_runs(project, filters, min_steps=10):
|
|
|
47 |
|
48 |
frames = []
|
49 |
n_events = 0
|
50 |
+
successful = 0
|
51 |
progress = st.progress(0, 'Loading data')
|
52 |
info = st.empty()
|
53 |
+
if not os.path.exists('data/'):
|
54 |
+
os.makedirs(file_path)
|
55 |
for i, idx in enumerate(selected_runs.index):
|
56 |
run = selected_runs.loc[idx]
|
57 |
+
prog_msg = f'Loading data {i/len(selected_runs)*100:.0f}% ({successful}/{len(selected_runs)} runs, {n_events} events)'
|
58 |
|
59 |
+
file_path = os.path.join('data',f'history-{run.id}.csv')
|
|
|
60 |
|
61 |
if load and os.path.exists(file_path):
|
62 |
+
progress.progress(i/len(selected_runs),f'{prog_msg}... **reading** `{file_path}`')
|
63 |
try:
|
64 |
df = utils.load_data(file_path)
|
65 |
except Exception as e:
|
|
|
71 |
try:
|
72 |
# Download the history from wandb
|
73 |
df = utils.download_data(run.path)
|
74 |
+
# Add metadata to the dataframe
|
75 |
df.assign(**run.to_dict())
|
|
|
|
|
76 |
|
77 |
if save and run.state != 'running':
|
78 |
df.to_csv(file_path, index=False)
|
|
|
84 |
|
85 |
frames.append(df)
|
86 |
n_events += df.shape[0]
|
87 |
+
successful += 1
|
88 |
|
89 |
progress.empty()
|
90 |
if not frames:
|