Skip to content

Commit 43300bd

Browse files
authored
[Bugfix] Properly propagate trust_remote_code settings (#10047)
Signed-off-by: Zifei Tong <zifeitong@gmail.com>
1 parent ca9844b commit 43300bd

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

vllm/model_executor/models/chatglm.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ def mm_input_mapper_for_glmv(
5454
data: MultiModalData[object],
5555
) -> Dict:
5656
model_config = ctx.model_config
57-
tokenizer = cached_get_tokenizer(model_config.tokenizer,
58-
trust_remote_code=True)
57+
tokenizer = cached_get_tokenizer(
58+
model_config.tokenizer,
59+
trust_remote_code=model_config.trust_remote_code)
5960
if tokenizer is None:
6061
raise RuntimeError("No HuggingFace processor is available "
6162
"to process the image object")
@@ -525,7 +526,7 @@ def _parse_and_validate_image_input(
525526
elif isinstance(pixel_values, list):
526527
return torch.concat(pixel_values)
527528
else:
528-
raise TypeError("""pixel_values must be a torch.Tensor
529+
raise TypeError("""pixel_values must be a torch.Tensor
529530
or a list of torch.Tensor
530531
""")
531532
return GLMImagePixelInputs(pixel_values=pixel_values)

vllm/model_executor/models/molmo.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -844,9 +844,10 @@ def get_max_tokens(max_crops: int, crop_patches: int, left_margin: int,
844844

845845

846846
def get_max_molmo_image_tokens(ctx: InputContext) -> int:
847-
processor = cached_get_processor(ctx.model_config.model,
848-
trust_remote_code=True,
849-
revision=ctx.model_config.code_revision)
847+
processor = cached_get_processor(
848+
ctx.model_config.model,
849+
trust_remote_code=ctx.model_config.trust_remote_code,
850+
revision=ctx.model_config.code_revision)
850851
image_processor = processor.image_processor
851852
max_llm_image_tokens = get_max_tokens(
852853
image_processor.max_crops,
@@ -870,9 +871,10 @@ def image_input_mapper_for_molmo(
870871

871872
def dummy_data_for_molmo(ctx: InputContext, seq_len: int,
872873
mm_counts: Mapping[str, int]):
873-
processor = cached_get_processor(ctx.model_config.model,
874-
trust_remote_code=True,
875-
revision=ctx.model_config.code_revision)
874+
processor = cached_get_processor(
875+
ctx.model_config.model,
876+
trust_remote_code=ctx.model_config.trust_remote_code,
877+
revision=ctx.model_config.code_revision)
876878
image_processor = processor.image_processor
877879

878880
base_image_input_d = image_processor.image_patch_size
@@ -935,11 +937,11 @@ def input_processor_for_molmo(ctx: InputContext, inputs: DecoderOnlyInputs):
935937
multi_modal_data = inputs.get("multi_modal_data")
936938
image = None if multi_modal_data is None else multi_modal_data.get("image")
937939

938-
processor = cached_get_processor(ctx.model_config.model,
939-
trust_remote_code=True,
940-
revision=ctx.model_config.code_revision)
941-
942940
model_config = ctx.model_config
941+
processor = cached_get_processor(
942+
ctx.model_config.model,
943+
trust_remote_code=model_config.trust_remote_code,
944+
revision=ctx.model_config.code_revision)
943945
tokenizer = cached_get_tokenizer(
944946
model_config.tokenizer,
945947
trust_remote_code=model_config.trust_remote_code)

0 commit comments

Comments
 (0)