安觅
commited on
Commit
·
49684a2
1
Parent(s):
62757d1
update
Browse files- modeling_logics.py +3 -3
modeling_logics.py
CHANGED
|
@@ -31,7 +31,7 @@ from transformers.modeling_outputs import CausalLMOutputWithPast
|
|
| 31 |
from transformers.generation.utils import GenerateOutput
|
| 32 |
|
| 33 |
|
| 34 |
-
|
| 35 |
IGNORE_INDEX = -100
|
| 36 |
IMAGE_TOKEN_INDEX = -200
|
| 37 |
DEFAULT_IMAGE_TOKEN = "<image>"
|
|
@@ -39,7 +39,7 @@ DEFAULT_IMAGE_PATCH_TOKEN = "<im_patch>"
|
|
| 39 |
DEFAULT_IM_START_TOKEN = "<im_start>"
|
| 40 |
DEFAULT_IM_END_TOKEN = "<im_end>"
|
| 41 |
|
| 42 |
-
|
| 43 |
def select_best_resolution(original_size, possible_resolutions):
|
| 44 |
"""
|
| 45 |
Selects the best resolution from a list of possible resolutions based on the original size.
|
|
@@ -310,7 +310,7 @@ class LogicsMetaForCausalLM(ABC):
|
|
| 310 |
if self.config.add_faster_video:
|
| 311 |
cur_mm_spatial_pool_stride = cur_mm_spatial_pool_stride * 2
|
| 312 |
faster_video_feature = self.get_2dPool(feat,cur_mm_spatial_pool_stride)
|
| 313 |
-
|
| 314 |
if slower_img_feat != 0:
|
| 315 |
all_videos_or_images_features.append(slower_img_feat)
|
| 316 |
else:
|
|
|
|
| 31 |
from transformers.generation.utils import GenerateOutput
|
| 32 |
|
| 33 |
|
| 34 |
+
|
| 35 |
IGNORE_INDEX = -100
|
| 36 |
IMAGE_TOKEN_INDEX = -200
|
| 37 |
DEFAULT_IMAGE_TOKEN = "<image>"
|
|
|
|
| 39 |
DEFAULT_IM_START_TOKEN = "<im_start>"
|
| 40 |
DEFAULT_IM_END_TOKEN = "<im_end>"
|
| 41 |
|
| 42 |
+
|
| 43 |
def select_best_resolution(original_size, possible_resolutions):
|
| 44 |
"""
|
| 45 |
Selects the best resolution from a list of possible resolutions based on the original size.
|
|
|
|
| 310 |
if self.config.add_faster_video:
|
| 311 |
cur_mm_spatial_pool_stride = cur_mm_spatial_pool_stride * 2
|
| 312 |
faster_video_feature = self.get_2dPool(feat,cur_mm_spatial_pool_stride)
|
| 313 |
+
|
| 314 |
if slower_img_feat != 0:
|
| 315 |
all_videos_or_images_features.append(slower_img_feat)
|
| 316 |
else:
|