code: def __init__(self, config: DPRConfig):
      super().__init__(config)
      self.bert_model = BertModel(config, add_pooling_layer=False)
      if self.bert_model.config.hidden_size <= 0:
          raise ValueError("Encoder hidden_size can't be zero")
      self.projection_dim = config.projection_dim
      if self.projection_dim > 0:
          self.encode_proj = nn.Linear(
              self.bert_model.config.hidden_size, config.projection_dim
          )
      # Initialize weights and apply final processing
      self.post_init()
  
imports: from dataclasses import dataclass
  from typing import Optional, Tuple, Union
  import torch
  from torch import Tensor, nn
  from ...modeling_outputs import BaseModelOutputWithPooling
  from ...modeling_utils import PreTrainedModel
  from ...utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from ..bert.modeling_bert import BertEncoder, BertModel
  from .configuration_dpr import DPRConfig
label_desc: Use image node_id 1 to create a new DPREncoder object from inherited base classes: DPRPreTrainedModel with example: obj = DPREncoder(config)