    def build_model(cls, args, task):
        """Build a new model instance."""
        # make sure all arguments are present in older models
        base_lm_architecture(args)

        if args.decoder_layers_to_keep:
            args.decoder_layers = len(args.decoder_layers_to_keep.split(","))

        if args.decoder_cross_layers < 0:
            args.decoder_cross_layers = args.decoder_layers

        if getattr(args, "max_target_positions", None) is None:
            args.max_target_positions = getattr(
                args, "tokens_per_sample", DEFAULT_MAX_TARGET_POSITIONS
            )

        # Assert all dictionary to be the same
        assert all(
            task.source_dictionaries[channel] == task.source_dictionary
            for channel in task.channels
        ), "Source dictionaries of all channels are expected to be the same!!!"
        assert all(
            task.target_dictionaries[channel] == task.target_dictionary
            for channel in task.channels
        ), "Target dictionaries of all channels are expected to be the same!!!"
        # Build the unit embeddings
        embed_tokens = cls.build_embedding(
            args, task.source_dictionary, args.decoder_input_dim
        )

        decoder = CrossChannelTransformerDecoder(
            args,
            task.target_dictionary,
            embed_tokens,
            channels=task.channels,
            no_encoder_attn=True,
        )
        return cls(decoder)
Build a new model instance.
fairseq/models/speech_dlm/speech_dlm.py