File size: 867 Bytes
2f7c74e
 
 
 
 
 
56e886c
2f7c74e
 
 
fdb50b1
2f7c74e
 
 
56e886c
 
 
 
 
2f7c74e
 
 
 
 
 
 
56e886c
2f7c74e
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
---
license: apache-2.0
base_model:
- google-bert/bert-base-uncased
---


You can load the laff model using the following steps: 

```
import torch
from transformers import BertTokenizer, BertForSequenceClassification
from base_models import  BinaryClassificationBertModel

from huggingface_hub import hf_hub_download

file_path = hf_hub_download(repo_id="mandeep-rathee/laff-model", filename="bert-base-laff.pth")


device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

base_model_name = "bert-base-uncased" 
tokenizer = BertTokenizer.from_pretrained(base_model_name, torch_dtype=torch.float16)
base_model = BertForSequenceClassification.from_pretrained(base_model_name, num_labels=1,torch_dtype=torch.float16)

model = BinaryClassificationBertModel(base_model)
model.load_state_dict(torch.load(file_path, map_location=device))
model.to(device)
```