Spaces:
Runtime error
Runtime error
Commit
Β·
90d2ad7
1
Parent(s):
6cfc7f3
Add examples; Extract temperatures
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ class Interactive:
|
|
| 13 |
self.linear.weight = torch.nn.Parameter(self.model.shared.weight[32099, :].unsqueeze(0)) # (1, D)
|
| 14 |
self.linear.bias = torch.nn.Parameter(self.model.shared.weight[32098, 0].unsqueeze(0)) # (1)
|
| 15 |
self.model.eval()
|
| 16 |
-
self.t =
|
| 17 |
|
| 18 |
def run(self, statement):
|
| 19 |
input_ids = self.tokenizer.batch_encode_plus([statement], return_tensors='pt', padding='longest').input_ids.to(device)
|
|
@@ -42,8 +42,66 @@ def predict(statement, model):
|
|
| 42 |
}
|
| 43 |
|
| 44 |
examples = [
|
| 45 |
-
|
| 46 |
-
'If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
]
|
| 48 |
|
| 49 |
input_statement = gr.Dropdown(choices=examples, label='Statement:')
|
|
|
|
| 13 |
self.linear.weight = torch.nn.Parameter(self.model.shared.weight[32099, :].unsqueeze(0)) # (1, D)
|
| 14 |
self.linear.bias = torch.nn.Parameter(self.model.shared.weight[32098, 0].unsqueeze(0)) # (1)
|
| 15 |
self.model.eval()
|
| 16 |
+
self.t = self.model.shared.weight[32097, 0].item()
|
| 17 |
|
| 18 |
def run(self, statement):
|
| 19 |
input_ids = self.tokenizer.batch_encode_plus([statement], return_tensors='pt', padding='longest').input_ids.to(device)
|
|
|
|
| 42 |
}
|
| 43 |
|
| 44 |
examples = [
|
| 45 |
+
# openbookqa
|
| 46 |
+
'If a person walks in the opposite direction of a compass arrow they are walking south.',
|
| 47 |
+
'If a person walks in the opposite direction of a compass arrow they are walking north.',
|
| 48 |
+
# arc_easy
|
| 49 |
+
'A pond is different from a lake because ponds are smaller and shallower.',
|
| 50 |
+
'A pond is different from a lake because ponds have moving water.',
|
| 51 |
+
# arc_hard
|
| 52 |
+
'Hunting strategies are more likely to be learned rather than inherited.',
|
| 53 |
+
'A spotted coat is more likely to be learned rather than inherited.',
|
| 54 |
+
# ai2_science_elementary
|
| 55 |
+
'Photosynthesis uses carbon from the air to make food for plants.',
|
| 56 |
+
'Respiration uses carbon from the air to make food for plants.',
|
| 57 |
+
# ai2_science_middle
|
| 58 |
+
'The barometer measures atmospheric pressure.',
|
| 59 |
+
'The thermometer measures atmospheric pressure.',
|
| 60 |
+
# commonsenseqa
|
| 61 |
+
'People aim to complete a job at work.',
|
| 62 |
+
'People aim to kill animals at work.',
|
| 63 |
+
# qasc
|
| 64 |
+
'Climate is generally described in terms of local weather conditions.',
|
| 65 |
+
'Climate is generally described in terms of forests.',
|
| 66 |
+
# physical_iqa
|
| 67 |
+
'ice box will turn into a cooler if you add water to it.',
|
| 68 |
+
'ice box will turn into a cooler if you add soda to it.',
|
| 69 |
+
# social_iqa
|
| 70 |
+
'Kendall opened their mouth to speak and what came out shocked everyone. Kendall is a very aggressive and talkative person.',
|
| 71 |
+
'Kendall opened their mouth to speak and what came out shocked everyone. Kendall is a very quiet person.',
|
| 72 |
+
# winogrande_xl
|
| 73 |
+
'Sarah was a much better surgeon than Maria so Maria always got the easier cases.',
|
| 74 |
+
'Sarah was a much better surgeon than Maria so Sarah always got the easier cases.',
|
| 75 |
+
# com2sense_paired
|
| 76 |
+
'If you want a quick snack, getting one banana would be a good choice generally.',
|
| 77 |
+
'If you want a snack, getting twenty bananas would be a good choice generally.',
|
| 78 |
+
# sciq
|
| 79 |
+
'Each specific polypeptide has a unique linear sequence of amino acids.',
|
| 80 |
+
'Each specific polypeptide has a unique linear sequence of fatty acids.',
|
| 81 |
+
# quarel
|
| 82 |
+
'Tommy glided across the marble floor with ease, but slipped and fell on the wet floor because wet floor has more resistance.',
|
| 83 |
+
'Tommy glided across the marble floor with ease, but slipped and fell on the wet floor because marble floor has more resistance.',
|
| 84 |
+
# quartz
|
| 85 |
+
'If less waters falls on an area of land it will cause less plants to grow in that area.',
|
| 86 |
+
'If less waters falls on an area of land it will cause more plants to grow in that area.',
|
| 87 |
+
# cycic_mc
|
| 88 |
+
'In U.S. spring, Rob visits the financial district every day. In U.S. winter, Rob visits the park every day. Rob will go to the park on January 20.',
|
| 89 |
+
'In U.S. spring, Rob visits the financial district every day. In U.S. winter, Rob visits the park every day. Rob will go to the financial district on January 20.',
|
| 90 |
+
# comve_a
|
| 91 |
+
'Summer in North America is great for swimming, boating, and fishing.',
|
| 92 |
+
'Summer in North America is great for skiing, snowshoeing, and making a snowman.',
|
| 93 |
+
# csqa2
|
| 94 |
+
'Gas is always capable of turning into liquid under high pressure.',
|
| 95 |
+
'Cotton candy is sometimes made out of cotton.',
|
| 96 |
+
# symkd_anno
|
| 97 |
+
'James visits a famous landmark. As a result, James learns about the world.',
|
| 98 |
+
'Cliff and Andrew enter the castle. But before, Cliff needed to have been a student at the school.',
|
| 99 |
+
# gengen_anno
|
| 100 |
+
'Generally, bar patrons are capable of taking care of their own drinks.',
|
| 101 |
+
'Generally, ocean currents have little influence over storm intensity.',
|
| 102 |
+
|
| 103 |
+
# 'If A sits next to B and B sits next to C, then A must sit next to C.',
|
| 104 |
+
# 'If A sits next to B and B sits next to C, then A might not sit next to C.',
|
| 105 |
]
|
| 106 |
|
| 107 |
input_statement = gr.Dropdown(choices=examples, label='Statement:')
|