Spaces:
Runtime error
Runtime error
Jeffrey Rathgeber Jr
commited on
testmodel
Browse files
app.py
CHANGED
@@ -61,7 +61,7 @@ if option == 'MILESTONE 3':
|
|
61 |
batch_0 = tokenizer_0(X_train, padding=True, truncation=True, max_length=512, return_tensors="pt")
|
62 |
|
63 |
with torch.no_grad():
|
64 |
-
outputs =
|
65 |
predictions = F.softmax(outputs.logits, dim=1)
|
66 |
labels = torch.argmax(predictions, dim=1)
|
67 |
labels = [model.config.id2label[label_id] for label_id in labels.tolist()]
|
@@ -87,6 +87,18 @@ if option == 'MILESTONE 3':
|
|
87 |
HTCET = [0]*10
|
88 |
SET = [0]*10
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
df = df.assign(Tweet=pre_populated_tweets)
|
91 |
df = df.assign(Highest_Toxicity_Class_Overall=HTCO)
|
92 |
df = df.assign(Score_Overall=SO)
|
|
|
61 |
batch_0 = tokenizer_0(X_train, padding=True, truncation=True, max_length=512, return_tensors="pt")
|
62 |
|
63 |
with torch.no_grad():
|
64 |
+
outputs = model_0(**batch_0, labels=torch.tensor([1, 0]))
|
65 |
predictions = F.softmax(outputs.logits, dim=1)
|
66 |
labels = torch.argmax(predictions, dim=1)
|
67 |
labels = [model.config.id2label[label_id] for label_id in labels.tolist()]
|
|
|
87 |
HTCET = [0]*10
|
88 |
SET = [0]*10
|
89 |
|
90 |
+
# for i in range(10):
|
91 |
+
# X_train = pre_populated_tweets[i]
|
92 |
+
# batch = tokenizer_0(X_train, padding=True, truncation=True, max_length=512, return_tensors="pt")
|
93 |
+
|
94 |
+
# with torch.no_grad():
|
95 |
+
# outputs = model(**batch_0, labels=torch.tensor([1, 0]))
|
96 |
+
# predictions = F.softmax(outputs.logits, dim=1)
|
97 |
+
# labels = torch.argmax(predictions, dim=1)
|
98 |
+
# labels = [model.config.id2label[label_id] for label_id in labels.tolist()]
|
99 |
+
|
100 |
+
|
101 |
+
|
102 |
df = df.assign(Tweet=pre_populated_tweets)
|
103 |
df = df.assign(Highest_Toxicity_Class_Overall=HTCO)
|
104 |
df = df.assign(Score_Overall=SO)
|