Kohulan / Smiles-TO-iUpac-Translator

Transformer based SMILES to IUPAC Translator
MIT License
137 stars 27 forks source link

Not working for the example of intended use on MacOS. #5

Closed rdguerrerom closed 2 years ago

rdguerrerom commented 3 years ago

Hi,

After following the steps that you recommend to install the package, I got the following errors:

Downloading trained model to Trained_models/60/forward ...
... done downloading trained model!
Archive:  STOUT_trained_models_v2.1.zip
   creating: Trained_models/
   creating: Trained_models/60/
   creating: Trained_models/60/forward/
  inflating: Trained_models/60/forward/ckpt-1.data-00000-of-00001
  inflating: Trained_models/60/forward/ckpt-1.index
  inflating: Trained_models/60/forward/checkpoint
   creating: Trained_models/60/reverse/
  inflating: Trained_models/60/reverse/ckpt-1.data-00000-of-00001
  inflating: Trained_models/60/reverse/ckpt-1.index
  inflating: Trained_models/60/reverse/checkpoint
   creating: Trained_models/30/
   creating: Trained_models/30/forward/
  inflating: Trained_models/30/forward/ckpt-1.data-00000-of-00001
  inflating: Trained_models/30/forward/ckpt-1.index
  inflating: Trained_models/30/forward/checkpoint
   creating: Trained_models/30/reverse/
  inflating: Trained_models/30/reverse/ckpt-1.data-00000-of-00001
  inflating: Trained_models/30/reverse/ckpt-1.index
  inflating: Trained_models/30/reverse/checkpoint
Traceback (most recent call last):
  File "STOUT_V_2.1.py", line 303, in <module>
    main()
  File "STOUT_V_2.1.py", line 50, in main
    iupac_name = translate(selfies.encoder(canonical_smiles.decode('utf-8').strip()).replace("][","] ["))
  File "STOUT_V_2.1.py", line 167, in translate
    result, sentence = evaluate(sentence)
  File "STOUT_V_2.1.py", line 133, in evaluate
    inputs = [inp_lang.word_index[i] for i in sentence.split(' ')]
  File "STOUT_V_2.1.py", line 133, in <listcomp>
    inputs = [inp_lang.word_index[i] for i in sentence.split(' ')]
KeyError: '[Branch1]'
Kohulan commented 3 years ago

Hello @rdguerrerom ,

I guess you installed the latest version of SELFIES, they made some changes with the tokens. please remove it and install selfies v1.0.4.

pip install selfies==1.0.4

-Kohulan