[Bugfix] Fix extra whitespace in strings caused by newline (#23272)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
@ -958,8 +958,10 @@ class InstructCoderDataset(HuggingFaceDataset):
|
||||
for i, item in enumerate(self.data):
|
||||
if len(sampled_requests) >= num_requests:
|
||||
break
|
||||
prompt = f"{item['input']}\n\n{item['instruction']} Just output \
|
||||
the code, do not include any explanation."
|
||||
prompt = (
|
||||
f"{item['input']}\n\n{item['instruction']} Just output "
|
||||
"the code, do not include any explanation."
|
||||
)
|
||||
|
||||
# apply template
|
||||
prompt = tokenizer.apply_chat_template(
|
||||
|
@ -283,8 +283,10 @@ def run_glm4v(questions: list[str], modality: str) -> ModelRequestData:
|
||||
)
|
||||
|
||||
prompts = [
|
||||
f"<|user|>\n<|begin_of_image|><|endoftext|><|end_of_image|>\
|
||||
{question}<|assistant|>"
|
||||
(
|
||||
"<|user|>\n<|begin_of_image|><|endoftext|><|end_of_image|>"
|
||||
f"{question}<|assistant|>"
|
||||
)
|
||||
for question in questions
|
||||
]
|
||||
|
||||
@ -767,15 +769,13 @@ def run_llava_next_video(questions: list[str], modality: str) -> ModelRequestDat
|
||||
def run_llava_onevision(questions: list[str], modality: str) -> ModelRequestData:
|
||||
if modality == "video":
|
||||
prompts = [
|
||||
f"<|im_start|>user <video>\n{question}<|im_end|> \
|
||||
<|im_start|>assistant\n"
|
||||
f"<|im_start|>user <video>\n{question}<|im_end|><|im_start|>assistant\n"
|
||||
for question in questions
|
||||
]
|
||||
|
||||
elif modality == "image":
|
||||
prompts = [
|
||||
f"<|im_start|>user <image>\n{question}<|im_end|> \
|
||||
<|im_start|>assistant\n"
|
||||
f"<|im_start|>user <image>\n{question}<|im_end|><|im_start|>assistant\n"
|
||||
for question in questions
|
||||
]
|
||||
|
||||
@ -998,8 +998,7 @@ def run_molmo(questions: list[str], modality: str) -> ModelRequestData:
|
||||
)
|
||||
|
||||
prompts = [
|
||||
f"<|im_start|>user <image>\n{question}<|im_end|> \
|
||||
<|im_start|>assistant\n"
|
||||
f"<|im_start|>user <image>\n{question}<|im_end|><|im_start|>assistant\n"
|
||||
for question in questions
|
||||
]
|
||||
|
||||
|
@ -1289,8 +1289,10 @@ class InstructCoderDataset(HuggingFaceDataset):
|
||||
for i, item in enumerate(self.data):
|
||||
if len(sampled_requests) >= num_requests:
|
||||
break
|
||||
prompt = f"{item['input']}\n\n{item['instruction']} Just output \
|
||||
the code, do not include any explanation."
|
||||
prompt = (
|
||||
f"{item['input']}\n\n{item['instruction']} Just output "
|
||||
"the code, do not include any explanation."
|
||||
)
|
||||
|
||||
# apply template
|
||||
prompt = tokenizer.apply_chat_template(
|
||||
|
@ -98,14 +98,15 @@ class TPUModelLoader(DefaultModelLoader):
|
||||
|
||||
# Check parameters
|
||||
for name, param in model.named_parameters():
|
||||
assert param.device.type == device_type, f"Parameter {name} is on \
|
||||
{param.device.type} instead of {device_type}"
|
||||
assert param.device.type == device_type, (
|
||||
f"Parameter {name} is on {param.device.type} "
|
||||
f"instead of {device_type}")
|
||||
|
||||
# Check buffers
|
||||
for name, buffer in model.named_buffers():
|
||||
assert buffer.device.type == device_type, \
|
||||
f"Buffer {name} is on {buffer.device.type} instead of \
|
||||
{device_type}"
|
||||
assert buffer.device.type == device_type, (
|
||||
f"Buffer {name} is on {buffer.device.type} "
|
||||
f"instead of {device_type}")
|
||||
|
||||
for module in model.modules():
|
||||
if (mesh is not None) and (get_fqn(module) == 'QKVParallelLinear'):
|
||||
|
@ -929,8 +929,8 @@ class HCXVisionForCausalLM(nn.Module, SupportsMultiModal, SupportsPP):
|
||||
target_group_size = 0
|
||||
|
||||
elif video_group_size < target_group_size:
|
||||
raise RuntimeError(f"video_group_size < target_group_size!! \
|
||||
[{video_group_size} < {target_group_size}]")
|
||||
raise RuntimeError(
|
||||
f"{video_group_size=} < {target_group_size=}")
|
||||
|
||||
assert len(target_features
|
||||
) == 0, f"target_features is not empty!! {target_features}"
|
||||
@ -1114,9 +1114,8 @@ def reshape_and_unpad_image_features(
|
||||
base_image_feature = image_feature[0]
|
||||
image_feature = image_feature[1:]
|
||||
|
||||
assert (height * width == base_image_feature.shape[0]
|
||||
), f"height: {height}, width: {width}, \
|
||||
base_image_feature.shape[0]: {base_image_feature.shape[0]}"
|
||||
assert height * width == base_image_feature.shape[0], (
|
||||
f"{height=} * {width=} != {base_image_feature.shape[0]=}")
|
||||
|
||||
num_patch_width, num_patch_height = get_anyres_image_grid_shape(
|
||||
image_size, possible_resolutions, grid_size)
|
||||
|
@ -262,9 +262,9 @@ class Phi4MMImageEncoder(nn.Module):
|
||||
img_features.shape[1]))
|
||||
assert base_feat_height == base_feat_height_target \
|
||||
and base_feat_width == base_feat_height_target, \
|
||||
f'base_feat_height: {base_feat_height},"\
|
||||
f" base_feat_width: {base_feat_width}, "\
|
||||
f"expect {base_feat_height_target} features for hd transform'
|
||||
(f"base_feat_height: {base_feat_height}, "
|
||||
f"base_feat_width: {base_feat_width}, "
|
||||
f"expect {base_feat_height_target} features for hd transform")
|
||||
|
||||
# bs x max_num_crops x (24x24) x C
|
||||
img_features = img_features.view(bs, -1,
|
||||
|
@ -61,8 +61,8 @@ class EAGLEConfig(PretrainedConfig):
|
||||
else f"Eagle3{arch}" for arch in self.model.architectures
|
||||
]
|
||||
else:
|
||||
raise ValueError(f"Invalid method {method}. \
|
||||
Supported methods are eagle and eagle3.")
|
||||
raise ValueError(f"Invalid method {method}. "
|
||||
"Supported methods are eagle and eagle3.")
|
||||
|
||||
super().__init__(**kwargs)
|
||||
|
||||
|
Reference in New Issue
Block a user