Skip to content

Conversation

cminus01
Copy link

@cminus01 cminus01 commented Sep 9, 2022

Description

Checklist

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [$CATEGORY] (such as [Doc], [Feature]])
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage
  • Code is well-documented
  • To the my best knowledge, examples are either not affected by this change,
    or have been fixed to be compatible with this change
  • Related issue is referred in this PR
  • If the PR is for a new model/paper, I've updated the example index here.

Changes

@cminus01 cminus01 force-pushed the dev_amr_rgnn_demo branch 4 times, most recently from 52d81ee to dee086d Compare September 9, 2022 09:05
Copy link
Contributor

@AlanSwift AlanSwift left a comment

Choose a reason for hiding this comment

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

Please check the comments.

return self.nodes[:].features

@property
def ntypes(self) -> List[str]:
Copy link
Contributor

Choose a reason for hiding this comment

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

If the graph is homogeneous, it should be an exception.

), "The number of nodes to be added should be greater than 0. (Got {})".format(node_num)

if not self.is_hetero:
assert ntypes is None, "The graph is homogeneous, ntypes should be None."
Copy link
Contributor

Choose a reason for hiding this comment

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

please raise exceptions

return EdgeView(self)

@property
def etypes(self) -> List[Tuple[str, str, str]]:
Copy link
Contributor

Choose a reason for hiding this comment

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

When it is homogeneous, self._etypes is not assigned.

return self._edge_attributes

# Conversion utility functions
def make_data_dict(self) -> Dict[Tuple[str, str, str], Tuple[torch.Tensor, torch.Tensor]]:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this could be a utility function.

edge_token = graph.edge_attributes[edge_idx]["token"]
s.add(edge_token)
except Exception as e:
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

please handle the catched exception

if "val" in self.__dict__:
self.val = self.build_topology(self.val)
# build_edge_vocab and save
if self.init_edge_vocab:
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be a new function similar to "build_vocab()". E.g., build_edge_vocab()

for_inference=False,
reused_vocab_model=None,
nlp_processor_args=None,
init_edge_vocab=False,
Copy link
Contributor

Choose a reason for hiding this comment

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

init_edge_vocab is not clear. It covers 1.build edge vocab, 2. an indicator to use heterogeneous graph.
TODO: discuss

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. build_edge_vocab: bool
  2. is_hetero: bool
for i in range(len(data_item_collect)):
data_item_collect[i] = self.dataset._vectorize_one_dataitem(
data_item_collect[i], self.vocab_model, use_ie=use_ie
data_item_collect[i], self.vocab_model, use_ie=use_ie, edge_vocab=self.edge_vocab
Copy link
Contributor

Choose a reason for hiding this comment

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

But the api in dataset._vectorize_one_dataitem doesn't have the parameter: "edge_vocab", please check it.
_vectorize_one_dataitem

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. move the edge vocab to the library code
  2. unify edge_vocab with vocab_model
"w2v_bert",
"w2v_bert_bilstm",
"w2v_bert_bigru",
"w2v_amr",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why amr shoud be a general embedding strategy?
I don't think it should be regarded as a new general embedding strategy.

rnn_input_size = word_emb_size

if "pos" in word_emb_type:
self.word_emb_layers["pos"] = WordEmbedding(37, 50)
Copy link
Contributor

Choose a reason for hiding this comment

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

please don't use magic numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants