Spaces:
Sleeping
Sleeping
Martijn van Beers
commited on
Commit
·
c59b0ef
1
Parent(s):
40d472f
Use gpt2-large as a placeholder
Browse filesUse gpt2-large as the 2nd model for now so the demo on huggingface
spaces can be updated.
app.py
CHANGED
@@ -25,7 +25,7 @@ class CrowSPairsDataset(object):
|
|
25 |
|
26 |
|
27 |
def run(df):
|
28 |
-
result = "<table><tr style='color: white; background-color: #555'><th>index</th><th>more stereotypical</th><th>
|
29 |
for i, row in df.iterrows():
|
30 |
result += f"<tr><td>{i}</td><td style='padding: 0 1em; background-image: linear-gradient(90deg, rgba(0,255,255,0.2) 0%, rgba(255,255,255,1) 100%)'>{row['sent_more']}</td>"
|
31 |
more = row["sent_more"]
|
@@ -94,7 +94,8 @@ else:
|
|
94 |
|
95 |
model_id = "gpt2"
|
96 |
model_gpt = GPT2LMHeadModel.from_pretrained(model_id).to(device)
|
97 |
-
model_custom = torch.load("./gpt2_attn_heads_dm_top10_seed_1.pt")
|
|
|
98 |
tokenizer = GPT2TokenizerFast.from_pretrained(model_id)
|
99 |
dataset = CrowSPairsDataset()
|
100 |
|
|
|
25 |
|
26 |
|
27 |
def run(df):
|
28 |
+
result = "<table><tr style='color: white; background-color: #555'><th>index</th><th>more stereotypical</th><th>gpt2</th><th>gpt2-large</th><th>less stereotypical<th></tr>"
|
29 |
for i, row in df.iterrows():
|
30 |
result += f"<tr><td>{i}</td><td style='padding: 0 1em; background-image: linear-gradient(90deg, rgba(0,255,255,0.2) 0%, rgba(255,255,255,1) 100%)'>{row['sent_more']}</td>"
|
31 |
more = row["sent_more"]
|
|
|
94 |
|
95 |
model_id = "gpt2"
|
96 |
model_gpt = GPT2LMHeadModel.from_pretrained(model_id).to(device)
|
97 |
+
#model_custom = torch.load("./gpt2_attn_heads_dm_top10_seed_1.pt")
|
98 |
+
model_custom = GPT2LMHeadModel.from_pretrained("gpt2-large").to(device)
|
99 |
tokenizer = GPT2TokenizerFast.from_pretrained(model_id)
|
100 |
dataset = CrowSPairsDataset()
|
101 |
|