test_model_zoo.py 653 Bytes
Newer Older
1
2
3
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved

facebook-github-bot's avatar
facebook-github-bot committed
4
5
import unittest

6
import torch.nn as nn
facebook-github-bot's avatar
facebook-github-bot committed
7
from d2go.model_zoo import model_zoo
Yanghan Wang's avatar
Yanghan Wang committed
8
from mobile_cv.common.misc.oss_utils import is_oss
facebook-github-bot's avatar
facebook-github-bot committed
9
10
11


class TestD2GoModelZoo(unittest.TestCase):
Yanghan Wang's avatar
Yanghan Wang committed
12
    @unittest.skipIf(is_oss(), "Model Zoo is not available in OSS")
facebook-github-bot's avatar
facebook-github-bot committed
13
14
15
16
    def test_model_zoo_pretrained(self):
        configs = list(model_zoo._ModelZooUrls.CONFIG_PATH_TO_URL_SUFFIX.keys())
        for cfgfile in configs:
            model = model_zoo.get(cfgfile, trained=True)
17
            self.assertTrue(isinstance(model, nn.Module))
facebook-github-bot's avatar
facebook-github-bot committed
18

Yanghan Wang's avatar
Yanghan Wang committed
19

facebook-github-bot's avatar
facebook-github-bot committed
20
21
if __name__ == "__main__":
    unittest.main()