allennlp/training/tensorboard_writer.py
def log_learning_rates(self, model: Model, optimizer: torch.optim.Optimizer):
        """
        Send current parameter specific learning rates to tensorboard
        """
        if self._should_log_learning_rate:
            # optimizer stores lr info keyed by parameter tensor
            # we want to log with parameter name
            names = {param: name for name, param in model.named_parameters()}
            for group in optimizer.param_groups:
                if "lr" not in group:
                    continue
                rate = group["lr"]
                for param in group["params"]:
                    # check whether params has requires grad or not
                    effective_rate = rate * float(param.requires_grad)
                    self.add_train_scalar("learning_rate/" + names[param], effective_rate)

        Send current parameter specific learning rates to tensorboard
        
Send current parameter specific learning rates to tensorboard
Send current parameter specific learning rates to tensorboard
def log_learning_rates(self, model: Model, optimizer: torch.optim.Optimizer):
        if self._should_log_learning_rate:
            names = {param: name for name, param in model.named_parameters()}
            for group in optimizer.param_groups:
                if "lr" not in group:
                    continue
                rate = group["lr"]
                for param in group["params"]:
                    effective_rate = rate * float(param.requires_grad)
                    self.add_train_scalar("learning_rate/" + names[param], effective_rate)
def log_learning_rates ( self , model : Model , optimizer : torch . optim . Optimizer ) : if self . _should_log_learning_rate : names = { param : name for name , param in model . named_parameters ( ) } for group in optimizer . param_groups : if "lr" not in group : continue rate = group [ "lr" ] for param in group [ "params" ] : effective_rate = rate * float ( param . requires_grad ) self . add_train_scalar ( "learning_rate/" + names [ param ] , effective_rate )
Send current parameter specific learning rates to tensorboard
Send current parameter specific learning rates to tensorboard
"""
        Send current parameter specific learning rates to tensorboard
        """ # optimizer stores lr info keyed by parameter tensor # we want to log with parameter name # check whether params has requires grad or not
self
model
Model
optimizer
torch.optim.Optimizer