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

Fix for empty pd.DataFrame in WebQSPDataset #9665

Merged
merged 5 commits into from
Sep 17, 2024
Merged

Fix for empty pd.DataFrame in WebQSPDataset #9665

merged 5 commits into from
Sep 17, 2024

Conversation

puririshi98
Copy link
Contributor

@puririshi98 puririshi98 commented Sep 16, 2024

this last minute commit broke things: e331dcd

the changes to , columns=... is for

Traceback (most recent call last):
  File "/opt/pyg/pytorch_geometric/examples/llm/g_retriever.py", line 262, in <module>
    train(
  File "/opt/pyg/pytorch_geometric/examples/llm/g_retriever.py", line 132, in train
    train_dataset = WebQSPDataset(path, split='train')
  File "/usr/local/lib/python3.10/dist-packages/torch_geometric/datasets/web_qsp_dataset.py", line 145, in __init__
    super().__init__(root, force_reload=force_reload)
  File "/usr/local/lib/python3.10/dist-packages/torch_geometric/data/in_memory_dataset.py", line 81, in __init__
    super().__init__(root, transform, pre_transform, pre_filter, log,
  File "/usr/local/lib/python3.10/dist-packages/torch_geometric/data/dataset.py", line 115, in __init__
    self._process()
  File "/usr/local/lib/python3.10/dist-packages/torch_geometric/data/dataset.py", line 262, in _process
    self.process()
  File "/usr/local/lib/python3.10/dist-packages/torch_geometric/datasets/web_qsp_dataset.py", line 202, in process
    nodes.node_attr = nodes.node_attr.fillna("")
  File "/usr/local/lib/python3.10/dist-packages/pandas/core/generic.py", line 6299, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'node_attr'

then the LongTensor change is for

    return scatter(edge_attr, col, 0, num_nodes, fill_value)
  File "/usr/local/lib/python3.10/dist-packages/torch_geometric/utils/_scatter.py", line 79, in scatter
    count.scatter_add_(0, index, src.new_ones(src.size(dim)))
RuntimeError: scatter(): Expected dtype int64 for index

this is the handle the edgecase where the Question Answer pair has no knowledge graph associated

@puririshi98 puririshi98 changed the title fixes for last min changes to the WebQSP PR. these are essential for … fixes for last min changes to the WebQSP PR. Sep 16, 2024
Copy link
Member

@akihironitta akihironitta left a comment

Choose a reason for hiding this comment

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

LGTM if the change is manually tested (as we don't have unit tests for torch_geometric.datasets)!

torch_geometric/datasets/web_qsp_dataset.py Outdated Show resolved Hide resolved
@rusty1s rusty1s changed the title fixes for last min changes to the WebQSP PR. Fix for empty pd.DataFrame in WebQSPDataset Sep 17, 2024
@rusty1s rusty1s merged commit 642f831 into master Sep 17, 2024
16 checks passed
@rusty1s rusty1s deleted the fix-webqsp branch September 17, 2024 11:43
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