RyanDDD commited on
Commit
2c43bd1
·
verified ·
1 Parent(s): 6c9de9f

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. modeling_empathy.py +5 -3
modeling_empathy.py CHANGED
@@ -99,10 +99,11 @@ class BiEncoderAttentionWithRationaleClassification(nn.Module):
99
 
100
  self.apply(self._init_weights)
101
 
102
- # Load pretrained RoBERTa encoders
 
103
  roberta_config = RobertaConfig.from_pretrained("roberta-base")
104
- self.seeker_encoder = RobertaModel.from_pretrained("roberta-base", config=roberta_config)
105
- self.responder_encoder = RobertaModel.from_pretrained("roberta-base", config=roberta_config)
106
 
107
  def _init_weights(self, module):
108
  """Initialize the weights"""
@@ -212,6 +213,7 @@ class EmpathyModelConfig(PretrainedConfig):
212
  class EmpathyModel(PreTrainedModel):
213
  """HuggingFace wrapper for Empathy Model"""
214
  config_class = EmpathyModelConfig
 
215
 
216
  def __init__(self, config):
217
  super().__init__(config)
 
99
 
100
  self.apply(self._init_weights)
101
 
102
+ # Initialize RoBERTa encoders (will be loaded from saved weights)
103
+ # Don't use from_pretrained here to avoid overwriting trained weights
104
  roberta_config = RobertaConfig.from_pretrained("roberta-base")
105
+ self.seeker_encoder = RobertaModel(config=roberta_config)
106
+ self.responder_encoder = RobertaModel(config=roberta_config)
107
 
108
  def _init_weights(self, module):
109
  """Initialize the weights"""
 
213
  class EmpathyModel(PreTrainedModel):
214
  """HuggingFace wrapper for Empathy Model"""
215
  config_class = EmpathyModelConfig
216
+ base_model_prefix = "model" # Important: matches the saved state_dict structure
217
 
218
  def __init__(self, config):
219
  super().__init__(config)