Skip to content

Commit e0d9276

Browse files
committed
fix NER device depending on arch
1 parent 774ecac commit e0d9276

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/test-round-trip.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@
88
from preempt.ner import *
99
from preempt.sanitizer import *
1010

11+
import torch
1112

13+
device = (
14+
"mps" if torch.backends.mps.is_available()
15+
else "cuda" if torch.cuda.is_available()
16+
else "cpu"
17+
)
1218
# Load NER object
1319
# ner_model = NER("/path/to/UniNER-7B-all", device="cuda:1")
14-
ner_model = NER("/path/to/Meta-Llama-3-8B-Instruct/", device="cuda:1")
20+
ner_model = NER("meta-llama/Meta-Llama-3.1-8B-Instruct", device=device)
21+
1522

1623
# Load Sanitizer objects for name and money
1724
sanitizer_name = Sanitizer(ner_model, key = "EF4359D8D580AA4F7F036D6F04FC6A94", tweak = "D8E7920AFA330A73")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy