code: def inference_no_head(self):
      model = NllbMoeModel.from_pretrained(
          "hf-internal-testing/random-nllb-moe-2-experts"
      ).eval()
      with torch.no_grad():
          output = model(**self.model_inputs)
          # fmt: off
          EXPECTED_ENCODER_STATE = torch.Tensor([ 0.3920, -0.1974, -0.0279,  0.3463, -0.8306, -1.0629, -0.4643,  2.0563, 1.1123,  0.3566, -0.9291, -0.3840, -0.2527, -0.9858,  1.5185, -1.1346, 0.0323, -0.9103, -0.3647, -0.4462, -0.9720, -0.3541,  0.1777, -0.4647, 1.6970, -0.9062,  0.2727, -1.0737,  0.8785,  0.4324])
          EXPECTED_DECODER_STATE = torch.Tensor([-6.0425e-02, -2.0015e-01,  6.0575e-02, -8.6366e-01, -1.1310e+00, 6.8369e-01,  7.5615e-01,  7.3555e-01,  2.3071e-01,  1.5954e+00, -7.0728e-01, -2.2647e-01, -1.3292e+00,  4.8246e-01, -6.9153e-01, -1.8199e-02, -7.3664e-01,  1.5902e-03,  1.0760e-01,  1.0298e-01, -9.3933e-01, -4.6567e-01,  8.0417e-01,  1.5243e+00,  5.5844e-01, -9.9239e-02,  1.4885e+00,  7.1527e-02, -5.2612e-01,  9.4435e-02])
      # fmt: on
  
      torch.testing.assert_allclose(
          output.encoder_last_hidden_state[1, 0, :30],
          EXPECTED_ENCODER_STATE,
          rtol=6e-3,
          atol=9e-3,
      )
      torch.testing.assert_allclose(
          output.last_hidden_state[1, 0, :30],
          EXPECTED_DECODER_STATE,
          rtol=6e-3,
          atol=9e-3,
      )
  
imports: import copy
  import tempfile
  import unittest
  from transformers import NllbMoeConfig, is_torch_available, set_seed
  from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, require_torch_fp16, slow, torch_device
  from transformers.utils import cached_property
  from ...generation.test_utils import GenerationTesterMixin
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_common import ModelTesterMixin, ids_tensor
  from ...test_pipeline_mixin import PipelineTesterMixin
label_desc: Use image node_id 4 for calling the NllbMoeModelIntegrationTests obj's underlying member method code with example usage: obj.inference_no_head() without return types