Closed MachineGUN001 closed 5 months ago
The format of the config file has changed, see the documentation here: https://molecularai.github.io/aizynthfinder/configuration.html
It should be straightforward to update your file if before you had
filter:
files:
uspto: name.onnx
policy:
files:
uspto:
- a.onnx
- b.csv.gz
stock:
files:
zinc: zinc.hdf5
you now have to specify it like this
filter:
uspto: name.onnx
expansion:
uspto:
- a.onnx
- b.csv.gz
stock:
zinc: zinc.hdf5
so we got rid of the "files"-section of the file, and renamed "policy" to "expansion"
The format of the config file has changed, see the documentation here: https://molecularai.github.io/aizynthfinder/configuration.html
It should be straightforward to update your file if before you had
filter: files: uspto: name.onnx policy: files: uspto: - a.onnx - b.csv.gz stock: files: zinc: zinc.hdf5
you now have to specify it like this
filter: uspto: name.onnx expansion: uspto: - a.onnx - b.csv.gz stock: zinc: zinc.hdf5
so we got rid of the "files"-section of the file, and renamed "policy" to "expansion"
thanks for your suggestions, and that works!
Does the current version 4.0 only support `uspto:.
format and not support the previous model hf5 format? I try to use the previous model
uspto_model.hdf5`, but didnot work.The new version do support the hdf5 format of old models. What error did you receive when you tried using the old uspto_model.hdf5 file
@SGenheden thanks for your explanation.
below is the error I received when I tried to use the old uspto_model.hdf5
{
"name": "ValueError",
"message": "Tensorflow is not installed - this installation only supports ONNX models",
"stack": "---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[6], line 3
1 config_file =r'D:\\Cheminfo_Workshop\\7_Aisynth\\aizynthfinder40\\config1.yml'
2 # config_file ='./config_test.yml'
----> 3 app = AiZynthApp(config_file)
File d:\\Cheminfo_Workshop\\7_Aisynth\\aizynthfinder40\\aizynthfinder\\interfaces\\aizynthapp.py:58, in AiZynthApp.__init__(self, configfile, setup)
55 def __init__(self, configfile: str, setup: bool = True) -> None:
56 # pylint: disable=used-before-assignment
57 setup_logger(logging.INFO)
---> 58 self.finder = AiZynthFinder(configfile=configfile)
59 self._input: StrDict = dict()
60 self._output: StrDict = dict()
File d:\\Cheminfo_Workshop\\7_Aisynth\\aizynthfinder40\\aizynthfinder\\aizynthfinder.py:70, in AiZynthFinder.__init__(self, configfile, configdict)
67 self._logger = logger()
69 if configfile:
---> 70 self.config = Configuration.from_file(configfile)
71 elif configdict:
72 self.config = Configuration.from_dict(configdict)
File d:\\Cheminfo_Workshop\\7_Aisynth\\aizynthfinder40\\aizynthfinder\\context\\config.py:138, in Configuration.from_file(cls, filename)
136 txt = txt.replace(item, os.environ[item[2:-1]])
137 _config = yaml.load(txt, Loader=yaml.SafeLoader)
--> 138 return Configuration.from_dict(_config)
File d:\\Cheminfo_Workshop\\7_Aisynth\\aizynthfinder40\\aizynthfinder\\context\\config.py:107, in Configuration.from_dict(cls, source)
104 config_obj = Configuration()
105 config_obj._update_from_config(dict(source))
--> 107 config_obj.expansion_policy.load_from_config(**expansion_config)
108 config_obj.filter_policy.load_from_config(**filter_config)
109 config_obj.stock.load_from_config(**stock_config)
File d:\\Cheminfo_Workshop\\7_Aisynth\\aizynthfinder40\\aizynthfinder\\context\\policy\\policies.py:132, in ExpansionPolicy.load_from_config(self, **config)
130 if \"type\" in kwargs:
131 del kwargs[\"type\"]
--> 132 obj = cls(key, self._config, **kwargs)
133 self.load(obj)
File d:\\Cheminfo_Workshop\\7_Aisynth\\aizynthfinder40\\aizynthfinder\\context\\policy\\expansion_strategies.py:198, in TemplateBasedExpansionStrategy.__init__(self, key, config, **kwargs)
193 self.chiral_fingerprints = bool(kwargs.get(\"chiral_fingerprints\", False))
195 self._logger.info(
196 f\"Loading template-based expansion policy model from {source} to {self.key}\"
197 )
--> 198 self.model = load_model(source, self.key, self.use_remote_models)
200 self._logger.info(f\"Loading templates from {templatefile} to {self.key}\")
201 if templatefile.endswith(\".csv.gz\") or templatefile.endswith(\".csv\"):
File d:\\Cheminfo_Workshop\\7_Aisynth\\aizynthfinder40\\aizynthfinder\\utils\\models.py:77, in load_model(source, key, use_remote_models)
74 return LocalOnnxModel(source)
76 if not SUPPORT_EXTERNAL_APIS:
---> 77 raise ValueError(
78 \"Tensorflow is not installed - this installation only supports ONNX models\"
79 )
81 if not use_remote_models:
82 return LocalKerasModel(source)
ValueError: Tensorflow is not installed - this installation only supports ONNX models"
}
when I tried using the current ONNX models, the Aizynthfinder program can work well.
however, I still have a confusion why the stock model (zinc_stock.hdf5) can be used, which is an old hdf5 model I used before.
stock:
zinc: zinc_stock.hdf5
many thanks again to your team for the great work!
Best,
You would need to install aizynthfinder with tensorflow support something like this
python -m pip install aizynthfinder[tf]
@SGenheden thank you so much to provide the suggestion. after re-installing the aizynthfinder with tensorflow support, the old hf5.model can be read.
Best,
after re-installing the new version 4.0.0. tar.gz, Some errors occured by using the commandline
could you please help me how to fix that? many many thanks,
Best,