Spaces:
Paused
Paused
Add wandb api key
Browse files
opendashboards/assets/io.py
CHANGED
|
@@ -12,7 +12,7 @@ print(f'BASE_DIR = {BASE_DIR}')
|
|
| 12 |
def load_runs(project, filters, min_steps=10):
|
| 13 |
runs = []
|
| 14 |
msg = st.empty()
|
| 15 |
-
for run in utils.get_runs(project, filters):
|
| 16 |
step = run.summary.get('_step',0)
|
| 17 |
if step < min_steps:
|
| 18 |
msg.warning(f'Skipped run `{run.name}` because it contains {step} events (<{min_steps})')
|
|
|
|
| 12 |
def load_runs(project, filters, min_steps=10):
|
| 13 |
runs = []
|
| 14 |
msg = st.empty()
|
| 15 |
+
for run in utils.get_runs(project, filters, api_key=st.secrets['WANDB_API_KEY']):
|
| 16 |
step = run.summary.get('_step',0)
|
| 17 |
if step < min_steps:
|
| 18 |
msg.warning(f'Skipped run `{run.name}` because it contains {step} events (<{min_steps})')
|
opendashboards/utils/utils.py
CHANGED
|
@@ -24,7 +24,7 @@ from pandas.api.types import is_list_like
|
|
| 24 |
from typing import List, Dict, Any, Union
|
| 25 |
|
| 26 |
|
| 27 |
-
def get_runs(project: str = "openvalidators", filters: Dict[str, Any] = None, return_paths: bool = False) -> List:
|
| 28 |
"""Download runs from wandb.
|
| 29 |
|
| 30 |
Args:
|
|
@@ -35,7 +35,7 @@ def get_runs(project: str = "openvalidators", filters: Dict[str, Any] = None, re
|
|
| 35 |
Returns:
|
| 36 |
List[wandb.apis.public.Run]: List of runs or run paths (List[str]).
|
| 37 |
"""
|
| 38 |
-
api = wandb.Api()
|
| 39 |
wandb.login(anonymous="allow")
|
| 40 |
|
| 41 |
runs = api.runs(project, filters=filters)
|
|
@@ -45,7 +45,7 @@ def get_runs(project: str = "openvalidators", filters: Dict[str, Any] = None, re
|
|
| 45 |
return runs
|
| 46 |
|
| 47 |
|
| 48 |
-
def download_data(run_path: Union[str, List] = None, timeout: float = 600) -> pd.DataFrame:
|
| 49 |
"""Download data from wandb.
|
| 50 |
|
| 51 |
Args:
|
|
@@ -55,7 +55,7 @@ def download_data(run_path: Union[str, List] = None, timeout: float = 600) -> pd
|
|
| 55 |
Returns:
|
| 56 |
pd.DataFrame: Dataframe of event log.
|
| 57 |
"""
|
| 58 |
-
api = wandb.Api(timeout=timeout)
|
| 59 |
wandb.login(anonymous="allow")
|
| 60 |
|
| 61 |
if isinstance(run_path, str):
|
|
|
|
| 24 |
from typing import List, Dict, Any, Union
|
| 25 |
|
| 26 |
|
| 27 |
+
def get_runs(project: str = "openvalidators", filters: Dict[str, Any] = None, return_paths: bool = False, api_key: str = None) -> List:
|
| 28 |
"""Download runs from wandb.
|
| 29 |
|
| 30 |
Args:
|
|
|
|
| 35 |
Returns:
|
| 36 |
List[wandb.apis.public.Run]: List of runs or run paths (List[str]).
|
| 37 |
"""
|
| 38 |
+
api = wandb.Api(api_key=api_key)
|
| 39 |
wandb.login(anonymous="allow")
|
| 40 |
|
| 41 |
runs = api.runs(project, filters=filters)
|
|
|
|
| 45 |
return runs
|
| 46 |
|
| 47 |
|
| 48 |
+
def download_data(run_path: Union[str, List] = None, timeout: float = 600, api_key: str = None) -> pd.DataFrame:
|
| 49 |
"""Download data from wandb.
|
| 50 |
|
| 51 |
Args:
|
|
|
|
| 55 |
Returns:
|
| 56 |
pd.DataFrame: Dataframe of event log.
|
| 57 |
"""
|
| 58 |
+
api = wandb.Api(api_key=api_key, timeout=timeout)
|
| 59 |
wandb.login(anonymous="allow")
|
| 60 |
|
| 61 |
if isinstance(run_path, str):
|