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
Upload modeling_diffusiondet.py
Browse files- modeling_diffusiondet.py +3 -0
modeling_diffusiondet.py
CHANGED
|
@@ -126,6 +126,9 @@ class DiffusionDet(PreTrainedModel):
|
|
| 126 |
|
| 127 |
self.criterion = CriterionDynamicK(config, num_classes=self.num_classes, weight_dict=weight_dict)
|
| 128 |
|
|
|
|
|
|
|
|
|
|
| 129 |
def predict_noise_from_start(self, x_t, t, x0):
|
| 130 |
return (
|
| 131 |
(extract(self.sqrt_recip_alphas_cumprod, t, x_t.shape) * x_t - x0) /
|
|
|
|
| 126 |
|
| 127 |
self.criterion = CriterionDynamicK(config, num_classes=self.num_classes, weight_dict=weight_dict)
|
| 128 |
|
| 129 |
+
def _init_weights(self, module):
|
| 130 |
+
torch.nn.init.xavier_uniform(module.weight)
|
| 131 |
+
|
| 132 |
def predict_noise_from_start(self, x_t, t, x0):
|
| 133 |
return (
|
| 134 |
(extract(self.sqrt_recip_alphas_cumprod, t, x_t.shape) * x_t - x0) /
|