Views
No views yet
1
2from transformers import AutoTokenizer
3
4import torch
5
6
7
8# Load tokenizer
9
10tokenizer = AutoTokenizer.from_pretrained("minoosh/bert-clf-biencoder-kl_divergence")
11
12
13
14# Load model weights
15
16state_dict = torch.load("pytorch_model.bin")
17
18
19
20# Initialize model (you'll need the BiEncoderModel class)
21
22model = BiEncoderModel(
23
24 base_model=AutoModel.from_pretrained("bert-base-uncased"),
25
26 num_classes=4
27
28)
29
30model.load_state_dict(state_dict)
31