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

#433 Feature/SG 143 black formatter

Merged
Ghost merged 1 commits into Deci-AI:master from deci-ai:feature/SG-143-black-formatter
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
73
74
75
76
77
78
79
  1. class KDModelException(Exception):
  2. """Exception raised illegal training param format.
  3. Attributes:
  4. message -- explanation of the error
  5. """
  6. def __init__(self, desc):
  7. self.message = "KDTrainer: " + desc
  8. super().__init__(self.message)
  9. class ArchitectureKwargsException(KDModelException):
  10. """Exception raised when subnet architectures are not defined.
  11. Attributes:
  12. message -- explanation of the error
  13. """
  14. def __init__(self):
  15. super().__init__(
  16. "When architecture is not intialized both student_architecture and teacher_architecture must be passed "
  17. "through **kwargs")
  18. class UnsupportedKDArchitectureException(KDModelException):
  19. """Exception raised for unsupported kd architecture.
  20. Attributes:
  21. message -- explanation of the error
  22. """
  23. def __init__(self, architecture):
  24. super().__init__("Unsupported KD architecture: " + str(architecture))
  25. class InconsistentParamsException(KDModelException):
  26. """Exception raised when values between arch_params/checkpoint_params should be equivalent.
  27. Attributes:
  28. message -- explanation of the error
  29. """
  30. def __init__(self, inconsistent_key1: str, inconsistent_key1_container_name: str, inconsistent_key2: str,
  31. inconsistent_key2_container_name: str, ):
  32. super().__init__(f"{inconsistent_key1} in {inconsistent_key1_container_name} must be equal to "
  33. f"{inconsistent_key2} in {inconsistent_key2_container_name}")
  34. class UnsupportedKDModelArgException(KDModelException):
  35. """Exception raised for unsupported args that might be supported for Trainer but not for KDTrainer.
  36. Attributes:
  37. message -- explanation of the error
  38. """
  39. def __init__(self, param_name: str, dict_name: str):
  40. super().__init__(param_name + " in " + dict_name + " not supported for KD models.")
  41. class TeacherKnowledgeException(KDModelException):
  42. """Exception raised when teacher net doesn't hold any knowledge (i.e weights are the initial ones).
  43. Attributes:
  44. message -- explanation of the error
  45. """
  46. def __init__(self):
  47. super().__init__("Expected: at least one of: teacher_pretrained_weights, teacher_checkpoint_path or load_kd_trainer_checkpoint=True")
  48. class UndefinedNumClassesException(KDModelException):
  49. """Exception raised when num_classes is not defined for subnets (and cannot be derived).
  50. Attributes:
  51. message -- explanation of the error
  52. """
  53. def __init__(self):
  54. 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