zaixizhang/MGSSL

A motif that does not exist in the vocabulary:KeyError: 'C1=CNC=N1'

Syforeal opened this issue · 0 comments

运行pretrain_motif.py后似乎出现不存在于词汇表的motif:

Traceback (most recent call last):
”MGSSL\motif_based_pretrain\pretrain_motif.py", line 221, in <module>
    main()
    ^^^^^^
  File "MGSSL\motif_based_pretrain\pretrain_motif.py", line 214, in main
    train(args, model_list, loader, optimizer_list, device)
  File "MGSSL\motif_based_pretrain\pretrain_motif.py", line 109, in train
    loss, wacc, tacc = motif_model(batch, node_rep)  
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "torch\nn\modules\module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "MGSSL\motif_based_pretrain\util\motif_generation.py", line 43, in forward
    set_batch_nodeID(mol_batch, self.vocab)
  File "MGSSL\motif_based_pretrain\util\motif_generation.py", line 21, in set_batch_nodeID
    node.wid = vocab.get_index(node.smiles)  
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "MGSSL\motif_based_pretrain\util\mol_tree.py", line 25, in get_index
    return self.vmap[smiles]
           ~~~~~~~~~^^^^^^^^
KeyError: 'C1=CNC=N1'

请问可能是什么原因呢?