Update README.md
Browse files
README.md
CHANGED
@@ -20,6 +20,7 @@ Label map:
|
|
20 |
"B-attraction": 5
|
21 |
"I-attraction": 6
|
22 |
|
|
|
23 |
from transformers import AutoConfig, AutoModelForTokenClassification, BertTokenizer
|
24 |
from transformers import TokenClassificationPipeline
|
25 |
import json
|
@@ -39,8 +40,10 @@ tokenizer = BertTokenizer.from_pretrained(
|
|
39 |
model_path,
|
40 |
)
|
41 |
|
|
|
42 |
pipeline = TokenClassificationPipeline(model, tokenizer, device=-1)
|
43 |
|
44 |
tokens = pipeline(["i want to book the hilton hotel near china town.", "can you reserve A & B restaurant for me?"])
|
|
|
45 |
|
46 |
Credit: Jia-Chen Jason Gu, Wilson Tam
|
|
|
20 |
"B-attraction": 5
|
21 |
"I-attraction": 6
|
22 |
|
23 |
+
```python
|
24 |
from transformers import AutoConfig, AutoModelForTokenClassification, BertTokenizer
|
25 |
from transformers import TokenClassificationPipeline
|
26 |
import json
|
|
|
40 |
model_path,
|
41 |
)
|
42 |
|
43 |
+
# device=-1: cpu, device=0: gpu
|
44 |
pipeline = TokenClassificationPipeline(model, tokenizer, device=-1)
|
45 |
|
46 |
tokens = pipeline(["i want to book the hilton hotel near china town.", "can you reserve A & B restaurant for me?"])
|
47 |
+
```
|
48 |
|
49 |
Credit: Jia-Chen Jason Gu, Wilson Tam
|