Instructions to use HichTala/DiffusionDet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HichTala/DiffusionDet with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("object-detection", model="HichTala/DiffusionDet", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("HichTala/DiffusionDet", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Update modeling_diffusiondet.py
Browse files- modeling_diffusiondet.py +4 -4
modeling_diffusiondet.py
CHANGED
|
@@ -128,12 +128,12 @@ class DiffusionDet(PreTrainedModel):
|
|
| 128 |
|
| 129 |
def _init_weights(self, module):
|
| 130 |
if isinstance(module, nn.Linear) or isinstance(module, nn.Conv2d):
|
| 131 |
-
init.kaiming_normal_(m.weight, mode='fan_in', nonlinearity='relu')
|
| 132 |
if module.bias is not None:
|
| 133 |
-
init.constant_(module.bias, 0)
|
| 134 |
elif isinstance(module, nn.BatchNorm2d):
|
| 135 |
-
init.constant_(module.weight, 1)
|
| 136 |
-
init.constant_(module.bias, 0)
|
| 137 |
|
| 138 |
def predict_noise_from_start(self, x_t, t, x0):
|
| 139 |
return (
|
|
|
|
| 128 |
|
| 129 |
def _init_weights(self, module):
|
| 130 |
if isinstance(module, nn.Linear) or isinstance(module, nn.Conv2d):
|
| 131 |
+
torch.nn.init.kaiming_normal_(m.weight, mode='fan_in', nonlinearity='relu')
|
| 132 |
if module.bias is not None:
|
| 133 |
+
torch.nn.init.constant_(module.bias, 0)
|
| 134 |
elif isinstance(module, nn.BatchNorm2d):
|
| 135 |
+
torch.nn.init.constant_(module.weight, 1)
|
| 136 |
+
torch.nn.init.constant_(module.bias, 0)
|
| 137 |
|
| 138 |
def predict_noise_from_start(self, x_t, t, x0):
|
| 139 |
return (
|