From ec9560257e60094ecc09c7e594b8f4ee79d6b359 Mon Sep 17 00:00:00 2001 From: ydshieh Date: Tue, 16 Apr 2024 19:51:47 +0200 Subject: [PATCH] fix --- src/transformers/models/layoutlmv2/modeling_layoutlmv2.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py b/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py index 41939b044a8438..b4c03f4b033f26 100755 --- a/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py +++ b/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py @@ -697,6 +697,7 @@ def __init__(self, config): self.visual_proj = nn.Linear(config.image_feature_pool_shape[-1], config.hidden_size) if self.has_visual_segment_embedding: self.visual_segment_embedding = nn.Parameter(nn.Embedding(1, config.hidden_size).weight[0]) + self.visual_segment_embedding.data.normal_(mean=0.0, std=self.config.initializer_range) self.visual_LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.visual_dropout = nn.Dropout(config.hidden_dropout_prob)