-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8830bdb
commit 9167693
Showing
12 changed files
with
145 additions
and
97 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: Pytest | ||
|
||
on: [push, pull_request] | ||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
This file contains 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 |
---|---|---|
|
@@ -3,7 +3,6 @@ lightning | |
torchmetrics | ||
rich | ||
fair-esm | ||
jsonargparse | ||
wandb | ||
tokenizers | ||
transformers | ||
|
This file contains 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 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,24 +1,18 @@ | ||
from argparse import Namespace | ||
|
||
import pytest | ||
import torch | ||
|
||
from ..model import poolings | ||
|
||
|
||
@pytest.fixture | ||
def sample_input(): | ||
# Create a sample input tensor of shape (batch_size, seq_len, embedding_dim) | ||
return torch.randn(4, 10, 8) # Example: batch_size=4, seq_len=10, embedding_dim=8 | ||
from .fixtures import sample_batch_x, sample_config | ||
|
||
|
||
@pytest.mark.parametrize("pooling_layer", [x for x in poolings.values()]) | ||
def test_pooling(sample_input, pooling_layer): | ||
def test_pooling(sample_batch_x, sample_config, pooling_layer): | ||
"""Test the pooling layer.""" | ||
# Create an instance of the pooling layer | ||
pooling = pooling_layer(input_dim=sample_input.shape[-1]) | ||
pooling = pooling_layer(sample_config) | ||
|
||
# Test the forward method | ||
output = pooling(sample_input) | ||
assert output.shape == (sample_input.shape[0], sample_input.shape[-1]) | ||
|
||
|
||
if __name__ == "__main__": | ||
pytest.main() | ||
output = pooling(sample_batch_x) | ||
assert output.shape == (sample_batch_x.shape[0], sample_batch_x.shape[-1]) |
This file contains 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
Oops, something went wrong.