-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more unittests to hyena configuration
- Loading branch information
Showing
2 changed files
with
44 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from helical.models.hyena_dna.model import HyenaDNA,HyenaDNAConfig | ||
import pytest | ||
import pytest | ||
|
||
@pytest.mark.parametrize("model_name, d_model, d_inner", [ | ||
("hyenadna-tiny-1k-seqlen", 128, 512), | ||
("hyenadna-tiny-1k-seqlen-d256", 256, 1024) | ||
]) | ||
def test_hyena_dna__ok(model_name, d_model, d_inner): | ||
""" | ||
Test case for the HyenaDNA class initialization. | ||
Args: | ||
model_name (str): The name of the model. | ||
d_model (int): The dimensionality of the model. | ||
d_inner (int): The dimensionality of the inner layers. | ||
""" | ||
configurer = HyenaDNAConfig(model_name=model_name) | ||
model = HyenaDNA(configurer=configurer) | ||
assert model.config["model_name"] == model_name | ||
assert model.config["d_model"] == d_model | ||
assert model.config["d_inner"] == d_inner | ||
|
||
@pytest.mark.parametrize("model_name", [ | ||
("wrong_name") | ||
]) | ||
def test_hyena_dna__nok(model_name): | ||
""" | ||
Test case when an invalid model name is provided. | ||
Verifies that a ValueError is raised when an invalid model name is passed to the HyenaDNAConfig constructor. | ||
Parameters: | ||
- model_name (str): The invalid model name. | ||
Raises: | ||
- ValueError: If the model name is invalid. | ||
""" | ||
with pytest.raises(ValueError): | ||
HyenaDNAConfig(model_name=model_name) |
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