Skip to content

Commit

Permalink
pass wandb api key explicitly in to_wandb app
Browse files Browse the repository at this point in the history
  • Loading branch information
svandenhaute committed Jul 22, 2024
1 parent e2c46c3 commit ebafef1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion psiflow/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,13 @@ def fix_plotly_layout(figure):
def _to_wandb(
wandb_id: str,
wandb_project: str,
wandb_api_key: str,
inputs: list = [],
) -> None:
import os

os.environ["WANDB_API_KEY"] = wandb_api_key
os.environ["WANDB_SILENT"] = "True"
import tempfile
import numpy as np
from pathlib import Path
Expand Down Expand Up @@ -289,7 +293,6 @@ def _to_wandb(
figure.update_layout(yaxis_title="<b>forces RMSE [meV/atom]</b>")
figure.update_layout(xaxis_title="<b>" + x_axis + "</b>")
figures[title] = figure
os.environ["WANDB_SILENT"] = "True"
path_wandb = Path(tempfile.mkdtemp())
wandb.init(id=wandb_id, dir=path_wandb, project=wandb_project, resume="allow")
wandb.log(figures)
Expand Down Expand Up @@ -530,5 +533,6 @@ def to_wandb(self):
return to_wandb(
self.wandb_id,
self.wandb_project,
os.environ['WANDB_API_KEY'],
inputs=[self.metrics],
)

0 comments on commit ebafef1

Please sign in to comment.