Spaces:
Running
Running
Update utils/main_model.py
Browse files- utils/main_model.py +6 -4
utils/main_model.py
CHANGED
@@ -8,11 +8,13 @@ class ChemicalConverter:
|
|
8 |
self.mode = mode
|
9 |
model_directory = os.path.abspath("models")
|
10 |
model_path = os.path.join(model_directory, mode)
|
11 |
-
if
|
12 |
-
|
|
|
|
|
13 |
self.model = MT5ForConditionalGeneration.from_pretrained(model_path)
|
14 |
-
self.smiles_tokenizer = AutoTokenizer.from_pretrained("
|
15 |
-
self.iupac_tokenizer = AutoTokenizer.from_pretrained("
|
16 |
self.smiles_max_len = 128
|
17 |
self.iupac_max_len = 156
|
18 |
|
|
|
8 |
self.mode = mode
|
9 |
model_directory = os.path.abspath("models")
|
10 |
model_path = os.path.join(model_directory, mode)
|
11 |
+
if mode == "SMILES2IUPAC":
|
12 |
+
model_path = "knowledgator/SMILES2IUPAC-canonical-base"
|
13 |
+
else:
|
14 |
+
model_path = "knowledgator/IUPAC2SMILES-canonical-base"
|
15 |
self.model = MT5ForConditionalGeneration.from_pretrained(model_path)
|
16 |
+
self.smiles_tokenizer = AutoTokenizer.from_pretrained("knowledgator/SMILES-FAST-TOKENIZER")
|
17 |
+
self.iupac_tokenizer = AutoTokenizer.from_pretrained("knowledgator/IUPAC-FAST-TOKENIZER")
|
18 |
self.smiles_max_len = 128
|
19 |
self.iupac_max_len = 156
|
20 |
|