AllenNLP with Pytorch Geometric

I’m curious if anybody has used AllenNLP with the Pytorch Geometric ( library, or implemented a similar message passing pattern for graph data in AllenNLP.

Hi. I don’t know what exactly you mean here. AllenNLP is built up on pytorch. Anything work with Pytorch can work with AllenNLP.

This is true. I’m mostly anticipating getting confused around data loading, batching, and building/indexing the vocabulary, as AllenNLP has nice abstractions around these steps that might be a little at odds with those implemented in the PyTorch Geometric library. I figured I may as well ask to see if there might be related work I could refer to before diving in. I’ll keep plugging along and see what I can come up with!

IIRC, for pytorch_geometric sometimes people do batching by combining a batch of small graphs into a large graph. Seems to me this is not directly supported by AllenNLP. If I am doing this, I think I will probably put them into MetaField and combine them as the way I want in forward. This is not elegant but does work. I am also curious about what’s the best practice for this need. Can you please keep this post updated once you find the answer? Many thanks!

Apparently for node-level mini-batches (which is what I think would be appropriate in my case), one can use a neighbor sampling method similar to that described in the GraphSAGE paper. There’s an implementation of this in pytorch-cluster, which is used in this example, but I’m currently stuck trying to resolve some compilation issues installing when installing this library. (I’m afraid all the duct-tape and black magic I used to get a weird specific branch of AllenNLP and its dependencies installed on conda and talking to CUDA is catching up to me. :frowning:)

I might look at the GraphSAGE pytorch implementation and see if I can work from that.