Update the code snippets slightly
#2
by
tomaarsen
HF staff
- opened
README.md
CHANGED
@@ -56,9 +56,17 @@ This is a [SpanMarker](https://github.com/tomaarsen/SpanMarkerNER) model trained
|
|
56 |
## Model Details
|
57 |
|
58 |
Important Note: I used the Tokenizer from "roberta-base".
|
59 |
-
```
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
```
|
63 |
|
64 |
### Model Description
|
@@ -89,9 +97,13 @@ model.set_tokenizer(tokenizer)
|
|
89 |
|
90 |
```python
|
91 |
from span_marker import SpanMarkerModel
|
|
|
92 |
|
93 |
# Download from the 🤗 Hub
|
94 |
-
model = SpanMarkerModel.from_pretrained("
|
|
|
|
|
|
|
95 |
# Run inference
|
96 |
entities = model.predict("Portsmouth:Middlesex 199 and 426 (J. Pooley 111,M. Ramprakash 108,M. Gatting 83), Hampshire 232 and 109-5.")
|
97 |
```
|
|
|
56 |
## Model Details
|
57 |
|
58 |
Important Note: I used the Tokenizer from "roberta-base".
|
59 |
+
```diff
|
60 |
+
from span_marker import SpanMarkerModel
|
61 |
+
from span_marker.tokenizer import SpanMarkerTokenizer
|
62 |
+
|
63 |
+
# Download from the 🤗 Hub
|
64 |
+
model = SpanMarkerModel.from_pretrained("lambdavi/span-marker-luke-base-conll2003")
|
65 |
+
+tokenizer = SpanMarkerTokenizer.from_pretrained("roberta-base", config=model.tokenizer.config)
|
66 |
+
+model.set_tokenizer(tokenizer)
|
67 |
+
|
68 |
+
# Run inference
|
69 |
+
entities = model.predict("Portsmouth:Middlesex 199 and 426 (J. Pooley 111,M. Ramprakash 108,M. Gatting 83), Hampshire 232 and 109-5.")
|
70 |
```
|
71 |
|
72 |
### Model Description
|
|
|
97 |
|
98 |
```python
|
99 |
from span_marker import SpanMarkerModel
|
100 |
+
from span_marker.tokenizer import SpanMarkerTokenizer
|
101 |
|
102 |
# Download from the 🤗 Hub
|
103 |
+
model = SpanMarkerModel.from_pretrained("lambdavi/span-marker-luke-base-conll2003")
|
104 |
+
tokenizer = SpanMarkerTokenizer.from_pretrained("roberta-base", config=model.tokenizer.config)
|
105 |
+
model.set_tokenizer(tokenizer)
|
106 |
+
|
107 |
# Run inference
|
108 |
entities = model.predict("Portsmouth:Middlesex 199 and 426 (J. Pooley 111,M. Ramprakash 108,M. Gatting 83), Hampshire 232 and 109-5.")
|
109 |
```
|