fix: temporarily disable cuda-ipc for mm data tensor (#8431)
Signed-off-by: Xinyuan Tong <xinyuantong.cs@gmail.com> Co-authored-by: Xinyuan Tong <xinyuantong.cs@gmail.com>
This commit is contained in:
@@ -221,6 +221,13 @@ class BaseMultimodalProcessor(ABC):
|
|||||||
return_tensors="pt",
|
return_tensors="pt",
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
# move feature tensors to cpu
|
||||||
|
for feature_name in self.FEATURE_NAMES:
|
||||||
|
if feature_name in result and isinstance(
|
||||||
|
result[feature_name], torch.Tensor
|
||||||
|
):
|
||||||
|
result[feature_name] = result[feature_name].to("cpu")
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
@@ -623,19 +630,4 @@ class BaseMultimodalProcessor(ABC):
|
|||||||
mm_token_id=mm_token_id,
|
mm_token_id=mm_token_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# post-process
|
|
||||||
for item in all_collected_items:
|
|
||||||
# replace the feature tensor with a proxy
|
|
||||||
if isinstance(item.feature, torch.Tensor) and item.feature.is_cuda:
|
|
||||||
item.feature = TransportProxyTensor(
|
|
||||||
transport_mode=self.transport_mode, data=item.feature
|
|
||||||
)
|
|
||||||
elif (
|
|
||||||
isinstance(item.precomputed_embeddings, torch.Tensor)
|
|
||||||
and item.precomputed_embeddings.is_cuda
|
|
||||||
):
|
|
||||||
item.precomputed_embeddings = TransportProxyTensor(
|
|
||||||
transport_mode=self.transport_mode, data=item.precomputed_embeddings
|
|
||||||
)
|
|
||||||
|
|
||||||
return all_collected_items, input_ids, ret
|
return all_collected_items, input_ids, ret
|
||||||
|
|||||||
Reference in New Issue
Block a user