File size: 609 Bytes
9c6750a
 
6045345
 
a1da39c
6045345
a1da39c
 
 
 
 
 
 
 
 
 
 
6045345
a1da39c
f4df266
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Module for wandb utilities"""

import os

from axolotl.utils.dict import DictDefault


def setup_wandb_env_vars(cfg: DictDefault):
    for key in cfg.keys():
        if key.startswith("wandb_"):
            value = cfg.get(key, "")

            if value and isinstance(value, str) and len(value) > 0:
                os.environ[key.upper()] = value

    # Enable wandb if project name is present
    if cfg.wandb_project and len(cfg.wandb_project) > 0:
        cfg.use_wandb = True
        os.environ.pop("WANDB_DISABLED", None)  # Remove if present
    else:
        os.environ["WANDB_DISABLED"] = "true"