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) |
123.6M | — | 473.23 MB | transformers |
import lucid
import lucid.models as models
from lucid.models.weights import RoformerWeights
# default tag
model = models.roformer(pretrained=True)
# explicit tag (enum or string)
model = models.roformer(weights=RoformerWeights.CLUECORPUSSMALL)
model = models.roformer(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)
hidden = out.last_hidden_state # (B, T, hidden_size)
Converted from transformers/junnyu/roformer_chinese_base via
python -m tools.convert_weights roformer --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.