Spaces:
Runtime error
Runtime error
RayCappola
commited on
Commit
•
7226095
1
Parent(s):
90ba16d
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,20 @@ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
|
3 |
import torch
|
4 |
import torch.nn as nn
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
def get_hidden_states(encoded, model):
|
7 |
"""Push input IDs through model. Stack and sum `layers` (last four by default).
|
8 |
Select only those subword token outputs that belong to our word of interest
|
|
|
3 |
import torch
|
4 |
import torch.nn as nn
|
5 |
|
6 |
+
class Net(nn.Module):
|
7 |
+
def __init__(self):
|
8 |
+
super(Net,self).__init__()
|
9 |
+
self.layer = nn.Sequential(
|
10 |
+
nn.Linear(768, 768),
|
11 |
+
nn.ReLU(),
|
12 |
+
nn.Linear(768, 768),
|
13 |
+
nn.ReLU(),
|
14 |
+
nn.Linear(768, 8),
|
15 |
+
)
|
16 |
+
|
17 |
+
def forward(self,x):
|
18 |
+
return self.layer(x)
|
19 |
+
|
20 |
def get_hidden_states(encoded, model):
|
21 |
"""Push input IDs through model. Stack and sum `layers` (last four by default).
|
22 |
Select only those subword token outputs that belong to our word of interest
|