-
Notifications
You must be signed in to change notification settings - Fork 332
fix: correct 'Unsupport' typo to 'Unsupported' in error messages #1320
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -58,7 +58,7 @@ def encode(self, images: List[ImageItem]): | |||||
| t = self.load_image_func(image_data, max_num=img.extra_params["image_patch_max_num"]) | ||||||
| img_tensors.append(t) | ||||||
| else: | ||||||
| raise Exception("Unsupport input types: {} for {}".format(type(img), img)) | ||||||
| raise Exception("Unsupported input types: {} for {}".format(type(img), img)) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Raising a generic
Suggested change
|
||||||
|
|
||||||
| cur_num = img_tensors[-1].shape[0] | ||||||
| valid_ids.append([valid_id, valid_id + cur_num]) | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -138,7 +138,7 @@ def encode(self, images: List[ImageItem]): | |||||
| t = self.image_processor.preprocess(image_data, return_tensors="pt")["pixel_values"] | ||||||
| img_tensors.append(t) | ||||||
| else: | ||||||
| raise Exception("Unsupport input types: {} for {}".format(type(img), img)) | ||||||
| raise Exception("Unsupported input types: {} for {}".format(type(img), img)) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Raising a generic
Suggested change
|
||||||
|
|
||||||
| cur_num = img_tensors[-1].shape[0] | ||||||
| valid_ids.append([valid_id, valid_id + cur_num]) | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -221,7 +221,7 @@ def _init_datatype(self): | |||||
| elif self.data_type in ["fp32", "float32"]: | ||||||
| self.data_type = torch.float32 | ||||||
| else: | ||||||
| raise ValueError(f"Unsupport datatype {self.data_type}!") | ||||||
| raise ValueError(f"Unsupported datatype {self.data_type}!") | ||||||
| return | ||||||
|
|
||||||
| def rot_pos_emb(self, grid_thw): | ||||||
|
|
@@ -346,7 +346,7 @@ def load_image(self, img: List[ImageItem]): | |||||
| image_data = resize_image(image_data) | ||||||
| pixel_values, image_grid_thw = self.processor.preprocess(image_data) | ||||||
| else: | ||||||
| raise Exception("Unsupport input types: {} for {}".format(type(img), img)) | ||||||
| raise Exception("Unsupported input types: {} for {}".format(type(img), img)) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Raising a generic
Suggested change
|
||||||
| return pixel_values.to(dtype=self.data_type), image_grid_thw | ||||||
|
|
||||||
| def load_model(self, weight_dir): | ||||||
|
|
@@ -387,7 +387,7 @@ def encode(self, images: List[ImageItem]): | |||||
| img_tensors.append(pixel_values) | ||||||
| img_grids.append(image_grid_thw) | ||||||
| else: | ||||||
| raise Exception("Unsupport input types: {} for {}".format(type(img), img)) | ||||||
| raise Exception("Unsupported input types: {} for {}".format(type(img), img)) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Raising a generic
Suggested change
|
||||||
|
|
||||||
| # must devide merge_length | ||||||
| cur_num = img_tensors[-1].shape[0] // (self.spatial_merge_size ** 2) | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -235,7 +235,7 @@ def _init_datatype(self): | |||||
| elif self.data_type in ["fp32", "float32"]: | ||||||
| self.data_type = torch.float32 | ||||||
| else: | ||||||
| raise ValueError(f"Unsupport datatype {self.data_type}!") | ||||||
| raise ValueError(f"Unsupported datatype {self.data_type}!") | ||||||
| return | ||||||
|
|
||||||
| def load_model(self, weight_dir): | ||||||
|
|
@@ -319,7 +319,7 @@ def encode(self, images: List[ImageItem]): | |||||
| img_tensors.append(pixel_values) | ||||||
| img_grids.append(image_grid_thw) | ||||||
| else: | ||||||
| raise Exception("Unsupport input types: {} for {}".format(type(img), img)) | ||||||
| raise Exception("Unsupported input types: {} for {}".format(type(img), img)) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Raising a generic
Suggested change
|
||||||
|
|
||||||
| # must devide merge_length | ||||||
| cur_num = img_tensors[-1].shape[0] // (self.spatial_merge_size ** 2) | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -204,7 +204,7 @@ def _init_datatype(self): | |||||
| elif self.data_type in ["fp32", "float32"]: | ||||||
| self.data_type = torch.float32 | ||||||
| else: | ||||||
| raise ValueError(f"Unsupport datatype {self.data_type}!") | ||||||
| raise ValueError(f"Unsupported datatype {self.data_type}!") | ||||||
| return | ||||||
|
|
||||||
| def concat_img_embed_and_deepstack_features(self, image_embed, deepstack_feature_lists, valid_ids): | ||||||
|
|
@@ -388,7 +388,7 @@ def encode(self, images: List[ImageItem]): | |||||
| img_tensors.append(pixel_values) | ||||||
| img_grids.append(image_grid_thw) | ||||||
| else: | ||||||
| raise Exception("Unsupport input types: {} for {}".format(type(img), img)) | ||||||
| raise Exception("Unsupported input types: {} for {}".format(type(img), img)) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Raising a generic
Suggested change
|
||||||
|
|
||||||
| # must devide merge_length | ||||||
| cur_num = img_tensors[-1].shape[0] // (self.spatial_merge_size ** 2) | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -199,7 +199,7 @@ def _init_datatype(self): | |||||
| elif self.data_type in ["fp32", "float32"]: | ||||||
| self.data_type = torch.float32 | ||||||
| else: | ||||||
| raise ValueError(f"Unsupport datatype {self.data_type}!") | ||||||
| raise ValueError(f"Unsupported datatype {self.data_type}!") | ||||||
| return | ||||||
|
|
||||||
| def concat_img_embed_and_deepstack_features(self, image_embed, deepstack_feature_lists, valid_ids): | ||||||
|
|
@@ -386,7 +386,7 @@ def encode(self, images: List[ImageItem]): | |||||
| img_tensors.append(pixel_values) | ||||||
| img_grids.append(image_grid_thw) | ||||||
| else: | ||||||
| raise Exception("Unsupport input types: {} for {}".format(type(img), img)) | ||||||
| raise Exception("Unsupported input types: {} for {}".format(type(img), img)) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Raising a generic
Suggested change
|
||||||
|
|
||||||
| # must devide merge_length | ||||||
| cur_num = img_tensors[-1].shape[0] // (self.spatial_merge_size ** 2) | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -427,7 +427,7 @@ def encode(self, image_uuids: List): | |||||
| t = self.image_transform(image_data) | ||||||
| img_tensors.append(t) | ||||||
| else: | ||||||
| raise Exception("Unsupport input types: {} for {}".format(type(item), item)) | ||||||
| raise Exception("Unsupported input types: {} for {}".format(type(item), item)) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Raising a generic
Suggested change
|
||||||
|
|
||||||
| valid_ids.append([valid_id, valid_id + 1]) | ||||||
| valid_id += 1 | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -187,7 +187,7 @@ def __init__( | |||||
| projector_hidden_act, | ||||||
| ) | ||||||
| elif projection_head == "auto_map": | ||||||
| raise Exception("Unsupport projection_head auto_map") | ||||||
| raise Exception("Unsupported projection_head auto_map") | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Raising a generic
Suggested change
|
||||||
| elif projection_head is None: | ||||||
| self.multi_modal_projector = lambda x, *args, **kwargs: x | ||||||
| self.llm_model_type = text_config["model_type"] | ||||||
|
|
@@ -259,7 +259,7 @@ def encode(self, images: List[ImageItem]): | |||||
| img_tensors.append(pixel_values) | ||||||
| img_grids.append(image_grid_thw) | ||||||
| else: | ||||||
| raise Exception("Unsupport input types: {} for {}".format(type(img), img)) | ||||||
| raise Exception("Unsupported input types: {} for {}".format(type(img), img)) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Raising a generic
Suggested change
|
||||||
|
|
||||||
| # must devide merge_length | ||||||
| cur_num = img_tensors[-1].shape[0] // (self.merge_size ** 2) | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -155,7 +155,7 @@ def _init_datatype(self): | |||||
| elif self.data_type in ["fp32", "float32"]: | ||||||
| self.data_type = torch.float32 | ||||||
| else: | ||||||
| raise ValueError(f"Unsupport datatype {self.data_type}!") | ||||||
| raise ValueError(f"Unsupported datatype {self.data_type}!") | ||||||
|
|
||||||
| @torch.no_grad() | ||||||
| def forward(self, pixel_values): | ||||||
|
|
@@ -181,7 +181,7 @@ def encode(self, images: List[ImageItem]): | |||||
| t = self.load_image_func(image_data, max_num=img.extra_params["image_patch_max_num"]) | ||||||
| img_tensors.append(t) | ||||||
| else: | ||||||
| raise Exception("Unsupport input types: {} for {}".format(type(img), img)) | ||||||
| raise Exception("Unsupported input types: {} for {}".format(type(img), img)) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Raising a generic
Suggested change
|
||||||
|
|
||||||
| cur_num = img.token_num | ||||||
| valid_ids.append([valid_id, valid_id + cur_num]) | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raising a generic
Exceptionis discouraged in Python. It is better to raise a more specific exception likeTypeErrorwhen encountering an unsupported input type. Additionally, using f-strings is preferred over.format()for better readability and consistency.