ipd commited on
Commit
f37f639
1 Parent(s): 45bbb54

fix mol gen

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -182,7 +182,13 @@ def generate(latent_vector, mask):
182
  selfies = gen_tokenizer.batch_decode(decoder_output, skip_special_tokens=True)
183
  outs = []
184
  for i in selfies:
185
- outs.append(sf.decoder(i.replace("] [", "][")))
 
 
 
 
 
 
186
  return outs
187
 
188
 
 
182
  selfies = gen_tokenizer.batch_decode(decoder_output, skip_special_tokens=True)
183
  outs = []
184
  for i in selfies:
185
+ try:
186
+ decoded = sf.decoder(i.replace("] [", "]["))
187
+ outs.append(decoded)
188
+ except selfies.exceptions.DecoderError:
189
+ print(f"Error decoding SELFIES string: {i}")
190
+
191
+ #outs.append(sf.decoder(i.replace("] [", "][")))
192
  return outs
193
 
194