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

Changes in Temporal Data to support a new Temporal Data Loader #3985

Merged
merged 48 commits into from
Mar 5, 2022

Conversation

otaviocx
Copy link
Contributor

@otaviocx otaviocx commented Feb 2, 2022

What

  • Add the new TemporalDataset class as a base class for Temporal Datasets based on streams of events (TemporalData).
  • Refactor TemporalData to get it working properly with DataLoader.
  • Refactor some parts of the code to replace Union[List[Data], List[HeteroData]] by List[BaseData] and Union[Data, HeteroData] by BaseData.
  • Refactor the JODIEDatasetto inherit from TemporalDataset.
  • Refactor the TGN example to use DataLoaders.

Why

  • This PR covers the 3rd item of the ([Roadmap] Temporal Graph Support 🚀 #3230).
  • With the TemporalDataset class we can have a base class for all the datasets based on a stream of events and that will use TemporalData as an internal data class.
  • We've needed to refactor some places of the code to start receiving and returning instances of BaseData instead of Data or HeteroData. BaseData is the parent class of all the types of data now (including TemporalData).
  • The refactor in TGN file is to show how to use a DataLoader with TemporalDatasets.

How

The TemporalDataset class has been added in order to abstract the concept of a temporal Dataset (an in-memory dataset that the internal data storage is a TemporalData instance). With that, we were able to use the default DataLoader implementation with a temporal dataset as in tgn.py.

Testing

The only model that is currently using the TemporalDataset class is examples/tgn.py. Thus, in order to test this refactoring, please run this example and it should be working as before.

otaviocx and others added 28 commits January 6, 2022 21:54
Co-authored-by: Matthias Fey <matthias.fey@tu-dortmund.de>
Co-authored-by: Matthias Fey <matthias.fey@tu-dortmund.de>
- refactor TemporalData to work with the default implementation of DataLoader
- refactor Jodie Dataset to inherit from TemporalDataset
- refactor the TGN example to work with DataLoader
@rusty1s
Copy link
Member

rusty1s commented Feb 25, 2022

Hey @otaviocx, please let me know if you need any help finishing this PR. Looking forward to seeing this in master :)

@otaviocx
Copy link
Contributor Author

Hi @rusty1s, it is ready for review.

Sorry for the absence. I was preparing myself for the Qualifying Exam Presentation of my PhD (which was yesterday and I was approved 🍾 ).

@otaviocx otaviocx changed the title Temporal dataset and data loader Changes in Temporal Data to support a new Temporal Data Loader Feb 26, 2022
@rusty1s
Copy link
Member

rusty1s commented Feb 26, 2022

Congratulations!

I will take a closer look in the upcoming week.

examples/tgn.py Outdated Show resolved Hide resolved
examples/tgn.py Show resolved Hide resolved
examples/tgn.py Show resolved Hide resolved
torch_geometric/data/temporal.py Outdated Show resolved Hide resolved
torch_geometric/data/temporal.py Outdated Show resolved Hide resolved
torch_geometric/data/temporal.py Outdated Show resolved Hide resolved
torch_geometric/loader/temporal_dataloader.py Outdated Show resolved Hide resolved
torch_geometric/loader/temporal_dataloader.py Outdated Show resolved Hide resolved
otaviocx and others added 3 commits March 3, 2022 20:02
Co-authored-by: Matthias Fey <matthias.fey@tu-dortmund.de>
Co-authored-by: Matthias Fey <matthias.fey@tu-dortmund.de>
@yulonglin
Copy link
Contributor

Could we add a few basic tests like those in the earlier TemporalDataLoader PR #2625?

@rusty1s
Copy link
Member

rusty1s commented Mar 5, 2022

@otaviocx I made a pass and changed the TemporalDataLoader to make use of slices rather than indices. This should be slightly faster due to the zero-copy of data. Hope the changes are okay!

@yulonglin Added a test as well. Thanks for the suggestion!

@rusty1s rusty1s merged commit aa99b50 into pyg-team:master Mar 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants