Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Correctly report size of variable shaped TensorArray #47743

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BitPhinix
Copy link
Contributor

Currently, TensorArray reports a grossly incorrect size for variable-shaped arrays. This causes ray data to overfetch blocks, causing spilling and eventually a crash due to running out of disk space. This PR contains a simple fix for the issue, specifically handling this case in nbytes.

Simple reproduction:

import numpy as np
import pandas as pd
from ray.data.extensions import TensorArray

test_data = [np.random.rand(i, i) for i in range(1000)]

df = pd.DataFrame({"tensor": TensorArray(test_data)})

print("reported size", df.memory_usage(index=True, deep=True).sum()) # reported size 8128
print("actual size", sum(t.nbytes for t in test_data)) # actual size 2662668000

@BitPhinix BitPhinix changed the title Correctly report size of variable shaped TensorArray [core] Correctly report size of variable shaped TensorArray Sep 19, 2024
@anyscalesam anyscalesam added triage Needs triage (eg: priority, bug/not-bug, and owning component) core Issues that should be addressed in Ray Core labels Oct 15, 2024
@jjyao jjyao added data Ray Data-related issues and removed triage Needs triage (eg: priority, bug/not-bug, and owning component) core Issues that should be addressed in Ray Core labels Oct 28, 2024
@BitPhinix
Copy link
Contributor Author

Any news on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data Ray Data-related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants