roformer
An encoder-only transformer that introduced Rotary Position Embedding (RoPE).
Language · 616 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Language
- Parameters
- 124.2M
- Operations
- 616
- Framework
- PyTorch
- Recurrent
- No
- Source
- transformers 5.18.0
- License
- Apache-2.0
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m8968
- Graph hash
- f47cf9f094f3c3cee22dc21b3cd8dad1f7be3338d2fee70903d516514253f7e1
- Skeleton hash
- 9ef7a676c552ecb30ef074fe8e86842952f70cc1bd98137f104a5e220b9d1678
- Architecture hash
- 4e9b567f848d5a086e0fb92bfc34a4841d56530711475e4a527996d5ee6de062
- Diagram SHA-256
- 66756fb59b5ad3b766de6cde86f687a6142d2ff295bc3bea2d3bc432f009362e
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
How this diagram was made
transformers.AutoModelForMaskedLM.from_config()
What it is
RoFormer introduces Rotary Position Embedding, or RoPE, which encodes token positions by rotating the inputs in 2D space. This lets a model track absolute positions while also modelling relative relationships. RoPE can scale to longer sequences, accounts for the natural decay of token dependencies, and works with the more efficient linear self-attention.
The implementation in the library is an encoder-only model, and the original code is in the ZhuiyiTechnology/roformer repository. The member captured here is the masked-language-model form, which the docs use to predict the [MASK] token. The documented checkpoint is junnyu/roformer_chinese_base. Its tokenizer needs the rjieba package.
Key idea. Rotary Position Embedding (RoPE), which encodes token positions by rotating the inputs in 2D space.
- roformer
- rotary position embedding
- rope
- rotary transformer
- roformer chinese
- zhuiyi
- masked language modeling
- fill-mask
AI-written summary, based on the model's documentation and checked automatically against it; not reviewed by a person. Corrections welcome.