class_docstr: Test the PipelineHelper class.
class_docstr_tok: ["Test","the","PipelineHelper","class","."]
code: def test_model_parallel_exempt(self):
      # Test that we ignore module lists explicitly marked as exempt.
      def _get_model():
          model = torch.nn.Module()
          model.layers = torch.nn.ModuleList(
              [IdentityLayer() for _ in range(8)]
          )
          return model
  
      def _exempt_mp(submodule):
          submodule.model_parallel_exempt = True
  
      pipeline = PipelineHelper()
      pipeline.num_devices = 8
      pipeline.devices = [f"cuda:{i}" for i in range(8)]
      pipeline._PipelineHelper__device_allocations = {
          d: 0 for d in pipeline.devices
      }
  
      model1 = _get_model()
      model1 = pipeline.make_parallel(model1)
      assert getattr(model1.layers, "is_model_parallel", False)
  
      model2 = _get_model()
      model2.apply(_exempt_mp)
      model2 = pipeline.make_parallel(model2)
      assert not getattr(model2.layers, "is_model_parallel", False)
  
imports: import torch
  import numpy
  import unittest
  from parlai.utils.torch import padded_tensor, argsort, PipelineHelper, neginf, IdentityLayer, trainable_parameters, total_parameters
label_desc: Use image node_id 13 for calling the TestPipelineHelper obj's underlying member method code with example usage: obj.test_model_parallel_exempt() and returns: model