Data Batch problem in PyG
See original GitHub issue🐛 Describe the bug
Hi. I am a computational physics researcher and was using PyG very well. my pyg code was working well a few weeks ago, but now that I run my code, it is not working anymore without any changes.
the problem is like below. I have many material structures and in my “custom_dataset” class, these are preprocessed and all graph informations (node features, edge features, edge index etc) are inserted into “Data” object in PyTorch geometric. You can see that each preprocessed sample with index $i$ was printed normal “Data” object in pyg
But When I insert my custom dataset class into pyg DataLoader and I did like below,
sample = next(iter(train_loader)) # batch sample
batch sample is denoted by “DataDataBatch”. I didn’t see this kind of object name. and i can’t use "sample.x’ or “sample.edge_index” command. Instead I need to do like this
I want to use expressions like “sample.x”, “sample.edge_index” or “sample.edge_attr” as like before. I expect your kind explanations. Thank you.
Environment
- PyG version:
2.0.5
- PyTorch version:
1.11.0+cu113
- OS:
GoogleColab Pro Plus
- Python version:
Python 3.7.13 in colab
- CUDA/cuDNN version:
- How you installed PyTorch and PyG (
conda
,pip
, source):
# Install required packages.
import os
import torch
os.environ['TORCH'] = torch.__version__
print(torch.__version__)
!pip install -q torch-scatter -f https://data.pyg.org/whl/torch-${TORCH}.html
!pip install -q torch-sparse -f https://data.pyg.org/whl/torch-${TORCH}.html
!pip install -q git+https://github.com/pyg-team/pytorch_geometric.git
!pip install -q pymatgen==2020.11.11
- Any other relevant information (e.g., version of
torch-scatter
):
Issue Analytics
- State:
- Created a year ago
- Comments:29 (14 by maintainers)
Hi @rusty1s Thanks for your response! Indeed, I’m a little bit busy these days, and I’m already using the filtering solution. I hope I’ll find some time to debug it soon.
Oh, what a bummer. I was pretty sure we fixed the root cause of this issue 😦 Is it possible for you to upload some dummy data of yours which we could use to try to reproduce? It would be also great if you could try to debug the execution of https://github.com/pyg-team/pytorch_geometric/blob/master/torch_geometric/data/separate.py#L59, e.g., what’s the output of
print(key, value.shape, idx, cat_dim, start, end)
right before the crash?If you wanna stay on 2.0.4, you can filter out the warning via
warnings.filterwarnings("ignore", ".*one or more elements.*")