Skip to content

Conversation

@gonglinyuan
Copy link
Contributor

Allow np.memmap objects to be processed by default_collate

np.memmap objects has the same behavior as numpy arrays, and the only difference is that they are stored in a binary file on the disk. However, the default_collate function used by PyTorch DataLoader only accepts np.array, and rejects np.memmap by type checking. This commit allows np.memmap objects to be processed by default_collate. In this way, users can use in-disk large arrays with PyTorch DataLoader.

@gonglinyuan gonglinyuan requested a review from apaszke as a code owner June 11, 2020 08:34
@dr-ci
Copy link

dr-ci bot commented Jun 11, 2020

💊 CI failures summary and remediations

As of commit 3584a7b (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 11 times.

@zou3519
Copy link
Contributor

zou3519 commented Jun 23, 2020

This sounds like a reasonable ask, but I don't context over this part of the codebase. @ssnl does this sound reasonable to you?

@gonglinyuan this would also require a test in order to be shipped. Something like

def test_numpy_scalars(self):
.

@zou3519 zou3519 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jun 23, 2020
@ssnl
Copy link
Collaborator

ssnl commented Jun 25, 2020

LGTM. The CI failures do not look relevant but can we rebase to make sure?

@gonglinyuan
Copy link
Contributor Author

LGTM. The CI failures do not look relevant but can we rebase to make sure?

Do you know how can I rebase so that these CIs can work? Thanks!

@ssnl
Copy link
Collaborator

ssnl commented Jun 28, 2020

@gonglinyuan you didn't allow maintainers to push to the fork so I can't do that for you. But you should be able to do so just by git pull --rebase upstream master, then force push, assuming upstream is this repo.

@gonglinyuan gonglinyuan force-pushed the gonglinyuan/collate_memmap branch from 11049fe to 3584a7b Compare June 29, 2020 01:37
@gonglinyuan
Copy link
Contributor Author

@gonglinyuan you didn't allow maintainers to push to the fork so I can't do that for you. But you should be able to do so just by git pull --rebase upstream master, then force push, assuming upstream is this repo.

Thank you! I rebased and the CI runs successfully.

@ssnl
Copy link
Collaborator

ssnl commented Jun 29, 2020

@zou3519 could you merge this? thanks :)

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zou3519 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zou3519 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@zou3519 merged this pull request in 0a75234.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants