Skip to content

Commit

Permalink
Refers to tyxsspa#98: fixes reproduce stablility
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxsspa committed Jun 21, 2024
1 parent dcc9fbb commit c1ffbb4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cldm/embedding_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import torch.nn as nn
import torch.nn.functional as F
from functools import partial
from ldm.modules.diffusionmodules.util import conv_nd, linear
from ldm.modules.diffusionmodules.util import conv_nd, linear, zero_module


def get_clip_token_for_string(tokenizer, string):
Expand Down Expand Up @@ -102,7 +102,10 @@ def __init__(
if add_pos:
self.position_encoder = EncodeNet(position_channels, token_dim)
if emb_type == 'ocr':
self.proj = linear(40*64, token_dim)
self.proj = nn.Sequential(
zero_module(linear(40*64, token_dim)),
nn.LayerNorm(token_dim)
)
if emb_type == 'conv':
self.glyph_encoder = EncodeNet(glyph_channels, token_dim)

Expand Down

0 comments on commit c1ffbb4

Please sign in to comment.