-
Notifications
You must be signed in to change notification settings - Fork 360
feat: adding stochastic positional embeddings #1963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kir-7
wants to merge
14
commits into
lightly-ai:master
Choose a base branch
from
kir-7:stop_emb
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a21f2c1
added stop and included in ijepa
kir-7 9c27f5f
fixed failing tests for ijepa_timm; extended ijepa_timm to test stop
kir-7 2967d4f
StoP: removed use_stop, fixed docstrings
kir-7 14f29f8
Stop: fix typo
kir-7 07a74c9
Merge branch 'master' into stop_emb
liopeer 345e9ac
StoP: remove bias term in noise calculation
kir-7 6d02f52
Merge branch 'master' into stop_emb
liopeer ae95ecb
StoP: disabling stop during eval
kir-7 f308f8b
Merge branch 'master' into stop_emb
liopeer 8e76553
StoP: fixed formatting
kir-7 863304f
Merge branch 'stop_emb' of https://github.com/kir-7/lightly into stop…
kir-7 6eae4a8
Merge branch 'master' into stop_emb
liopeer a7a145d
Merge upstream/master into stop_emb
kir-7 a796ad7
Merge remote-tracking branch 'origin/stop_emb' into stop_emb
kir-7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import torch | ||
|
|
||
| from lightly.models import utils | ||
|
|
||
|
|
||
| def test_add_stochastic_positional_noise_disabled() -> None: | ||
| projection = torch.nn.Linear(8, 4) | ||
| pos_embeddings = torch.randn(2, 3, 4) | ||
|
|
||
| out = utils.add_stochastic_positional_noise( | ||
| pos_embeddings=pos_embeddings, projection=projection, noise_dim=8, noise_std=0.0 | ||
| ) | ||
|
|
||
| assert torch.equal(out, pos_embeddings) | ||
|
|
||
|
|
||
| def test_add_stochastic_positional_noise_enabled() -> None: | ||
| projection = torch.nn.Linear(8, 4) | ||
| pos_embeddings = torch.randn(2, 3, 4) | ||
|
|
||
| out = utils.add_stochastic_positional_noise( | ||
| pos_embeddings=pos_embeddings, | ||
| projection=projection, | ||
| noise_dim=8, | ||
| noise_std=0.25, | ||
| ) | ||
|
|
||
| assert out.shape == pos_embeddings.shape | ||
| assert not torch.equal(out, pos_embeddings) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.