Tom Aarsen commited on
Commit
caa7ce7
·
1 Parent(s): 5a84b7b

Update README snippets

Browse files
Files changed (1) hide show
  1. README.md +6 -5
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.607138 -4.320078]
41
  ```
42
 
43
  ## Usage with Transformers
@@ -51,8 +51,8 @@ tokenizer = AutoTokenizer.from_pretrained("cross-encoder/monoelectra-base")
51
 
52
  features = tokenizer(
53
  [
54
- ["How many people live in Berlin?", "How many people live in Berlin?"],
55
- ["Berlin has a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers.", "New York City is famous for the Metropolitan Museum of Art."],
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
- print(scores)
 
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
  ```