    def build_model(cls, cfg: Wav2Vec2ClassificationConfig, task: FairseqTask):
        """Build a new model instance."""
        w2v_encoder = Wav2VecEncoder(cfg, None)
        pooling_layer = get_pooling_layer(
            cfg,
            w2v_encoder.w2v_model.encoder.layers[-1].embedding_dim,
            len(task.target_dictionary),
            len(w2v_encoder.w2v_model.encoder.layers),
        )
        return cls(cfg, w2v_encoder, pooling_layer)
Build a new model instance.
fairseq/models/wav2vec/wav2vec2_classification.py