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

Dataloader #33

Closed
peterdudfield opened this issue Aug 16, 2024 · 5 comments
Closed

Dataloader #33

peterdudfield opened this issue Aug 16, 2024 · 5 comments

Comments

@peterdudfield
Copy link
Contributor

peterdudfield commented Aug 16, 2024

Detailed Description

Add a torch dataloader

Context

  • nice to add an example of a dataloader, with batchsize 10

Possible Implementation

  • need to work out how to collate the samples together, to batches
@dfulu
Copy link
Member

dfulu commented Aug 16, 2024

Yeh this should be part of creating the batch saving script which is mentioned in #7. Although currently the equivalent script is in PVNet so maybe it should happen over there?

@dfulu
Copy link
Member

dfulu commented Aug 16, 2024

We also already have the collate function we need to stack the samples together. Its here in datapipes

@peterdudfield
Copy link
Contributor Author

oh thanks, ill use that collate function

@peterdudfield
Copy link
Contributor Author

Ill ahve a go, as i need it for openclimatefix/uk-pvnet-app#116, and it seemed better to sit here

@peterdudfield
Copy link
Contributor Author

Deiceded not to do this, as the code is very simepl

from ocf_datapipes.batch.merge_numpy_examples_to_batch import stack_np_examples_into_batch
from torch.utils.data import DataLoader
DataLoader(
        dataset,
        batch_size=batch_size,
        num_workers=num_workers,
        pin_memory=True,
        collate_fn=stack_np_examples_into_batch,
        **kwargs,
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants