Update modeling_pixel.py
Browse files- modeling_pixel.py +8 -6
modeling_pixel.py
CHANGED
|
@@ -19,18 +19,20 @@ class ResidualBlock(nn.Module):
|
|
| 19 |
|
| 20 |
class TopAIImageGenerator(PreTrainedModel):
|
| 21 |
config_class = TopAIImageConfig
|
| 22 |
-
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
def __init__(self, config):
|
| 26 |
super().__init__(config)
|
| 27 |
-
|
|
|
|
| 28 |
|
| 29 |
self.text_projection = nn.Linear(config.input_dim, 4 * 4 * h)
|
| 30 |
|
| 31 |
-
# ืื ืืื ืืื ืืืช ืฉืืชืืืื ืืืฉืงืืืืช
|
| 32 |
self.decoder = nn.Sequential(
|
| 33 |
-
# ืฉืืื 0: ื-512 ื-512 (ืืื ืื
|
| 34 |
self._upsample(h, h),
|
| 35 |
# ืฉืืื 1
|
| 36 |
ResidualBlock(h),
|
|
@@ -59,7 +61,7 @@ class TopAIImageGenerator(PreTrainedModel):
|
|
| 59 |
)
|
| 60 |
|
| 61 |
def forward(self, text_embeddings):
|
| 62 |
-
#
|
| 63 |
x = self.text_projection(text_embeddings)
|
| 64 |
x = x.view(-1, self.config.hidden_dim, 4, 4)
|
| 65 |
return self.decoder(x)
|
|
|
|
| 19 |
|
| 20 |
class TopAIImageGenerator(PreTrainedModel):
|
| 21 |
config_class = TopAIImageConfig
|
| 22 |
+
|
| 23 |
+
# ืชืืงืื ื-AttributeError: ืืืื ืืืืืช ืืืืื (dict) ืืื ืฉืชืืื ืื ืืชืืื .keys()
|
| 24 |
+
all_tied_weights_keys = {}
|
| 25 |
|
| 26 |
def __init__(self, config):
|
| 27 |
super().__init__(config)
|
| 28 |
+
# ืฉืืืืฉ ื-hidden_dim ืืืงืื ืคืื (512)
|
| 29 |
+
h = config.hidden_dim
|
| 30 |
|
| 31 |
self.text_projection = nn.Linear(config.input_dim, 4 * 4 * h)
|
| 32 |
|
| 33 |
+
# ืื ืืื ืืื ืืืช ืฉืืชืืืื ืืืืืง ืืืฉืงืืืืช ื-Safetensors
|
| 34 |
self.decoder = nn.Sequential(
|
| 35 |
+
# ืฉืืื 0: ื-512 ื-512 (ืืื ืืื ื-Mismatch)
|
| 36 |
self._upsample(h, h),
|
| 37 |
# ืฉืืื 1
|
| 38 |
ResidualBlock(h),
|
|
|
|
| 61 |
)
|
| 62 |
|
| 63 |
def forward(self, text_embeddings):
|
| 64 |
+
# ืฉืื ืื ืฆืืจื ืืืคืช ืืืคืืื ืื ืจืืฉืื ืืช
|
| 65 |
x = self.text_projection(text_embeddings)
|
| 66 |
x = x.view(-1, self.config.hidden_dim, 4, 4)
|
| 67 |
return self.decoder(x)
|