class_docstr: Router using tokens choose top-1 experts assignment.
  
  This router uses the same mechanism as in Switch Transformer (https://arxiv.org/abs/2101.03961) and V-MoE
  (https://arxiv.org/abs/2106.05974): tokens choose their top experts. Items are sorted by router_probs and then
  routed to their choice of expert until the expert's expert_capacity is reached. **There is no guarantee that each
  token is processed by an expert**, or that each expert receives at least one token.
class_docstr_tok: ["Router","using","tokens","choose","top-1","experts","assignment",".","This","router","uses","the","same","mechanism","as","in","Switch","Transformer","(","https",":","\/\/arxiv.org\/abs\/2101.03961",")","and","V-MoE","(","https",":","\/\/arxiv.org\/abs\/2106.05974",")",":","tokens","choose","their","top","experts",".","Items","are","sorted","by","router_probs","and","then","routed","to","their","choice","of","expert","until","the","expert","'s","expert_capacity","is","reached",".","*","*","There","is","no","guarantee","that","each","token","is","processed","by","an","expert","*","*",",","or","that","each","expert","receives","at","least","one","token","."]
docstr: `bitsandbytes` `Linear8bitLt` layers does not support manual casting Therefore we need to check if they are an
  instance of the `Linear8bitLt` class by checking special attributes.
docstr_tok: ["`","bitsandbytes","`","`","Linear8bitLt","`","layers","does","not","support","manual","casting","Therefore","we","need","to","check","if","they","are","an","instance","of","the","`","Linear8bitLt","`","class","by","checking","special","attributes","."]
code: def _cast_classifier(self):
      r"""
      `bitsandbytes` `Linear8bitLt` layers does not support manual casting Therefore we need to check if they are an
      instance of the `Linear8bitLt` class by checking special attributes.
      """
      if not (
          hasattr(self.classifier, "SCB")
          or hasattr(self.classifier, "CB")
      ):
          self.classifier = self.classifier.to(self.dtype)
  
imports: import copy
  from typing import List, Optional, Tuple, Union
  import torch
  import torch.nn
  from ...activations import ACT2FN
  from ...modeling_outputs import MoECausalLMOutputWithPast, MoEModelOutputWithPastAndCrossAttentions
  from ...modeling_utils import PreTrainedModel
  from ...utils import DUMMY_INPUTS, DUMMY_MASK, add_start_docstrings, add_start_docstrings_to_model_forward, is_torch_fx_proxy, logging
  from .configuration_gptsan_japanese import GPTSanJapaneseConfig
label_desc: Use image node_id 3 for calling the GPTSanJapaneseTop1Router obj's underlying member method code with example usage: obj._cast_classifier() without return types