Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: ('CC', 'C[CH3:1]') #1

Open
TryLittleHarder opened this issue Sep 9, 2022 · 1 comment
Open

KeyError: ('CC', 'C[CH3:1]') #1

TryLittleHarder opened this issue Sep 9, 2022 · 1 comment

Comments

@TryLittleHarder
Copy link

Hi, I tried to run python preprocess.py --config configs/moses/hiervae.json and I changed vocab_mode to 'Vocab' in hiervae.json. I got this error. It seems that vmap don't contain key ('CC', 'C[CH3:1]'), but I don't know how to fix it.

**Traceback (most recent call `last):
  File "/usr/local/miniconda3/envs/molvae/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/usr/local/miniconda3/envs/molvae/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "/data1/MolVAE-main/src/utils/datautils.py", line 177, in hgraph_tensorize
    x = MolGraph.tensorize(mol_batch, vocab, common_atom_vocab)
  File "/data1/MolVAE-main/src/models/hgraph/mol_graph.py", line 153, in tensorize
    tree_tensors, tree_batchG = MolGraph.tensorize_graph([x.mol_tree for x in mol_batch], vocab)
  File "/data1/MolVAE-main/src/models/hgraph/mol_graph.py", line 194, in tensorize_graph
    fnode[v] = vocab[attr]
  File "/data1/MolVAE-main/src/common/vocab.py", line 15, in __getitem__
    return self.vmap[smiles]
KeyError: ('CC', 'C[CH3:1]')
"""
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/.pycharm_helpers/pydev/pydevd.py", line 1438, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/root/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/data1/MolVAE-main/tools/preprocess.py", line 34, in <module>
    dataloader.preprocess_data_tensor(params.train_set, params.train_mode, params.preprocess_save_dir)
  File "/data1/MolVAE-main/src/core/moledataloader.py", line 208, in preprocess_data_tensor
    all_data = pool.map(func, batches)
  File "/usr/local/miniconda3/envs/molvae/lib/python3.7/multiprocessing/pool.py", line 268, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/usr/local/miniconda3/envs/molvae/lib/python3.7/multiprocessing/pool.py", line 657, in get
    raise self._value
KeyError: ('CC', 'C[CH3:1]')**
@KotomiM
Copy link
Owner

KotomiM commented Feb 20, 2023

Hi, thanks for your question. We haven't implemented the other vocab mode for a kind of model, please use the "PairVocab" for the "hiervae" model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants