docstr: Set beam size for efficient beamable enc-dec attention.
docstr_tok: ["Set","beam","size","for","efficient","beamable","enc-dec","attention","."]
code: def set_beam_size(self, beam):
      """Set beam size for efficient beamable enc-dec attention."""
      beamable = False
      for layer in self.decoder.layers:
          if layer.encoder_attn is not None:
              if hasattr(layer.encoder_attn, "set_beam_size"):
                  layer.encoder_attn.set_beam_size(beam)
                  beamable = True
      if beamable:
          self.encoder.reorder_encoder_out = (
              self.encoder._reorder_encoder_out
          )
  
imports: import logging
  from typing import Optional
  import torch
  import torch.nn
  from fairseq import utils
  from fairseq.models import register_model, register_model_architecture
  from fairseq.models.transformer import TransformerModel
  from fairseq.models.bart import BARTHubInterface, BARTModel
  from .ls_transformer import LSTransformerModel
label_desc: Use image node_id 10 for calling the LSBARTModel obj's underlying member method code with example usage: obj.set_beam_size(beam) without return types