| --- |
| library_name: lucid |
| license: apache-2.0 |
| tags: |
| - question-answering |
| - bert |
| - lucid |
| datasets: |
| - squad |
| pipeline_tag: question-answering |
| model-index: |
| - name: bert-large-qa |
| results: |
| - task: { type: question-answering } |
| dataset: { name: squad, type: squad } |
| metrics: |
| - { type: exact_match, value: 86.9 } |
| - { type: f1, value: 93.2 } |
| --- |
| |
| # BERT-Large WWM (SQuAD v1.1) |
|
|
| > https://arxiv.org/abs/1810.04805 |
|
|
| [Lucid](https://github.com/ChanLumerico/lucid) port of `transformers/google-bert/bert-large-uncased-whole-word-masking-finetuned-squad`, |
| converted to Lucid-native safetensors. |
|
|
| ## Available weights |
|
|
| | Tag | exact_match | f1 | Params | GFLOPs | Size | Source | |
| |---|---|---|---|---|---|---| |
| | `SQUAD_V1` *(default)* | 86.9 | 93.2 | 335.1M | — | 1278.52 MB | transformers | |
|
|
| ## Usage |
|
|
| ```python |
| import lucid |
| import lucid.models as models |
| from lucid.models.weights import BERTLargeQAWeights |
| |
| # default tag |
| model = models.bert_large_qa(pretrained=True) |
| |
| # explicit tag (enum or string) |
| model = models.bert_large_qa(weights=BERTLargeQAWeights.SQUAD_V1) |
| model = models.bert_large_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/google-bert/bert-large-uncased-whole-word-masking-finetuned-squad` via |
| `python -m tools.convert_weights bert_large_qa --tag SQUAD_V1`. |
| Key mapping + numerical parity verified against the source. |
|
|
| ## License |
|
|
| `apache-2.0` — 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. |
| ``` |
|
|