Update README.md
Browse files
README.md
CHANGED
@@ -17,6 +17,7 @@ A model for mapping abstract sentence descriptions to sentences that fit the des
|
|
17 |
|
18 |
from transformers import AutoTokenizer, AutoModel
|
19 |
import torch
|
|
|
20 |
|
21 |
def load_finetuned_model():
|
22 |
|
@@ -28,7 +29,7 @@ def load_finetuned_model():
|
|
28 |
return tokenizer, query_encoder, sentence_encoder
|
29 |
|
30 |
|
31 |
-
def encode_batch(model, tokenizer, sentences, device):
|
32 |
input_ids = tokenizer(sentences, padding=True, max_length=512, truncation=True, return_tensors="pt",
|
33 |
add_special_tokens=True).to(device)
|
34 |
features = model(**input_ids)[0]
|
|
|
17 |
|
18 |
from transformers import AutoTokenizer, AutoModel
|
19 |
import torch
|
20 |
+
from typing import List
|
21 |
|
22 |
def load_finetuned_model():
|
23 |
|
|
|
29 |
return tokenizer, query_encoder, sentence_encoder
|
30 |
|
31 |
|
32 |
+
def encode_batch(model, tokenizer, sentences: List[str], device: str):
|
33 |
input_ids = tokenizer(sentences, padding=True, max_length=512, truncation=True, return_tensors="pt",
|
34 |
add_special_tokens=True).to(device)
|
35 |
features = model(**input_ids)[0]
|