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

#970 Update YoloNASQuickstart.md

Merged
Ghost merged 1 commits into Deci-AI:master from deci-ai:bugfix/SG-000_fix_readme_yolonas_snippets
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
  1. class KDModelException(Exception):
  2. """Exception raised illegal training param format.
  3. :param desc: Explanation of the error
  4. """
  5. def __init__(self, desc: str):
  6. self.message = "KDTrainer: " + desc
  7. super().__init__(self.message)
  8. class ArchitectureKwargsException(KDModelException):
  9. """Exception raised when subnet architectures are not defined."""
  10. def __init__(self):
  11. super().__init__("When architecture is not intialized both student_architecture and teacher_architecture must be passed " "through **kwargs")
  12. class UnsupportedKDArchitectureException(KDModelException):
  13. """Exception raised for unsupported kd architecture.
  14. :param architecture: Explanation of the error
  15. """
  16. def __init__(self, architecture: str):
  17. super().__init__("Unsupported KD architecture: " + str(architecture))
  18. class InconsistentParamsException(KDModelException):
  19. """Exception raised when values between arch_params/checkpoint_params should be equivalent.
  20. :param inconsistent_key1: Name of the key provided
  21. :param inconsistent_key1_container_name: Container name of the key provided
  22. :param inconsistent_key2: Name of the key expected
  23. :param inconsistent_key2_container_name: Container name of the key expected
  24. """
  25. def __init__(
  26. self,
  27. inconsistent_key1: str,
  28. inconsistent_key1_container_name: str,
  29. inconsistent_key2: str,
  30. inconsistent_key2_container_name: str,
  31. ):
  32. super().__init__(
  33. f"{inconsistent_key1} in {inconsistent_key1_container_name} must be equal to " f"{inconsistent_key2} in {inconsistent_key2_container_name}"
  34. )
  35. class UnsupportedKDModelArgException(KDModelException):
  36. """Exception raised for unsupported args that might be supported for Trainer but not for KDTrainer.
  37. :param param_name: Name of the param that is not supported
  38. :param dict_name: Name of the dict including the param that is not supported
  39. """
  40. def __init__(self, param_name: str, dict_name: str):
  41. super().__init__(param_name + " in " + dict_name + " not supported for KD models.")
  42. class TeacherKnowledgeException(KDModelException):
  43. """Exception raised when teacher net doesn't hold any knowledge (i.e weights are the initial ones)."""
  44. def __init__(self):
  45. super().__init__("Expected: at least one of: teacher_pretrained_weights, teacher_checkpoint_path or load_kd_trainer_checkpoint=True")
  46. class UndefinedNumClassesException(KDModelException):
  47. """Exception raised when num_classes is not defined for subnets (and cannot be derived)."""
  48. def __init__(self):
  49. super().__init__("Number of classes must be defined in students and teachers arch params or by connecting to a dataset interface")
Discard
Tip!

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