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

#578 Feature/sg 516 support head replacement for local pretrained weights unknown dataset

Merged
Ghost merged 1 commits into Deci-AI:master from deci-ai:feature/SG-516_support_head_replacement_for_local_pretrained_weights_unknown_dataset
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
  1. from typing import Union, Tuple
  2. from torch import nn
  3. from super_gradients.modules.conv_bn_act_block import ConvBNAct
  4. class ConvBNReLU(ConvBNAct):
  5. """
  6. Class for Convolution2d-Batchnorm2d-Relu layer. To exclude Batchnorm module use
  7. `use_normalization=False`, to exclude Relu activation use `use_activation=False`.
  8. It exists to keep backward compatibility and will be superseeded by ConvBNAct in future releases.
  9. For new classes please use ConvBNAct instead.
  10. For convolution arguments documentation see `nn.Conv2d`.
  11. For batchnorm arguments documentation see `nn.BatchNorm2d`.
  12. """
  13. def __init__(
  14. self,
  15. in_channels: int,
  16. out_channels: int,
  17. kernel_size: Union[int, Tuple[int, int]],
  18. stride: Union[int, Tuple[int, int]] = 1,
  19. padding: Union[int, Tuple[int, int]] = 0,
  20. dilation: Union[int, Tuple[int, int]] = 1,
  21. groups: int = 1,
  22. bias: bool = True,
  23. padding_mode: str = "zeros",
  24. use_normalization: bool = True,
  25. eps: float = 1e-5,
  26. momentum: float = 0.1,
  27. affine: bool = True,
  28. track_running_stats: bool = True,
  29. device=None,
  30. dtype=None,
  31. use_activation: bool = True,
  32. inplace: bool = False,
  33. ):
  34. super().__init__(
  35. in_channels=in_channels,
  36. out_channels=out_channels,
  37. kernel_size=kernel_size,
  38. padding=padding,
  39. activation_type=nn.ReLU if use_activation else None,
  40. activation_kwargs=dict(inplace=inplace) if inplace else None,
  41. stride=stride,
  42. dilation=dilation,
  43. groups=groups,
  44. bias=bias,
  45. padding_mode=padding_mode,
  46. use_normalization=use_normalization,
  47. eps=eps,
  48. momentum=momentum,
  49. affine=affine,
  50. track_running_stats=track_running_stats,
  51. device=device,
  52. dtype=dtype,
  53. )
Discard
Tip!

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