mxnet使用mxboard可视化模型权重参数报错:No handlers could be found for logger “mxboard.event_file_writer“
程序员文章站
2022-05-27 10:29:27
...
No handlers could be found for logger “mxboard.event_file_writer”
解决:
$ pip install tensorboard
在代码中加入:
import logging
logging.basicConfig(level=logging.DEBUG)
https://github.com/reminisce/mxboard-demo/blob/master/train_mnist.py
训练过程中的可视化
# visualize
from mxboard import SummaryWriter
import logging
logging.basicConfig(level=logging.DEBUG)
sw = SummaryWriter(logdir='./logs', flush_secs=5)
net = mfc1
argp,auxp = net.get_params()
grads = [i for i in argp.values()]
param_names = argp.keys()
assert len(grads) == len(param_names)
# logging the gradients of parameters for checking convergence
for i, name in enumerate(param_names):
sw.add_histogram(tag=name, values=grads[i], global_step=0, bins=10)