lanl / lanl/vision_transformers_explained

Question about skip connection inside Attention block

Open
#1 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
98
Forks
22
PR merge metrics
No merged PRs in 30d

Description

Hi, thanks for the great implementation and explanation!

I noticed the following lines in notebooks/TokensToTokenViTExplained.ipynb inside the Attention class:

v = v.transpose(1, 2).reshape(B, N, self.chan)
x = v + x

This seems to introduce a skip connection inside the attention block.

However, when I checked the official T2T-ViT source code, I did not find a similar skip connection within the Attention module.

Could you clarify whether this skip connection is intentional?
Is it part of an experimental design in the notebook, or might it be an inconsistency with the original implementation?

Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with notebooks/TokensToTokenViTExplained.ipynb and inspect the Attention class around the reported transpose, reshape, and addition lines. Compare that implementation with the official T2T-ViT Attention source referenced in the issue; the work is done when the discrepancy is explained and any confirmed inconsistency is clearly identified for correction.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.