Update model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: lucid
|
| 3 |
+
license: mit
|
| 4 |
+
tags:
|
| 5 |
+
- token-classification
|
| 6 |
+
- bert
|
| 7 |
+
- lucid
|
| 8 |
+
datasets:
|
| 9 |
+
- conll2003
|
| 10 |
+
pipeline_tag: token-classification
|
| 11 |
+
model-index:
|
| 12 |
+
- name: bert-base-token-cls
|
| 13 |
+
results:
|
| 14 |
+
- task: { type: token-classification }
|
| 15 |
+
dataset: { name: conll2003, type: conll2003 }
|
| 16 |
+
metrics:
|
| 17 |
+
- { type: f1, value: 91.3 }
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# BERT-Base (CoNLL-2003 NER)
|
| 21 |
+
|
| 22 |
+
> https://arxiv.org/abs/1810.04805
|
| 23 |
+
|
| 24 |
+
[Lucid](https://github.com/ChanLumerico/lucid) port of `transformers/dslim/bert-base-NER`,
|
| 25 |
+
converted to Lucid-native safetensors.
|
| 26 |
+
|
| 27 |
+
## Available weights
|
| 28 |
+
|
| 29 |
+
| Tag | f1 | Params | GFLOPs | Size | Source |
|
| 30 |
+
|---|---|---|---|---|---|
|
| 31 |
+
| `CONLL2003` *(default)* | 91.3 | 108.3M | — | 413.22 MB | transformers |
|
| 32 |
+
|
| 33 |
+
## Usage
|
| 34 |
+
|
| 35 |
+
```python
|
| 36 |
+
import lucid
|
| 37 |
+
import lucid.models as models
|
| 38 |
+
from lucid.models.weights import BERTBaseNERWeights
|
| 39 |
+
|
| 40 |
+
# default tag
|
| 41 |
+
model = models.bert_base_token_cls(pretrained=True)
|
| 42 |
+
|
| 43 |
+
# explicit tag (enum or string)
|
| 44 |
+
model = models.bert_base_token_cls(weights=BERTBaseNERWeights.CONLL2003)
|
| 45 |
+
model = models.bert_base_token_cls(pretrained="CONLL2003")
|
| 46 |
+
|
| 47 |
+
# feed token ids (tokenize with the matching lucid.utils.tokenizer)
|
| 48 |
+
input_ids = lucid.tensor([[101, 7592, 2088, 102]], dtype=lucid.int64)
|
| 49 |
+
out = model(input_ids)
|
| 50 |
+
logits = out.logits # classification logits
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## Conversion
|
| 54 |
+
|
| 55 |
+
Converted from `transformers/dslim/bert-base-NER` via
|
| 56 |
+
`python -m tools.convert_weights bert_base_token_cls --tag CONLL2003`.
|
| 57 |
+
Key mapping + numerical parity verified against the source.
|
| 58 |
+
|
| 59 |
+
## License
|
| 60 |
+
|
| 61 |
+
`mit` — inherited from the original weights.
|
| 62 |
+
|
| 63 |
+
## Citation
|
| 64 |
+
|
| 65 |
+
```
|
| 66 |
+
Devlin et al., "BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding", NAACL 2019. Miniatures: Turc et al., "Well-Read Students Learn Better", 2019.
|
| 67 |
+
```
|