Update model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: lucid
|
| 3 |
+
license: mit
|
| 4 |
+
tags:
|
| 5 |
+
- question-answering
|
| 6 |
+
- bert
|
| 7 |
+
- lucid
|
| 8 |
+
datasets:
|
| 9 |
+
- squad
|
| 10 |
+
pipeline_tag: question-answering
|
| 11 |
+
model-index:
|
| 12 |
+
- name: bert-base-qa
|
| 13 |
+
results:
|
| 14 |
+
- task: { type: question-answering }
|
| 15 |
+
dataset: { name: squad, type: squad }
|
| 16 |
+
metrics:
|
| 17 |
+
- { type: exact_match, value: 80.9 }
|
| 18 |
+
- { type: f1, value: 88.1 }
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# BERT-Base (SQuAD v1.1)
|
| 22 |
+
|
| 23 |
+
> https://arxiv.org/abs/1810.04805
|
| 24 |
+
|
| 25 |
+
[Lucid](https://github.com/ChanLumerico/lucid) port of `transformers/csarron/bert-base-uncased-squad-v1`,
|
| 26 |
+
converted to Lucid-native safetensors.
|
| 27 |
+
|
| 28 |
+
## Available weights
|
| 29 |
+
|
| 30 |
+
| Tag | exact_match | f1 | Params | GFLOPs | Size | Source |
|
| 31 |
+
|---|---|---|---|---|---|---|
|
| 32 |
+
| `SQUAD_V1` *(default)* | 80.9 | 88.1 | 109.5M | — | 417.67 MB | transformers |
|
| 33 |
+
|
| 34 |
+
## Usage
|
| 35 |
+
|
| 36 |
+
```python
|
| 37 |
+
import lucid
|
| 38 |
+
import lucid.models as models
|
| 39 |
+
from lucid.models.weights import BERTBaseQAWeights
|
| 40 |
+
|
| 41 |
+
# default tag
|
| 42 |
+
model = models.bert_base_qa(pretrained=True)
|
| 43 |
+
|
| 44 |
+
# explicit tag (enum or string)
|
| 45 |
+
model = models.bert_base_qa(weights=BERTBaseQAWeights.SQUAD_V1)
|
| 46 |
+
model = models.bert_base_qa(pretrained="SQUAD_V1")
|
| 47 |
+
|
| 48 |
+
# feed token ids (tokenize with the matching lucid.utils.tokenizer)
|
| 49 |
+
input_ids = lucid.tensor([[101, 7592, 2088, 102]], dtype=lucid.int64)
|
| 50 |
+
out = model(input_ids)
|
| 51 |
+
start, end = out.start_logits, out.end_logits # (B, T) each
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
## Conversion
|
| 55 |
+
|
| 56 |
+
Converted from `transformers/csarron/bert-base-uncased-squad-v1` via
|
| 57 |
+
`python -m tools.convert_weights bert_base_qa --tag SQUAD_V1`.
|
| 58 |
+
Key mapping + numerical parity verified against the source.
|
| 59 |
+
|
| 60 |
+
## License
|
| 61 |
+
|
| 62 |
+
`mit` — inherited from the original weights.
|
| 63 |
+
|
| 64 |
+
## Citation
|
| 65 |
+
|
| 66 |
+
```
|
| 67 |
+
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.
|
| 68 |
+
```
|