Skip to content

Is there a way to plot the histogram of the gradients ? #1644

Closed Answered by TrayfourYu
TrayfourYu asked this question in Q&A
Discussion options

You must be logged in to vote

I think i figure it out. Just customlize a new DistributedDataParallell class override from MMDistributedDataParallel and Visualizer is available though get_current_instance(). Then use the add_histogram of the TensorboardVisBackend.

from typing import Any, Dict, Union
import torch
from mmengine.optim import OptimWrapper
from mmengine.registry import MODEL_WRAPPERS
from mmengine.model.utils import detect_anomalous_params
from mmengine.visualization import Visualizer
from mmengine.logging import MMLogger
from mmengine.model.wrappers.distributed import MMDistributedDataParallel
import numpy as np

@MODEL_WRAPPERS.register_module()
class CustomDistributedDataParallel(MMDistributedDataParalle…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by TrayfourYu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant