Skip to content

sakhileln/rope-pytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyTorch RoPE

Implementation of Rotary Positional Embeddings (RoPE) — the clever trick behind positional encoding in modern transformers like LLaMA, Qwen, and GPT-NeoX.

Run locally

# Clone the repo
git clone https://github.com/sakhileln/rope-pytorch.git
cd rope-pytorch

Repo Structure

rope-pytorch/
├── README.md              # Intro + explanation
├── rope.py                # Core RoPE functions
├── transformer.py         # Tiny Transformer with RoPE
├── visualize_rope.py      # 2D/3D visualizations of rotation
├── train_demo.py          # Train on toy data (e.g., copy task)
└── requirements.txt

Possible Extras

  • Support for NTK scaling (used in LLaMA 2 for longer context).
  • Benchmark: Compare perplexity with/without RoPE on a small language modeling dataset (like TinyShakespeare).
  • A notebook version for Google Colab.

Sources

Contact

About

RoPE Playground – Rotary Positional Embeddings in PyTorch

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages