Feature Extraction
Safetensors
lucid
base
bert
bert-tiny / README.md
ChanLumerico's picture
Update model card
b296b7b verified
metadata
library_name: lucid
license: apache-2.0
tags:
  - base
  - bert
  - lucid
datasets:
  - wikipedia
  - bookcorpus
pipeline_tag: feature-extraction

BERT-Tiny

https://arxiv.org/abs/1810.04805

Lucid port of transformers/google/bert_uncased_L-2_H-128_A-2, converted to Lucid-native safetensors.

Available weights

Tag Params GFLOPs Size Source
WIKIPEDIA_BOOKSCORPUS (default) 4.4M 16.74 MB transformers

Usage

import lucid
import lucid.models as models
from lucid.models.weights import BertTinyWeights

# default tag
model = models.bert_tiny(pretrained=True)

# explicit tag (enum or string)
model = models.bert_tiny(weights=BertTinyWeights.WIKIPEDIA_BOOKSCORPUS)
model = models.bert_tiny(pretrained="WIKIPEDIA_BOOKSCORPUS")

# 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)
hidden = out.last_hidden_state  # (B, T, hidden_size)

Conversion

Converted from transformers/google/bert_uncased_L-2_H-128_A-2 via python -m tools.convert_weights bert_tiny --tag WIKIPEDIA_BOOKSCORPUS. 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.