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