[Model] Remove unnecessary weight initialization logic (#11736)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk> Signed-off-by: Isotr0py <2037008807@qq.com> Co-authored-by: Isotr0py <2037008807@qq.com>
This commit is contained in:
@@ -3,7 +3,6 @@ from typing import (Callable, Iterable, List, Mapping, Optional, Set, Tuple,
|
||||
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
from torch.nn.init import trunc_normal_
|
||||
from transformers import BatchFeature, PretrainedConfig
|
||||
|
||||
from vllm.attention import AttentionMetadata
|
||||
@@ -216,9 +215,7 @@ class AriaProjector(nn.Module):
|
||||
self.num_heads = num_heads
|
||||
|
||||
self.query = nn.Parameter(
|
||||
torch.zeros(max(patch_to_query_dict.values()), self.embed_dim))
|
||||
|
||||
trunc_normal_(self.query, std=0.02)
|
||||
torch.empty(max(patch_to_query_dict.values()), self.embed_dim))
|
||||
|
||||
self.cross_attn = CrossAttention(kv_dim, embed_dim, num_heads)
|
||||
|
||||
|
||||
@@ -141,8 +141,6 @@ class Resampler2_5(BaseResampler):
|
||||
self.max_size = max_size
|
||||
self._set_2d_pos_cache(self.max_size)
|
||||
|
||||
self.apply(self._init_weights)
|
||||
|
||||
def _set_2d_pos_cache(self,
|
||||
max_size: Tuple[int, int],
|
||||
device: torch.types.Device = "cpu") -> None:
|
||||
|
||||
Reference in New Issue
Block a user