code: def test_bias_dist_processor(self):
      vocab_size = 5
      batch_size = 2
  
      input_ids = torch.tensor(
          [[0, 1, 3, 1], [0, 1, 0, 1]],
          device=torch_device,
          dtype=torch.long,
      )
      positive_bias = {(1,): 100.0, (4,): 100.0}
      negative_bias = {
          (1, 0): -100.0,
          (0, 1, 2): -100.0,
          (1, 3, 1, 3): -100.0,
      }
      # biases the same termination twice, to ensure we can handle overlapping terminations (it won't have an effect
      # on the test cases, though)
      negative_bias.update({(1, 3, 1, 3, 1, 3): -100.0})
      sequence_bias = {**positive_bias, **negative_bias}
  
      # scores = 0 to facilitate checks
      scores = torch.zeros(
          (batch_size, vocab_size),
          dtype=torch.float,
          device=torch_device,
      )
  
      bias_dist_proc = SequenceBiasLogitsProcessor(
          sequence_bias=sequence_bias
      )
      filtered_scores = bias_dist_proc(input_ids, scores.clone())
  
      # batch 1: positive bias: tokens (1, 4); negative bias: tokens (0, 3); neutral: tokens (2)
      # batch 2: positive bias: tokens (1, 4); negative bias: tokens (0, 2); neutral: tokens (3)
      self.assertListEqual(
          filtered_scores.tolist(),
          [
              [-100.0, 100.0, 0.0, -100.0, 100.0],
              [-100.0, 100.0, -100.0, 0.0, 100.0],
          ],
      )
  
imports: import unittest
  from typing import List, Union
  from parameterized import parameterized
  from transformers import is_torch_available
  from transformers.testing_utils import require_torch, torch_device
  from ..test_modeling_common import ids_tensor
label_desc: Use image node_id 15 for calling the LogitsProcessorTest obj's underlying member method code with example usage: obj.test_bias_dist_processor() without return types