如何在使用transformers.Trainer时关闭wandb

诸神缄默不语-个人CSDN博文目录

transformers.Trainer的好用和难调是二位一体的。
不知道是什么天才想的非要在Trainer里面内置wandb,可能是wandb的销售吧。就是说wandb这种东西有时候确实好用,但是很多时候我不需要啊!
本文就是基于这种需求而产生的。

1. 在Python代码中设置路径

在代码最前面写:

import os
os.environ["WANDB_DISABLED"]="true"

这样做的缺点是会报警告信息:

Using the `WANDB_DISABLED` environment variable is deprecated and will be removed in v5. Use the --report_to flag to control the integrations used for logging resul
t (for instance --report_to none).

2. 在TrainingArguments中设置入参

在TrainingArguments的入参中设置report_to="none"(事实上这也是第一种方法警告信息中推荐的方案)

本文撰写过程中使用到的参考资料

  1. How to turn WanDB off in trainer? - Beginners - Hugging Face Forums

猜你喜欢

转载自blog.csdn.net/PolarisRisingWar/article/details/132091055
今日推荐