Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Model] Refactor BLIP/BLIP-2 to support composite model loading #8407

Merged
merged 7 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'upstream' into blip2-dynamic-lm
  • Loading branch information
DarkLight1337 committed Sep 22, 2024
commit baeaad5097d3d9d1199fb30c3c870fc73e536048
1 change: 0 additions & 1 deletion vllm/model_executor/models/blip.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Minimal implementation of BlipVisionModel intended to be only used
within a vision language model."""
from array import array
from typing import Iterable, Optional, Tuple, Union

import torch
Expand Down
1 change: 0 additions & 1 deletion vllm/model_executor/models/blip2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import itertools
from array import array
from typing import (Iterable, List, Literal, Mapping, Optional, Tuple,
TypedDict, Union)

Expand Down
7 changes: 1 addition & 6 deletions vllm/model_executor/models/llava_next.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,12 +631,7 @@ def sample(

def load_weights(self, weights: Iterable[Tuple[str, torch.Tensor]]):
# prepare weight iterators for components
(
vit_weights,
mlp_weights,
newline_weights,
llm_weights,
) = itertools.tee(weights, 4)
weights_group = group_weights_with_prefix(weights)

# load vision encoder
self.vision_tower.load_weights(weights_group["vision_tower"])
Expand Down
4 changes: 2 additions & 2 deletions vllm/model_executor/models/llava_next_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ def sample(
return self.language_model.sample(logits, sampling_metadata)

def load_weights(self, weights: Iterable[Tuple[str, torch.Tensor]]):
# prepare weight iterators
vit_weights, mlp_weights, llm_weights = itertools.tee(weights, 3)
# prepare weight iterators for components
weights_group = group_weights_with_prefix(weights)

# load vision encoder
self.vision_tower.load_weights(weights_group["vision_tower"])
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.