RoFormer: Enhanced Transformer with Rotary Position Embedding
Paper • 2104.09864 • Published • 18
Lucid port of transformers/junnyu/roformer_chinese_base,
converted to Lucid-native safetensors.
| Tag | Params | GFLOPs | Size | Source |
|---|---|---|---|---|
CLUECORPUSSMALL (default) |
124.2M | — | 622.16 MB | transformers |
import lucid
import lucid.models as models
from lucid.models.weights import RoFormerMLMWeights
# default tag
model = models.roformer_mlm(pretrained=True)
# explicit tag (enum or string)
model = models.roformer_mlm(weights=RoFormerMLMWeights.CLUECORPUSSMALL)
model = models.roformer_mlm(pretrained="CLUECORPUSSMALL")
# 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)
logits = out.logits # (B, T, vocab_size)
Converted from transformers/junnyu/roformer_chinese_base via
python -m tools.convert_weights roformer_mlm --tag CLUECORPUSSMALL.
Key mapping + numerical parity verified against the source.
apache-2.0 — inherited from the original weights.
Su et al., "RoFormer: Enhanced Transformer with Rotary Position Embedding", 2021.