class_docstr: Implementation of assisted Knowledge distillation from the paper "Improved Knowledge
  Distillation via Teacher Assistant" https://arxiv.org/pdf/1902.03393.pdf
  
  :param teacher_model (torch.nn.Module): Teacher model
  :param assistant_models (list or tuple): Assistant models
  :param student_model (torch.nn.Module): Student model
  :param assistant_train_order (list or tuple or array): Order of training for that assistant
  :param train_loader (torch.utils.data.DataLoader): Dataloader for training
  :param val_loader (torch.utils.data.DataLoader): Dataloader for validation/testing
  :param optimizer_teacher (torch.optim.*): Optimizer used for training teacher
  :param optimizer_assistants (torch.optim.*): Optimizer used for training assistants
  :param optimizer_student (torch.optim.*): Optimizer used for training student
  :param loss_fn (torch.nn.Module):  Calculates loss during distillation
  :param temp (float): Temperature parameter for distillation
  :param distil_weight (float): Weight paramter for distillation loss
  :param device (str): Device used for training; 'cpu' for cpu and 'cuda' for gpu
  :param log (bool): True if logging required
  :param logdir (str): Directory for storing logs
class_docstr_tok: ["Implementation","of","assisted","Knowledge","distillation","from","the","paper","``","Improved","Knowledge","Distillation","via","Teacher","Assistant","''","https",":","\/\/arxiv.org\/pdf\/1902.03393.pdf",":","param","teacher_model","(","torch.nn.Module",")",":","Teacher","model",":","param","assistant_models","(","list","or","tuple",")",":","Assistant","models",":","param","student_model","(","torch.nn.Module",")",":","Student","model",":","param","assistant_train_order","(","list","or","tuple","or","array",")",":","Order","of","training","for","that","assistant",":","param","train_loader","(","torch.utils.data.DataLoader",")",":","Dataloader","for","training",":","param","val_loader","(","torch.utils.data.DataLoader",")",":","Dataloader","for","validation\/testing",":","param","optimizer_teacher","(","torch.optim",".","*",")",":","Optimizer","used","for","training","teacher",":","param","optimizer_assistants","(","torch.optim",".","*",")",":","Optimizer","used","for","training","assistants",":","param","optimizer_student","(","torch.optim",".","*",")",":","Optimizer","used","for","training","student",":","param","loss_fn","(","torch.nn.Module",")",":","Calculates","loss","during","distillation",":","param","temp","(","float",")",":","Temperature","parameter","for","distillation",":","param","distil_weight","(","float",")",":","Weight","paramter","for","distillation","loss",":","param","device","(","str",")",":","Device","used","for","training",";","'cpu","'","for","cpu","and","'cuda","'","for","gpu",":","param","log","(","bool",")",":","True","if","logging","required",":","param","logdir","(","str",")",":","Directory","for","storing","logs"]
docstr: Function used for training assistants
  
  :param epochs (int): Number of epochs to train
  :param plot_losses (bool): True if the loss curves need to be plotted
  :param save_model (bool): True if the model needs to be saved
  :param save_dir (str): Path used for storing the trained asssistant models
docstr_tok: ["Function","used","for","training","assistants",":","param","epochs","(","int",")",":","Number","of","epochs","to","train",":","param","plot_losses","(","bool",")",":","True","if","the","loss","curves","need","to","be","plotted",":","param","save_model","(","bool",")",":","True","if","the","model","needs","to","be","saved",":","param","save_dir","(","str",")",":","Path","used","for","storing","the","trained","asssistant","models"]
code: def train_assistants(
      self,
      epochs=20,
      plot_losses=True,
      save_model=True,
      save_dir="./models/",
  ):
      """
      Function used for training assistants
  
      :param epochs (int): Number of epochs to train
      :param plot_losses (bool): True if the loss curves need to be plotted
      :param save_model (bool): True if the model needs to be saved
      :param save_dir (str): Path used for storing the trained asssistant models
      """
  
      count = 0
      for assistant in self.assistant_models:
          trainers = []
          train_order = self.assistant_train_order[count]
          for elem in train_order:
              if elem == -1:
                  trainers.append(self.teacher_model)
  
              else:
                  trainers.append(self.assistant_models[elem])
  
          self.train_distil_model(
              trainers,
              assistant,
              self.optimizer_assistants[count],
              epochs,
              plot_losses,
              save_model,
              save_dir + "assistant_" + str(count) + ".pt",
          )
          count += 1
  
file_path: KD_Lib/KD_Lib/KD/vision/TAKD/takd.py
imports: from copy import deepcopy
  import matplotlib.pyplot
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  from KD_Lib.KD.common import BaseClass
label_desc: Use image node_id 4 for calling the TAKD obj's underlying member method code with example usage: obj.train_assistants(epochs, plot_losses, save_model, save_dir) without return types