Skip to content

Commit bf05236

Browse files
authored
Add Initial unit test example: Model_Config (#1524)
1 parent 02d1a59 commit bf05236

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

install/requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ cmake>=3.24, < 4.0.0 # 4.0 is BC breaking
2727
ninja
2828
zstd
2929

30+
# Test tools
31+
pytest
32+
3033
# Browser mode
3134
streamlit
3235

pytest.ini

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[pytest]
2+
markers =
3+
model_config: Tests related to model config
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import pytest
2+
from torchchat.model_config.model_config import load_model_configs, resolve_model_config
3+
4+
5+
TEST_CONFIG = "meta-llama/llama-3.2-11b-vision"
6+
TEST_CONFIG_NAME = "meta-llama/Llama-3.2-11B-Vision"
7+
8+
9+
@pytest.mark.model_config
10+
def test_load_model_configs():
11+
configs = load_model_configs()
12+
assert TEST_CONFIG in configs
13+
assert configs[TEST_CONFIG].name == TEST_CONFIG_NAME
14+
15+
16+
@pytest.mark.model_config
17+
def test_resolve_model_config():
18+
config = resolve_model_config(TEST_CONFIG)
19+
print(config)
20+
assert config.name == TEST_CONFIG_NAME
21+
assert config.checkpoint_file == "model.pth"
22+
23+
with pytest.raises(ValueError):
24+
resolve_model_config("UnknownModel")

0 commit comments

Comments
 (0)