Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A issue about running the expander. #170

Open
yyh030806 opened this issue Nov 27, 2024 · 1 comment
Open

A issue about running the expander. #170

yyh030806 opened this issue Nov 27, 2024 · 1 comment

Comments

@yyh030806
Copy link

Hello!
I run the the code:

from aizynthfinder.aizynthfinder import AiZynthExpander
expander = AiZynthExpander(configfile='/data/yuhangyang/retro_agent/retro_agent/single_step_model/config.yml')
expander.expansion_policy.select()
test_smiles = ["O=C(O)COCCOCCOCCOCCOCCOCCOCC(F)(F)F", "COc1cc(N)c(Cl)cc1C(=O)NCCCC1CN(Cc2ccccc2)CCO1"]
for smi in test_smiles:
    predictions = expander.do_expansion(smi)
    print(predictions[0][0].reaction_smiles())

with config:

expansion:
  full:
    - /data/yuhangyang/retro_agent/retro_agent/single_step_model/uspto_rxn_n1_keras_model.hdf5
    - /data/yuhangyang/retro_agent/retro_agent/single_step_model/uspto_rxn_n1_unique_templates.hdf5

and get error:

Traceback (most recent call last):
  File "/data/yuhangyang/retro_agent/retro_agent/call_single_step_model.py", line 2, in <module>
    expander = AiZynthExpander(configfile='/data/yuhangyang/retro_agent/retro_agent/single_step_model/config.yml')
  File "/data/yuhangyang/retro_agent/retro_agent/aizynthfinder/aizynthfinder.py", line 362, in __init__
    self.config = Configuration.from_file(configfile)
  File "/data/yuhangyang/retro_agent/retro_agent/aizynthfinder/context/config.py", line 141, in from_file
    return Configuration.from_dict(_config)
  File "/data/yuhangyang/retro_agent/retro_agent/aizynthfinder/context/config.py", line 110, in from_dict
    config_obj.expansion_policy.load_from_config(**expansion_config)
  File "/data/yuhangyang/retro_agent/retro_agent/aizynthfinder/context/policy/policies.py", line 132, in load_from_config
    obj = cls(key, self._config, **kwargs)
  File "/data/yuhangyang/retro_agent/retro_agent/aizynthfinder/context/policy/expansion_strategies.py", line 293, in __init__
    self.model = load_model(source, self.key, self.use_remote_models)
  File "/data/yuhangyang/retro_agent/retro_agent/aizynthfinder/utils/models.py", line 82, in load_model
    return LocalKerasModel(source)
  File "/data/yuhangyang/retro_agent/retro_agent/aizynthfinder/utils/models.py", line 114, in __init__
    self.model = load_keras_model(
  File "/data/yuhangyang/miniconda3/envs/retro_agent/lib/python3.9/site-packages/keras/src/saving/saving_api.py", line 196, in load_model
    return legacy_h5_format.load_model_from_hdf5(
  File "/data/yuhangyang/miniconda3/envs/retro_agent/lib/python3.9/site-packages/keras/src/legacy/saving/legacy_h5_format.py", line 155, in load_model_from_hdf5
    **saving_utils.compile_args_from_training_config(
  File "/data/yuhangyang/miniconda3/envs/retro_agent/lib/python3.9/site-packages/keras/src/legacy/saving/saving_utils.py", line 151, in compile_args_from_training_config
    metrics = _deserialize_nested_config(
  File "/data/yuhangyang/miniconda3/envs/retro_agent/lib/python3.9/site-packages/keras/src/legacy/saving/saving_utils.py", line 209, in _deserialize_nested_config
    return [
  File "/data/yuhangyang/miniconda3/envs/retro_agent/lib/python3.9/site-packages/keras/src/legacy/saving/saving_utils.py", line 210, in <listcomp>
    _deserialize_nested_config(deserialize_fn, obj) for obj in config
  File "/data/yuhangyang/miniconda3/envs/retro_agent/lib/python3.9/site-packages/keras/src/legacy/saving/saving_utils.py", line 209, in _deserialize_nested_config
    return [
  File "/data/yuhangyang/miniconda3/envs/retro_agent/lib/python3.9/site-packages/keras/src/legacy/saving/saving_utils.py", line 210, in <listcomp>
    _deserialize_nested_config(deserialize_fn, obj) for obj in config
  File "/data/yuhangyang/miniconda3/envs/retro_agent/lib/python3.9/site-packages/keras/src/legacy/saving/saving_utils.py", line 202, in _deserialize_nested_config
    return deserialize_fn(config)
  File "/data/yuhangyang/miniconda3/envs/retro_agent/lib/python3.9/site-packages/keras/src/legacy/saving/saving_utils.py", line 226, in _deserialize_metric
    return metrics_module.deserialize(metric_config)
  File "/data/yuhangyang/miniconda3/envs/retro_agent/lib/python3.9/site-packages/keras/src/metrics/__init__.py", line 160, in deserialize
    return serialization_lib.deserialize_keras_object(
  File "/data/yuhangyang/miniconda3/envs/retro_agent/lib/python3.9/site-packages/keras/src/saving/serialization_lib.py", line 581, in deserialize_keras_object
    return deserialize_keras_object(
  File "/data/yuhangyang/miniconda3/envs/retro_agent/lib/python3.9/site-packages/keras/src/saving/serialization_lib.py", line 718, in deserialize_keras_object
    instance = cls.from_config(inner_config)
  File "/data/yuhangyang/miniconda3/envs/retro_agent/lib/python3.9/site-packages/keras/src/metrics/reduction_metrics.py", line 220, in from_config
    return cls(**config)
  File "/data/yuhangyang/miniconda3/envs/retro_agent/lib/python3.9/site-packages/keras/src/metrics/reduction_metrics.py", line 188, in __init__
    super().__init__(name=name, dtype=dtype)
  File "/data/yuhangyang/miniconda3/envs/retro_agent/lib/python3.9/site-packages/keras/src/metrics/reduction_metrics.py", line 125, in __init__
    self.total = self.add_variable(
  File "/data/yuhangyang/miniconda3/envs/retro_agent/lib/python3.9/site-packages/keras/src/metrics/metric.py", line 196, in add_variable
    with backend.name_scope(self.name.replace("/", ">"), caller=self):
AttributeError: 'functools.partial' object has no attribute 'replace'

Could you give me some advice about the error?
Thanks !

@SGenheden
Copy link
Contributor

This looks an issue with keras and/or tensorflow. Which version of these packages do you have in your environment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants