Training - 使用 WandB 配置 可视化 模型训练参数

欢迎关注我的CSDN:https://spike.blog.csdn.net/

本文地址:https://blog.csdn.net/caroline_wendy/article/details/137529140

WandB (Weights&Biases) 是轻量级的在线模型训练可视化工具,类似于 TensorBoard,可以帮助用户跟踪实验,记录运行中的超参数和输出指标,可视化结果,并且,共享这些结果。WandB 支持所有主流的深度学习框架,如 TensorFlow、PyTorch、Keras 等,提供了丰富的功能。使用 WandB,可以轻松地监控模型训练过程,通过云平台同步模型输出、日志和文件,便于远程监控和协作。

WandB 的自动化配置如下,在 sh 文件中,配置账号:

bash 复制代码
wandb online
wandb login [your api key]

API Key 位于 User settings - Danger Zone,即:

API Key 需要与 WANDB_ENTITY 成对使用。

启动 WandB 的命令,如下:

  • entity: WandB 的 UserName,需要与 API Key 配对。
  • project: 工程名称,用于存储名称
  • name:实验名称,用于区分不同的实验

即:

python 复制代码
os.environ['WANDB_ENTITY'] = "[your name]"

if args.wandb:
    logger.info(f"Initializing wandb! {os.environ['WANDB_ENTITY']}")
    wandb.init(
        entity=os.environ["WANDB_ENTITY"],
        settings=wandb.Settings(start_method="fork"),
        project="alphaflow",
        name=args.run_name,
        config=args,)

注意:同一个项目(Project),例如 alphaflow,结果才能进行比较。

WandB 的相关日志:

bash 复制代码
wandb: Currently logged in as: morndragon. Use `wandb login --relogin` to force relogin
wandb: wandb version 0.16.6 is available!  To upgrade, please run:
wandb:  $ pip install wandb --upgrade
wandb: Tracking run with wandb version 0.16.5
wandb: Run data is saved locally in wandb/run-20240408_161416-fl5dmx0d
wandb: Run `wandb offline` to turn off syncing.
wandb: Syncing run experiment-20240408
wandb: ⭐️ View project at https://wandb.ai/[your name]/alphaflow
wandb: 🚀 View run at https://wandb.ai/[your name]/alphaflow/runs/fl5dmx0d/workspace

WandB 页面展示:

Bug:wandb.errors.CommError: It appears that you do not have permission to access the requested resource.,即:

bash 复制代码
wandb: Currently logged in as: morndragon. Use `wandb login --relogin` to force relogin
wandb: ERROR Error while calling W&B API: permission denied (<Response [403]>)
Problem at: /nfs_beijing_ai/chenlong/workspace/alphaflow-by-chenlong/train.py 50 main
wandb: ERROR It appears that you do not have permission to access the requested resource. Please reach out to the project owner to grant you access. If you have the correct permissions, verify that there are no issues with your networking setup.(Error 403: Forbidden)
Traceback (most recent call last):
  File "train.py", line 177, in <module>
    main()
  File "train.py", line 50, in main
    wandb.init(
  File "miniconda3/envs/alphaflow/lib/python3.9/site-packages/wandb/sdk/wandb_init.py", line 1206, in init
    raise e
  File "miniconda3/envs/alphaflow/lib/python3.9/site-packages/wandb/sdk/wandb_init.py", line 1187, in init
    run = wi.init()
  File "miniconda3/envs/alphaflow/lib/python3.9/site-packages/wandb/sdk/wandb_init.py", line 786, in init
    raise error
wandb.errors.CommError: It appears that you do not have permission to access the requested resource. Please reach out to the project owner to grant you access. If you have the correct permissions, verify that there are no issues with your networking setup.(Error 403: Forbidden)

原因是 WandB 的登录名称 WANDB_ENTITY,与 API Key,不匹配,需要重新设置,即可。

python 复制代码
os.environ['WANDB_ENTITY'] = "[your name]"
相关推荐
贝格前端工场4 天前
新能源工厂的可视化碳中和实验:碳足迹追踪看板与能源调度策略仿真
大数据·能源·可视化
文浩(楠搏万)6 天前
TensorFlow+CNN垃圾分类深度学习全流程实战教程
深度学习·ai·cnn·tensorflow·卷积神经网络·模型训练·全流程指导
用什么都重名7 天前
Attu-Milvus向量数据库可视化工具
可视化·milvus·向量数据库·attu
AI_RSER8 天前
基于GEE与哨兵2号的土地覆盖分类方法及实现
机器学习·信息可视化·分类·sentinel·可视化·遥感·gee
xhload3d20 天前
智慧航天运载体系全生命周期监测 | 图扑数字孪生
物联网·3d·智慧城市·html5·webgl·数字孪生·可视化·工业互联网·三维建模·工控·航空航天·火箭升空·智慧航空·智慧航天·火箭发射·火箭回收
喝过期的拉菲23 天前
使用 Pytorch Lightning 时追踪指标和可视化指标
pytorch·可视化·lightning·指标追踪
钢琴上的汽车软件1 个月前
ARXML可视化转换工具使用说明
自动化·二次开发·可视化·转换·arxml
gis分享者2 个月前
学习threejs,交互式神经网络可视化
神经网络·可视化·threejs·filmpass·effectcomposer·unrealbloompass·outputpass
xhload3d2 个月前
图扑软件 | 带你体验 Low Poly 卡通三维世界
物联网·3d·智慧城市·html5·webgl·数字孪生·可视化·工业互联网·三维建模·工控·轻量化·中国风·卡通动画·写实风格·科技风·low poly
招风的黑耳2 个月前
可视化大屏通用模板Axure原型设计案例
axure·可视化