[VLM] Adopt fast image processor by default (#5065)

This commit is contained in:
Mick
2025-04-12 12:46:58 +08:00
committed by GitHub
parent 611720919d
commit 34ef6c8135
12 changed files with 163 additions and 98 deletions

View File

@@ -222,10 +222,10 @@ class MultimodalDataItem:
# memoryview() doesn't support PyTorch's BFloat16 dtype
tensor = tensor.float()
assert isinstance(tensor, torch.Tensor)
if tensor.is_cuda:
tensor_cpu = torch.frombuffer(
tensor.storage().untyped(), dtype=tensor.dtype, count=tensor.numel()
).clone()
# TODO: improve this
tensor_cpu = tensor.cpu()
else:
tensor_cpu = tensor
@@ -321,7 +321,6 @@ class MultimodalInputs:
item.set_pad_value()
optional_args = [
"modalities",
"im_token_id",
"im_start_id",
"im_end_id",