hotchpotch
commited on
Commit
•
3cf845d
1
Parent(s):
002fc0a
Update README.md
Browse files
README.md
CHANGED
@@ -48,10 +48,6 @@ model.output_names["logits"] = 0
|
|
48 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
49 |
|
50 |
|
51 |
-
def cls_pool(last_hidden_state: Tensor) -> Tensor:
|
52 |
-
return last_hidden_state[:, 0, :]
|
53 |
-
|
54 |
-
|
55 |
def average_pool(last_hidden_state: Tensor, attention_mask: Tensor) -> Tensor:
|
56 |
last_hidden = last_hidden_state.masked_fill(~attention_mask[..., None].bool(), 0.0)
|
57 |
return last_hidden.sum(dim=1) / attention_mask.sum(dim=1)[..., None]
|
|
|
48 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
49 |
|
50 |
|
|
|
|
|
|
|
|
|
51 |
def average_pool(last_hidden_state: Tensor, attention_mask: Tensor) -> Tensor:
|
52 |
last_hidden = last_hidden_state.masked_fill(~attention_mask[..., None].bool(), 0.0)
|
53 |
return last_hidden.sum(dim=1) / attention_mask.sum(dim=1)[..., None]
|