docstr: Log into tensorboard. Only by the master process.
docstr_tok: ["Log","into","tensorboard",".","Only","by","the","master","process","."]
code: def log_tensorboard(self):
      """
      Log into tensorboard. Only by the master process.
      """
      if not self.is_master:
          return
  
      for param_name, param in self.student.named_parameters():
          self.tensorboard.add_scalar(
              tag="parameter_mean/" + param_name,
              scalar_value=param.data.mean(),
              global_step=self.n_total_iter,
          )
          self.tensorboard.add_scalar(
              tag="parameter_std/" + param_name,
              scalar_value=param.data.std(),
              global_step=self.n_total_iter,
          )
          if param.grad is None:
              continue
          self.tensorboard.add_scalar(
              tag="grad_mean/" + param_name,
              scalar_value=param.grad.data.mean(),
              global_step=self.n_total_iter,
          )
          self.tensorboard.add_scalar(
              tag="grad_std/" + param_name,
              scalar_value=param.grad.data.std(),
              global_step=self.n_total_iter,
          )
  
      self.tensorboard.add_scalar(
          tag="losses/cum_avg_loss_epoch",
          scalar_value=self.total_loss_epoch / self.n_iter,
          global_step=self.n_total_iter,
      )
      self.tensorboard.add_scalar(
          tag="losses/loss",
          scalar_value=self.last_loss,
          global_step=self.n_total_iter,
      )
      self.tensorboard.add_scalar(
          tag="losses/loss_ce",
          scalar_value=self.last_loss_ce,
          global_step=self.n_total_iter,
      )
      if self.alpha_mlm > 0.0:
          self.tensorboard.add_scalar(
              tag="losses/loss_mlm",
              scalar_value=self.last_loss_mlm,
              global_step=self.n_total_iter,
          )
      if self.alpha_clm > 0.0:
          self.tensorboard.add_scalar(
              tag="losses/loss_clm",
              scalar_value=self.last_loss_clm,
              global_step=self.n_total_iter,
          )
      if self.alpha_mse > 0.0:
          self.tensorboard.add_scalar(
              tag="losses/loss_mse",
              scalar_value=self.last_loss_mse,
              global_step=self.n_total_iter,
          )
      if self.alpha_cos > 0.0:
          self.tensorboard.add_scalar(
              tag="losses/loss_cos",
              scalar_value=self.last_loss_cos,
              global_step=self.n_total_iter,
          )
      self.tensorboard.add_scalar(
          tag="learning_rate/lr",
          scalar_value=self.scheduler.get_lr()[0],
          global_step=self.n_total_iter,
      )
  
      self.tensorboard.add_scalar(
          tag="global/memory_usage",
          scalar_value=psutil.virtual_memory()._asdict()["used"]
          / 1_000_000,
          global_step=self.n_total_iter,
      )
      self.tensorboard.add_scalar(
          tag="global/speed",
          scalar_value=time.time() - self.last_log,
          global_step=self.n_total_iter,
      )
  
imports: import math
  import os
  import time
  import psutil
  import torch
  from grouped_batch_sampler import GroupedBatchSampler, create_lengths_groups
  from lm_seqs_dataset import LmSeqsDataset
  from torch import nn
  from torch.optim import AdamW
  from torch.utils.data import BatchSampler, DataLoader, RandomSampler
  from torch.utils.data.distributed import DistributedSampler
  from tqdm import tqdm
  from transformers import get_linear_schedule_with_warmup
  from utils import logger
label_desc: Use image node_id 9 for calling the Distiller obj's underlying member method code with example usage: obj.log_tensorboard() without return types