lucadiliello commited on
Commit
c96bd62
1 Parent(s): e69dce0

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +28 -0
README.md ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ This model is based on a custom Transformer model that can be installed with:
2
+
3
+ ```bash
4
+ pip install git+https://github.com/lucadiliello/bleurt-pytorch.git
5
+ ```
6
+
7
+ Now load the model and make predictions with:
8
+
9
+ ```python
10
+ import torch
11
+ from bleurt_pytorch import BleurtConfig, BleurtForSequenceClassification, BleurtTokenizer
12
+
13
+ config = BleurtConfig.from_pretrained('lucadiliello/bleurt-large-512')
14
+ model = BleurtForSequenceClassification.from_pretrained('lucadiliello/bleurt-large-512')
15
+ tokenizer = BleurtTokenizer.from_pretrained('lucadiliello/bleurt-large-512')
16
+
17
+ references = ["a bird chirps by the window", "this is a random sentence"]
18
+ candidates = ["a bird chirps by the window", "this looks like a random sentence"]
19
+
20
+ model.eval()
21
+ with torch.no_grad():
22
+ inputs = tokenizer(references, candidates, padding='longest', return_tensors='pt')
23
+ res = model(**inputs).logits.flatten().tolist()
24
+ print(res)
25
+ # [1.0721179246902466, 0.8036927580833435]
26
+ ```
27
+
28
+ Take a look at this [repository](https://github.com/lucadiliello/bleurt-pytorch) for the definition of `BleurtConfig`, `BleurtForSequenceClassification` and `BleurtTokenizer` in PyTorch.