allenai / allenai/commonsense-kg-completion

Error in init_with_bert not passing network

Offen
#7 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
109
Forks
16
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

In trying to train from scratch, I found that there is a bug.

!python -u src/run_kbc_subgraph.py --dataset conceptnet --evaluate-every 10 --n-layers 2 --graph-batch-size 60000 --sim_relations --bert_concat

init_with_bert in model.py, which calls bert_model.forward_as_init(num_nodes). forward_as_init expects a second argument network, but was sent None. node_list computes the node from the network as you can see...

def forward_as_init(self, num_nodes, network=None):

if self.exists:
print("Loading BERT embeddings from disk..")
return torch.load(self.filename)

node_ids = np.arange(num_nodes)
node_list = [network.graph.nodes[idx] for idx in node_ids]

I think this i the bug, but I can't figure out how to pass in network.
+++

Error message:

2020-08-27 17:52:38.578804: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
Using backend: pytorch
Namespace(bert_concat=True, bert_mlp=False, bert_sum=False, cpu_decoding=False, dataset='conceptnet', debug=False, decoder='ConvTransE', decoder_batch_size=128, dropout=0.2, embedding_dim=200, eval_batch_size=500, eval_only=False, evaluate_every=10, feature_map_dropout=0.2, gcn_type='WGCNAttentionLayer', gpu=-1, grad_norm=1.0, graph_batch_size=60000, init_embedding_dim=200, input_dropout=0.2, input_layer='lookup', label_smoothing_epsilon=0.1, layer_norm=False, load_model=None, lr=0.0001, n_bases=100, n_epochs=200, n_hidden=200, n_layers=2, negative_sample=0, no_cuda=False, output_dir='saved_models', regularization=0.1, seed=42, sim_relations=True, sim_sim=False, tying=False, use_bias=False, write_results=False)
Number of edges: 99999

Graph Summary

Nodes: 78088
Edges: 100000
Relations: 34
Density: 0.000016

******************* Sample Edges *******************
ReceivesAction: hockey --> play on ice
IsA: hockey --> team sport
IsA: hockey --> violent sport
IsA: hockey --> game
IsA: hockey --> great sport
HasProperty: hockey --> violent
HasProperty: hockey --> cold
IsA: hockey --> type of game
IsA: hockey --> sport of skill and precision
IsA: hockey --> sport game
***************** ***************** *****************

Average Degree: 1.254213195369327
Adding sim edges..
bert_model_embeddings/nodes-lm-conceptnet/conceptnet_bert_embeddings.pt
Loading model from bert_model_embeddings/nodes-lm-conceptnet/
Computing BERT embeddings..
saving
Computed embeddings.
Added 4649160 sim edges
tcmalloc: large alloc 1198546944 bytes == 0xdb340000 @ 0x7f87cf059b6b 0x7f87cf079379 0x7f87763ae92e 0x7f87763b0946 0x7f87ae2a19e5 0x7f87ae526af3 0x7f87ae517f97 0x7f87ae517c7d 0x7f87ae517f97 0x7f87ae622a1a 0x7f87be1540d5 0x7f87be155cd1 0x7f87bdf560ca 0x551755 0x5a9eec 0x50a783 0x50c1f4 0x507f24 0x509277 0x594b01 0x54a17f 0x5517c1 0x5a9eec 0x50a783 0x50c1f4 0x507f24 0x509202 0x594b01 0x54a17f 0x5517c1 0x5a9eec
bert_model_embeddings/nodes-lm-conceptnet/conceptnet_bert_embeddings.pt
Loading model from bert_model_embeddings/nodes-lm-conceptnet/
Traceback (most recent call last):
File "src/run_kbc_subgraph.py", line 532, in
main(args)
File "src/run_kbc_subgraph.py", line 143, in main
use_cuda=use_cuda)
File "/content/drive/My Drive/common_sense/commonsense-kg-completion/src/model.py", line 54, in __init__
self.bert_concat_layer = EmbeddingLayer(num_nodes, self.bert_dim, args.dataset, init_bert=True)
File "/content/drive/My Drive/common_sense/commonsense-kg-completion/src/model.py", line 168, in __init__
self.init_with_bert(num_nodes, dataset)
File "/content/drive/My Drive/common_sense/commonsense-kg-completion/src/model.py", line 176, in init_with_bert
bert_weights = bert_model.forward_as_init(num_nodes)
File "/content/drive/My Drive/common_sense/commonsense-kg-completion/src/bert_feature_extractor.py", line 243, in forward_as_init
node_list = [network.graph.nodes[idx] for idx in node_ids]
File "/content/drive/My Drive/common_sense/commonsense-kg-completion/src/bert_feature_extractor.py", line 243, in
node_list = [network.graph.nodes[idx] for idx in node_ids]
AttributeError: 'NoneType' object has no attribute 'graph'

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.