wilsontam commited on
Commit
4ef45a8
1 Parent(s): f493c9f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +16 -1
README.md CHANGED
@@ -9,4 +9,19 @@ widget:
9
  ---
10
  This is the model used for knowledge clustering where we feed title-body pair and the classifier predicts if the pair is valid or not.
11
  For further information, please refer to https://github.com/yctam/dstc10_track2_task2 for the Github repository.
12
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  ---
10
  This is the model used for knowledge clustering where we feed title-body pair and the classifier predicts if the pair is valid or not.
11
  For further information, please refer to https://github.com/yctam/dstc10_track2_task2 for the Github repository.
12
+
13
+ ## Usage
14
+ def single_test(tokenizer, title_body_pair):
15
+ result = tokenizer([title_body_pair], return_tensors="pt")
16
+ result.to(device)
17
+ model.eval()
18
+ outputs = model(**result)
19
+ predictions = outputs.logits.argmax(dim=-1)
20
+ return True if predictions == 0 else False
21
+
22
+ if __name__ == '__main__':
23
+ sentence = "Can I check in anytime?"
24
+ body = "Yes, 24 Hours Front Desk Avaliable."
25
+ pair = (sentence, body)
26
+ print(single_test(pair)) # Expect: True
27
+ ---