Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

#548 Split and rename the modules from super_gradients.common.environment

Merged
Ghost merged 1 commits into Deci-AI:master from deci-ai:hotfix/SG-000-refactor_environment_package
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  1. import os.path
  2. import unittest
  3. import hydra
  4. import pkg_resources
  5. import torch
  6. from hydra import initialize_config_dir, compose
  7. from hydra.core.global_hydra import GlobalHydra
  8. from super_gradients.training.models.detection_models.csp_resnet import CSPResNet
  9. from super_gradients.training.utils.hydra_utils import normalize_path
  10. class PPYoloETests(unittest.TestCase):
  11. def get_model_arch_params(self, config_name):
  12. GlobalHydra.instance().clear()
  13. sg_recipes_dir = pkg_resources.resource_filename("super_gradients.recipes", "")
  14. with initialize_config_dir(config_dir=normalize_path(sg_recipes_dir), version_base="1.2"):
  15. cfg = compose(config_name=normalize_path(config_name))
  16. cfg = hydra.utils.instantiate(cfg)
  17. arch_params = cfg.arch_params
  18. return arch_params
  19. def _test_csp_resnet_variant(self, variant):
  20. arch_params = self.get_model_arch_params(os.path.join("arch_params", variant))
  21. ppyoloe = CSPResNet(**arch_params)
  22. dummy_input = torch.randn(1, 3, 320, 320)
  23. with torch.no_grad():
  24. feature_maps = ppyoloe(dummy_input)
  25. self.assertEqual(len(feature_maps), 3)
  26. def test_csp_resnet_s(self):
  27. self._test_csp_resnet_variant("csp_resnet_l_arch_params")
  28. def test_csp_resnet_m(self):
  29. self._test_csp_resnet_variant("csp_resnet_m_arch_params")
  30. def test_csp_resnet_l(self):
  31. self._test_csp_resnet_variant("csp_resnet_l_arch_params")
  32. def test_csp_resnet_x(self):
  33. self._test_csp_resnet_variant("csp_resnet_x_arch_params")
  34. if __name__ == "__main__":
  35. unittest.main()
Discard
Tip!

Press p or to see the previous file or, n or to see the next file