Upload model.py with huggingface_hub
Browse files
model.py
CHANGED
|
@@ -4,7 +4,7 @@ import torch.nn as nn
|
|
| 4 |
import torchvision
|
| 5 |
import torch.nn.functional as F
|
| 6 |
from torchvision.transforms import functional as FF
|
| 7 |
-
from transformers import PretrainedConfig
|
| 8 |
|
| 9 |
######################################################################
|
| 10 |
# Configuration File
|
|
@@ -223,10 +223,10 @@ class Decoder(nn.Module):
|
|
| 223 |
x = self.double_conv(x)
|
| 224 |
return x
|
| 225 |
|
| 226 |
-
class VesselSegmentModel(
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
# image patch
|
| 231 |
self.img_patch = ImagePatching(patch_size=config.patch_size)
|
| 232 |
|
|
|
|
| 4 |
import torchvision
|
| 5 |
import torch.nn.functional as F
|
| 6 |
from torchvision.transforms import functional as FF
|
| 7 |
+
from transformers import PretrainedConfig, PreTrainedModel
|
| 8 |
|
| 9 |
######################################################################
|
| 10 |
# Configuration File
|
|
|
|
| 223 |
x = self.double_conv(x)
|
| 224 |
return x
|
| 225 |
|
| 226 |
+
class VesselSegmentModel(PreTrainedModel):
|
| 227 |
+
config_class = VesselSegmentConfig
|
| 228 |
+
def __init__(self, config: VesselSegmentConfig=VesselSegmentConfig()):
|
| 229 |
+
super().__init__(config)
|
| 230 |
# image patch
|
| 231 |
self.img_patch = ImagePatching(patch_size=config.patch_size)
|
| 232 |
|