Update modeling_sim.py
Browse files- modeling_sim.py +14 -0
modeling_sim.py
CHANGED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from torch import nn
|
3 |
+
from transformers import MobileBert
|
4 |
+
|
5 |
+
class SimModel(PreTrainedModel):
|
6 |
+
def __init__(self, config):
|
7 |
+
super().__init__(config)
|
8 |
+
self.config = config
|
9 |
+
self.encoder = MobileBert(config)
|
10 |
+
# Initialize weights and apply final processing
|
11 |
+
self.post_init()
|
12 |
+
|
13 |
+
def forward(self, **input_args):
|
14 |
+
return self.t5_encoder(**input_args).last_hidden_state
|