Elron commited on
Commit
1388f44
1 Parent(s): 50a8bb5

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -0
README.md ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## BLEURT
2
+
3
+ Pytorch version of the original BLEURT models from ACL paper ["BLEURT: Learning Robust Metrics for Text Generation"](https://aclanthology.org/2020.acl-main.704/) by
4
+ Thibault Sellam, Dipanjan Das and Ankur P. Parikh of Google Research.
5
+
6
+ The code for model conversion was originated from [this notebook](https://colab.research.google.com/drive/1KsCUkFW45d5_ROSv2aHtXgeBa2Z98r03?usp=sharing) mentioned [here](https://github.com/huggingface/datasets/issues/224).
7
+
8
+ ## Usage Example
9
+
10
+ ```python
11
+ from transformers import BertForSequenceClassification, AutoTokenizer
12
+ import torch
13
+
14
+ tokenizer = AutoTokenizer.from_pretrained("elron/bleurt-large-512")
15
+ model = AutoModelForSequenceClassification.from_pretrained("elron/bleurt-large-512")
16
+ model.eval()
17
+
18
+ references = ["hello world", "hello world"]
19
+ candidates = ["hi universe", "bye world"]
20
+
21
+ with torch.no_grad():
22
+ scores = model(**tokenizer(references, candidates, return_tensors='pt'))[0]
23
+
24
+ print(scores) # tensor([[0.9877], [0.0475]])
25
+ ```