Skip to content

Commit

Permalink
fix dependency problem in valley
Browse files Browse the repository at this point in the history
  • Loading branch information
FangXinyu-0913 committed Dec 29, 2024
1 parent 4701db6 commit d53abdc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import torch
from transformers.models.qwen2_vl.modeling_qwen2_vl import Qwen2VisionTransformerPretrainedModel
from ...util.vision_encoder_config import qwen2vl_vit_config


def build_vision_tower(vision_tower_cfg, **kwargs):
from transformers.models.qwen2_vl.modeling_qwen2_vl import Qwen2VisionTransformerPretrainedModel
vision_tower = getattr(vision_tower_cfg, "mm_vision_tower", getattr(vision_tower_cfg, "vision_tower", None))
if getattr(vision_tower_cfg, "language", None) is None:
vision_tower_cfg.language = "chinese" if "chinese" in vision_tower else "english"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import torch
from torch import nn
from timm.models.layers import trunc_normal_
import torch.nn.functional as F


Expand Down Expand Up @@ -43,6 +42,7 @@ def __init__(self, embed_dim=2048, inner_dim=64, prune_ratio=0.25, **kwargs):
self.apply(self._init_weights)

def _init_weights(self, m):
from timm.models.layers import trunc_normal_
if isinstance(m, nn.Linear):
trunc_normal_(m.weight, std=.02)
if isinstance(m, nn.Linear) and m.bias is not None:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import torch
from torch import nn
from timm.models.layers import trunc_normal_
import torch.nn.functional as F


Expand Down Expand Up @@ -40,6 +39,7 @@ def __init__(self, embed_dim=2048, inner_dim=64, **kwargs):
self.apply(self._init_weights)

def _init_weights(self, m):
from timm.models.layers import trunc_normal_
if isinstance(m, nn.Linear):
trunc_normal_(m.weight, std=.02)
if isinstance(m, nn.Linear) and m.bias is not None:
Expand Down
2 changes: 1 addition & 1 deletion vlmeval/vlm/valley/valley_eagle_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import logging
from transformers import set_seed
from transformers import AutoTokenizer, AutoProcessor
from qwen_vl_utils import fetch_image, fetch_video
import re

from .valley_eagle.model.language_model.valley_qwen2 import ValleyQwen2ForCausalLM
Expand Down Expand Up @@ -240,6 +239,7 @@ def generate_inner(self, message, dataset=None):
messages_qwen = []
image_list = []
for image_file in images:
from qwen_vl_utils import fetch_image
image = fetch_image({"image": image_file})
image_list.append(image)
messages_qwen.append({'role': 'user', "content": [{"type": "text", "text": text}]})
Expand Down

0 comments on commit d53abdc

Please sign in to comment.