Skip to content

Commit 2fdb29f

Browse files
committed
test wildcard imports for models
1 parent 9cd88d2 commit 2fdb29f

File tree

5 files changed

+62
-2
lines changed

5 files changed

+62
-2
lines changed

modelindex/models/Model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Model(BaseModelIndex):
2626
]
2727

2828
def __init__(self,
29-
name: str,
29+
name: str = None,
3030
metadata: Union[Dict, Metadata, str] = None,
3131
results: Union[List, ResultList, Result, Dict, str] = None,
3232
paper: Union[str, Dict] = None,
@@ -145,7 +145,7 @@ def from_dict(cls, d: Dict, _filepath: str = None, _path_to_readme: str = None):
145145
dd[field_name] = dd.pop(lc_keys[key])
146146

147147
if _path_to_readme:
148-
dd["README"] = _path_to_readme
148+
dd["readme"] = _path_to_readme
149149

150150
return cls(
151151
_filepath=_filepath,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Collections:
2+
- Name: Inception v3
3+
Metadata:
4+
Training Data: ImageNet
5+
Training Techniques:
6+
- RMSProp
7+
- Weight Decay
8+
- Gradient Clipping
9+
- Label Smoothing
10+
Training Resources: 8x V100 GPUs
11+
Architecture:
12+
- Auxiliary Classifier
13+
- Inception-v3 Module
14+
Paper: https://arxiv.org/abs/1512.00567v3
15+
Code: https://github.com/rwightman/pytorch-image-models/blob/timm/models/inception_v3.py#L442
16+
README: docs/inception-v3-readme.md
17+
18+
Models:
19+
- models_md/*.md
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!--
2+
Models:
3+
- Name: Inception v3 - 90 epochs
4+
In Collection: Inception v3
5+
Metadata:
6+
Epochs: 90
7+
Results:
8+
- Task: Image Classification
9+
Dataset: ImageNet
10+
Metrics:
11+
Top 1 Accuracy: 74.67%
12+
Top 5 Accuracy: 92.1%
13+
Weights: https://download.pytorch.org/models/inception_v3_google-1a9a5a14.pth
14+
-->
15+
16+
something here.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!--
2+
Models:
3+
- Name: Inception v3 - 120 epochs
4+
In Collection: Inception v3
5+
Metadata:
6+
Epochs: 120
7+
Results:
8+
- Task: Image Classification
9+
Dataset: ImageNet
10+
Metrics:
11+
Top 1 Accuracy: 75.1%
12+
Top 5 Accuracy: 93.1%
13+
Weights: https://download.pytorch.org/models/inception_v3_google-120-1a9a5afd.pth
14+
-->
15+
16+
# Second here

tests/test_import.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,12 @@ def test_wildcard_model_import():
142142
assert mi.models[0].results[0].metrics["Top 1 Accuracy"] == "11%"
143143
assert mi.models[0].results[1].metrics["Top 1 Accuracy"] == "21%"
144144

145+
146+
def test_models_import_wildcard():
147+
mi = modelindex.load("tests/test-mi/13_wildcard_model_imports/mi8.yml")
148+
149+
assert len(mi.collections) == 1
150+
assert len(mi.models) == 2
151+
152+
assert mi.models[0].readme == "models_md/m1.md"
153+
assert mi.models[1].readme == "models_md/m2.md"

0 commit comments

Comments
 (0)