parth parekh
commited on
Commit
·
05af594
1
Parent(s):
727070c
added the fast tokenizer
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ app = FastAPI(
|
|
14 |
class ContactDetector:
|
15 |
def __init__(self):
|
16 |
cache_dir = "/app/model_cache"
|
17 |
-
self.tokenizer = RobertaTokenizer.from_pretrained('roberta-base', cache_dir=cache_dir)
|
18 |
self.model = RobertaForSequenceClassification.from_pretrained('roberta-base', num_labels=2, cache_dir=cache_dir)
|
19 |
self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
20 |
self.model.to(self.device)
|
|
|
14 |
class ContactDetector:
|
15 |
def __init__(self):
|
16 |
cache_dir = "/app/model_cache"
|
17 |
+
self.tokenizer = RobertaTokenizer.from_pretrained('roberta-base', use_fast=True, cache_dir=cache_dir)
|
18 |
self.model = RobertaForSequenceClassification.from_pretrained('roberta-base', num_labels=2, cache_dir=cache_dir)
|
19 |
self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
20 |
self.model.to(self.device)
|