Skip to content

Fix CLS and Reg tokens usage when pos_embed is disabled#2676

Merged
rwightman merged 1 commit intohuggingface:mainfrom
sinahmr:no-pos-embed-cls-fix
Mar 8, 2026
Merged

Fix CLS and Reg tokens usage when pos_embed is disabled#2676
rwightman merged 1 commit intohuggingface:mainfrom
sinahmr:no-pos-embed-cls-fix

Conversation

@sinahmr
Copy link
Copy Markdown
Contributor

@sinahmr sinahmr commented Mar 5, 2026

In the curernt implementation of vision_transformer.py, if you set pos_embed='none', the CLS and Reg tokens are not used, which is undesirable in my opinion. One can disable absolute positional embedding and still use those prefix tokens. I believe this commit fixes that issue.

@rwightman
Copy link
Copy Markdown
Collaborator

it does fix that case, thx

@rwightman rwightman merged commit fa0d31e into huggingface:main Mar 8, 2026
22 checks passed
@sinahmr sinahmr deleted the no-pos-embed-cls-fix branch March 8, 2026 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants