Skip to content

Could you please provide a simple example to use the NodeEmbeddingBasedRefinedGraphConstruction class? #587

@maryam-devrix

Description

@maryam-devrix

❓ Questions and Help

I am trying to come up with a simple example of how to use the NodeEmbeddingBasedRefinedGraphConstruction class, but I am getting the following error. could you please let me know how to congif the class to make it work?

from graph4nlp.pytorch.modules.graph_construction.node_embedding_based_refined_graph_construction import NodeEmbeddingBasedRefinedGraphConstruction
raw_data = "James went to the corner-shop. And bought some eggs."
gl = NodeEmbeddingBasedRefinedGraphConstruction(alpha_fusion= 0.2, input_size=(len(raw_data)))
graphdata = gl.init_topology(raw_data, lower_case=True)
graph = gl.dynamic_topology(graphdata)

But here is the error that I get.

    152 def __repr__(self):
--> 153     return self._graph._get_batch_node_features()

File ~/.conda/envs/graph4nlp/lib/python3.10/site-packages/graph4nlp-0.5.5-py3.10.egg/graph4nlp/pytorch/data/data.py:930, in GraphData._get_batch_node_features(self, item)
    915 """
    916 Get the batched view of node feature tensors, i.e., tensors in (B, N, D) view
    917 
   (...)
    927     batch-view tensors, or just the specified tensor.
    928 """
    929 if not self._is_batch:
--> 930     raise Exception("Calling batch_node_features() method on a non-batch graph.")
    931 if item is None:
    932     batch_node_features = dict()

Exception: Calling batch_node_features() method on a non-batch graph.

Any working simple example is highly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions