    def setup_dictionary(cls, args, **kwargs):
        """The dictionaries will be a dict over channel keys and values of type
        ~fairseq.data.Dictionary.
        """
        paths = utils.split_paths(args.data)
        assert len(paths) > 0
        data_path = paths[0]

        dicts = None
        output_dicts = None
        if args.channels is None:
            sorted_channels = sorted(
                name[5:-4]
                for name in os.listdir(data_path)
                if name[:5] == "dict." and name[-4:] == ".txt"
            )
        else:
            sorted_channels = sorted(args.channels.split(","))
        logger.info("channels: {}".format(sorted_channels))
        # load dictionaries
        dicts = OrderedDict()
        output_dicts = OrderedDict()
        for channel in sorted_channels:
            dictionary = Dictionary.load(
                os.path.join(data_path, "dict.{}.txt".format(channel))
            )
            logger.info("[{}] dictionary: {} types".format(channel, len(dictionary)))
            output_dictionary = dictionary
            if args.output_dictionary_size >= 0:
                output_dictionary = TruncatedDictionary(
                    dictionary, args.output_dictionary_size
                )
            dicts[channel] = dictionary
            output_dicts[channel] = output_dictionary
            if len(dicts) > 0:
                assert dicts[channel].pad() == dicts[sorted_channels[0]].pad()
                assert dicts[channel].bos() == dicts[sorted_channels[0]].bos()
                assert dicts[channel].eos() == dicts[sorted_channels[0]].eos()
                assert dicts[channel].unk() == dicts[sorted_channels[0]].unk()
        return (dicts, output_dicts)
The dictionaries will be a dict over channel keys and values of type
~fairseq.data.Dictionary.
fairseq/tasks/speech_dlm_task.py