Skip to content

Commit

Permalink
super().collect_images->self.collect_images
Browse files Browse the repository at this point in the history
  • Loading branch information
lvhan028 committed Dec 4, 2024
1 parent dc9757c commit d577acb
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lmdeploy/vl/model/cogvlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def build_model(self):

def preprocess(self, messages: List[Dict]) -> List[Dict]:
"""refer to the spec of `super().preprocess`"""
images = super().collect_images(messages)
images = self.collect_images(messages)
outputs = []
for image, _ in images:
image = image.convert('RGB')
Expand Down
2 changes: 1 addition & 1 deletion lmdeploy/vl/model/deepseek.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def build_model(self):

def preprocess(self, messages: List[Dict]) -> List[Dict]:
"""refers to the spec of `super.preprocess()"""
images = super().collect_images(messages)
images = self.collect_images(messages)
outputs = []
for image, _ in images:
image = image.convert('RGB')
Expand Down
2 changes: 1 addition & 1 deletion lmdeploy/vl/model/glm_4v.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def build_model(self):

def preprocess(self, messages: List[Dict]) -> List[Dict]:
"""refers to the spec of `super.preprocess()"""
images = super().collect_images(messages)
images = self.collect_images(messages)
outputs = []
for image, params in images:
image = image.convert('RGB')
Expand Down
2 changes: 1 addition & 1 deletion lmdeploy/vl/model/internvl.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def _forward(self, inputs):

def preprocess(self, messages: List[Dict]) -> List[Dict]:
"""refers to `super.preprocess() for spec."""
images = super().collect_images(messages)
images = self.collect_images(messages)
outputs = []
for image, params in images:
image = image.convert('RGB')
Expand Down
2 changes: 1 addition & 1 deletion lmdeploy/vl/model/llava.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def encode_images(self, images: torch.Tensor) -> torch.Tensor:

def preprocess(self, messages: List[Dict]) -> List[Dict]:
"""refer to `super().preprocess() for spec."""
images = super().collect_images(messages)
images = self.collect_images(messages)
outputs = []
for image, params in images:
image = image.convert('RGB')
Expand Down
2 changes: 1 addition & 1 deletion lmdeploy/vl/model/llava_hf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def build_model(self):

def preprocess(self, messages: List[Dict]) -> List[Dict]:
"""refers to `super.preprocess() for spec."""
images = super().collect_images(messages)
images = self.collect_images(messages)
outputs = []
for image, params in images:
image = image.convert('RGB')
Expand Down
2 changes: 1 addition & 1 deletion lmdeploy/vl/model/llava_next.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def preprocess(self, messages: List[Dict]) -> List[Dict]:
"""refers to the spec of `super.preprocess()"""
from transformers.models.llava_next.modeling_llava_next import \
image_size_to_num_patches
images = super().collect_images(messages)
images = self.collect_images(messages)
outputs = []
for image, params in images:
image = image.convert('RGB')
Expand Down
6 changes: 3 additions & 3 deletions lmdeploy/vl/model/mllama.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ def build_preprocessor(self):
self.image_token_id = 128256

def build_model(self):
assert 0, 'cogvlm is not supported by turbomind'
assert 0, 'mllama is not supported by turbomind'

def preprocess(self, messages: List[Dict]) -> List[Dict]:
"""refer to the spec of `super().preprocess`"""
images = super().collect_images(messages)
images = self.collect_images(messages)
outputs = []
for image, params in images:
image = image.convert('RGB')
Expand Down Expand Up @@ -77,4 +77,4 @@ def to_pytorch(self, messages, chat_template, tokenizer, sequence_start):
sequence_start)

def to_turbomind(self, messages, chat_template, sequence_start):
assert 0, 'cogvlm is not supported by turbomind'
assert 0, 'mllama is not supported by turbomind'
4 changes: 2 additions & 2 deletions lmdeploy/vl/model/phi3_vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def build_preprocessor(self):
trust_remote_code=True)
if hasattr(processor, 'tokenizer'):
del processor.tokenizer
processor.prtokenizer = None
processor.tokenizer = None
self.processor = processor.image_processor
self.processor = processor

Expand Down Expand Up @@ -184,7 +184,7 @@ def build_model(self):

def preprocess(self, messages: List[Dict]) -> List[Dict]:
"""refers to `super.preprocess() for spec."""
images = super().collect_images(messages)
images = self.collect_images(messages)
outputs = []
for image, params in images:
image = image.convert('RGB')
Expand Down
2 changes: 1 addition & 1 deletion lmdeploy/vl/model/qwen.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def build_model(self):

def preprocess(self, messages: List[Dict]) -> List[Dict]:
"""refers to `super.preprocess() for spec."""
images = super().collect_images(messages)
images = self.collect_images(messages)
outputs = []
for image, params in images:
image = image.convert('RGB')
Expand Down
2 changes: 1 addition & 1 deletion lmdeploy/vl/model/qwen2.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def preprocess(self, messages: List[Dict]) -> List[Dict]:
"""refer to `super().preprocess()` for spec."""
from qwen_vl_utils import process_vision_info

images = super().collect_images(messages)
images = self.collect_images(messages)
optional_keys = {
'resized_height', 'resized_width', 'min_pixels', 'max_pixels'
}
Expand Down
2 changes: 1 addition & 1 deletion lmdeploy/vl/model/xcomposer2.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def _preprocess_4khd_7b(self, image: Image, params: Dict) -> Dict:

def preprocess(self, messages: List[Dict]) -> List[Dict]:
"""refer to `super().preprocess() for spec."""
images = super().collect_images(messages)
images = self.collect_images(messages)
outputs = []
for image, params in images:
image = image.convert('RGB')
Expand Down
2 changes: 1 addition & 1 deletion lmdeploy/vl/model/yi.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def build_model(self):

def preprocess(self, messages: List[Dict]) -> List[Dict]:
"""refer to `super().preprocess() for spec."""
images = super().collect_images(messages)
images = self.collect_images(messages)
outputs = []
for image, params in images:
image = image.convert('RGB')
Expand Down

0 comments on commit d577acb

Please sign in to comment.