Spaces:
Runtime error
Runtime error
Commit
·
c018e35
1
Parent(s):
b7d3e37
Update app.py
Browse files
app.py
CHANGED
@@ -126,7 +126,7 @@ def lossFN(outs, targets):
|
|
126 |
|
127 |
opt = TRNSFM.AdamW(params=mod.parameters(), lr=LEARNING_RATE)
|
128 |
|
129 |
-
# Finetuning
|
130 |
def train(mod, training_loader):
|
131 |
mod.train()
|
132 |
for _, data in tqdm(enumerate(training_loader, 0)):
|
@@ -144,13 +144,13 @@ def train(mod, training_loader):
|
|
144 |
|
145 |
# StreamLit Table of Results
|
146 |
st.title("Finetuned Model for Toxicity")
|
147 |
-
st.subheader("Model:
|
148 |
|
149 |
def predict(tweets):
|
150 |
mod.eval()
|
151 |
res = []
|
152 |
with torch.no_grad():
|
153 |
-
for ins in
|
154 |
outs = mod(input_ids=ins['input_ids'].to(device), attention_mask=ins['attention_mask'].to(device), token_type_ids=ins['token_type_ids'].to(device))
|
155 |
probs = torch.softmax(outs[0], dim=-1)
|
156 |
preds = torch.argmax(probs, dim=-1)
|
|
|
126 |
|
127 |
opt = TRNSFM.AdamW(params=mod.parameters(), lr=LEARNING_RATE)
|
128 |
|
129 |
+
# Training and Finetuning
|
130 |
def train(mod, training_loader):
|
131 |
mod.train()
|
132 |
for _, data in tqdm(enumerate(training_loader, 0)):
|
|
|
144 |
|
145 |
# StreamLit Table of Results
|
146 |
st.title("Finetuned Model for Toxicity")
|
147 |
+
st.subheader("Model: bert-base-uncased")
|
148 |
|
149 |
def predict(tweets):
|
150 |
mod.eval()
|
151 |
res = []
|
152 |
with torch.no_grad():
|
153 |
+
for ins in testing_loader:
|
154 |
outs = mod(input_ids=ins['input_ids'].to(device), attention_mask=ins['attention_mask'].to(device), token_type_ids=ins['token_type_ids'].to(device))
|
155 |
probs = torch.softmax(outs[0], dim=-1)
|
156 |
preds = torch.argmax(probs, dim=-1)
|