from transformers import MPNetConfig, MPNetModel def build_text_encoder(config): if config.model_type == "mpnet": fields = config.to_dict() fields.pop("model_type", None) return MPNetModel(MPNetConfig(**fields)) else: raise NotImplementedError(f"Unsupported text model_type: {config.model_type}")