Tom Aarsen
commited on
Commit
·
caa7ce7
1
Parent(s):
5a84b7b
Update README snippets
Browse files
README.md
CHANGED
@@ -37,7 +37,7 @@ scores = model.predict([
|
|
37 |
("How many people live in Berlin?", "Berlin is well known for its museums."),
|
38 |
])
|
39 |
print(scores)
|
40 |
-
# [ 8.
|
41 |
```
|
42 |
|
43 |
## Usage with Transformers
|
@@ -51,8 +51,8 @@ tokenizer = AutoTokenizer.from_pretrained("cross-encoder/monoelectra-base")
|
|
51 |
|
52 |
features = tokenizer(
|
53 |
[
|
54 |
-
|
55 |
-
|
56 |
],
|
57 |
padding=True,
|
58 |
truncation=True,
|
@@ -61,6 +61,7 @@ features = tokenizer(
|
|
61 |
|
62 |
model.eval()
|
63 |
with torch.no_grad():
|
64 |
-
scores = model(**features).logits
|
65 |
-
|
|
|
66 |
```
|
|
|
37 |
("How many people live in Berlin?", "Berlin is well known for its museums."),
|
38 |
])
|
39 |
print(scores)
|
40 |
+
# [ 8.122868 -4.292924]
|
41 |
```
|
42 |
|
43 |
## Usage with Transformers
|
|
|
51 |
|
52 |
features = tokenizer(
|
53 |
[
|
54 |
+
("How many people live in Berlin?", "Berlin had a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers."),
|
55 |
+
("How many people live in Berlin?", "Berlin is well known for its museums."),
|
56 |
],
|
57 |
padding=True,
|
58 |
truncation=True,
|
|
|
61 |
|
62 |
model.eval()
|
63 |
with torch.no_grad():
|
64 |
+
scores = model(**features).logits.view(-1)
|
65 |
+
print(scores)
|
66 |
+
# tensor([ 8.1229, -4.2929])
|
67 |
```
|