Commit
•
319cee3
1
Parent(s):
30e2e3e
Update smi-ted/training/pubchem_encoder.py (#10)
Browse files- Update smi-ted/training/pubchem_encoder.py (860a7f64e058ebd5eb3480db5bba91f0b633506e)
Co-authored-by: Victor Yukio Shirasuna <vshirasuna@users.noreply.huggingface.co>
smi-ted/training/pubchem_encoder.py
CHANGED
@@ -72,7 +72,7 @@ class Encoder():
|
|
72 |
if self.add_eos == True:
|
73 |
char = char + ['<eos>']
|
74 |
|
75 |
-
return torch.tensor([self.char2id[
|
76 |
|
77 |
def encoder(self, tokens):
|
78 |
#return *map(lambda x: self.encode(x), tokens)
|
|
|
72 |
if self.add_eos == True:
|
73 |
char = char + ['<eos>']
|
74 |
|
75 |
+
return torch.tensor([self.char2id.get(word, self.char2id["<unk>"]) for word in char])
|
76 |
|
77 |
def encoder(self, tokens):
|
78 |
#return *map(lambda x: self.encode(x), tokens)
|