How hierarchies and window sizes work
mainThe model uses hierarchies to define compression levels and window_sizes to control the receptive field of attention at each level:
- Hierarchies: A value of
1represents a regular transformer. Higher values (e.g.,2,8) represent compressed hierarchical tokens. As you compress up the hierarchies, it is recommended to increase model dimensions to maintain capacity. - Window Sizes: This controls local attention. Higher hierarchies can pass distant information to the local (fine) hierarchy.
None: Full receptive field.Integer: A local attention window of that size.0: Turns off attention at that hierarchy (though token shift remains in effect).
- Hierarchical Stride: Controls the stride during compression and the repetition of tokens when concatenating hierarchical tokens back to fine tokens. This maintains causality using a shift trick similar to hourglass transformers.