Update README.md
Browse files
README.md
CHANGED
@@ -21,7 +21,7 @@ And then we suggest loading it like follows:
|
|
21 |
|
22 |
```
|
23 |
import torch
|
24 |
-
from transformers import T5EncoderModel
|
25 |
from transformers.modeling_outputs import SequenceClassifierOutput
|
26 |
|
27 |
class T5EncoderRerank(torch.nn.Module):
|
@@ -51,4 +51,5 @@ model = T5EncoderRerank(original_model,bf16=True)
|
|
51 |
model.load_state_dict(torch.load(path_checkpoint,map_location=torch.device("cpu")))
|
52 |
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
53 |
model.to(device)
|
|
|
54 |
```
|
|
|
21 |
|
22 |
```
|
23 |
import torch
|
24 |
+
from transformers import T5EncoderModel, AutoTokenizer
|
25 |
from transformers.modeling_outputs import SequenceClassifierOutput
|
26 |
|
27 |
class T5EncoderRerank(torch.nn.Module):
|
|
|
51 |
model.load_state_dict(torch.load(path_checkpoint,map_location=torch.device("cpu")))
|
52 |
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
53 |
model.to(device)
|
54 |
+
tokenizer = AutoTokenizer.from_pretrained(original_model)
|
55 |
```
|