class_docstr: An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
  models.
class_docstr_tok: ["An","abstract","class","to","handle","weights","initialization","and","a","simple","interface","for","downloading","and","loading","pretrained","models","."]
code: def _shift_right(self, input_ids):
      decoder_start_token_id = self.config.decoder_start_token_id
      pad_token_id = self.config.pad_token_id
  
      assert decoder_start_token_id is not None, (
          "self.model.config.decoder_start_token_id has to be defined. In T5 it is usually set to the pad_token_id."
          " See T5 docs for more information"
      )
  
      # shift inputs to the right
      if is_torch_fx_proxy(input_ids):
          # Item assignment is not supported natively for proxies.
          shifted_input_ids = torch.full(
              input_ids.shape[:-1] + (1,), decoder_start_token_id
          )
          shifted_input_ids = torch.cat(
              [shifted_input_ids, input_ids[..., :-1]], dim=-1
          )
      else:
          shifted_input_ids = input_ids.new_zeros(input_ids.shape)
          shifted_input_ids[..., 1:] = input_ids[..., :-1].clone()
          shifted_input_ids[..., 0] = decoder_start_token_id
  
      assert (
          pad_token_id is not None
      ), "self.model.config.pad_token_id has to be defined."
      # replace possible -100 values in labels by `pad_token_id`
      shifted_input_ids.masked_fill_(
          shifted_input_ids == -100, pad_token_id
      )
  
      return shifted_input_ids
  
imports: import copy
  import math
  import warnings
  from typing import Optional, Tuple, Union
  from loguru import logger
  import torch
  import torch.distributed
  from torch import nn
  from torch.nn import CrossEntropyLoss
  from transformers.activations import ACT2FN
  from transformers.modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput
  from transformers.modeling_utils import PreTrainedModel
  from transformers.pytorch_utils import ALL_LAYERNORM_LAYERS
  from transformers.utils import is_torch_fx_proxy
  from transformers import T5Config
  from text_generation_server.utils.layers import TensorParallelColumnLinear, TensorParallelEmbedding, TensorParallelRowLinear, TensorParallelHead
label_desc: Use image node_id 1 for calling the T5PreTrainedModel obj's underlying member method code with example usage: obj._shift_right(input_ids) and returns: shifted_input_ids