yairschiff
commited on
Commit
•
63caf5b
1
Parent(s):
737d4a1
Update modeling_caduceus.py
Browse filesFix sequence classifier init
- modeling_caduceus.py +6 -0
modeling_caduceus.py
CHANGED
@@ -497,6 +497,12 @@ class CaduceusForSequenceClassification(CaduceusPreTrainedModel):
|
|
497 |
|
498 |
# Initialize weights and apply final processing
|
499 |
self.post_init()
|
|
|
|
|
|
|
|
|
|
|
|
|
500 |
|
501 |
def get_input_embeddings(self):
|
502 |
return self.caduceus.backbone.embeddings.word_embeddings
|
|
|
497 |
|
498 |
# Initialize weights and apply final processing
|
499 |
self.post_init()
|
500 |
+
self.init_scorer()
|
501 |
+
|
502 |
+
def init_scorer(self, initializer_range=0.02):
|
503 |
+
initializer_range = self.config.initializer_cfg.get("initializer_range", initializer_range) \
|
504 |
+
if self.config.initializer_cfg is not None else initializer_range
|
505 |
+
self.score.weight.data.normal_(std=initializer_range)
|
506 |
|
507 |
def get_input_embeddings(self):
|
508 |
return self.caduceus.backbone.embeddings.word_embeddings
|