Trying to use ChemProp model for scoring but I am getting "No module named chemprop.nn" not found error. #146
Replies: 3 comments 1 reply
-
Hi, Many thanks for your interest in REINVENT and welcome to the community! Looks like you are trying to use a version 2.x model but we currently only support 1.x. Many thanks, |
Beta Was this translation helpful? Give feedback.
-
You can still though write an external script (ExternalProcess scoring component) to run ChemProp 2.x models. |
Beta Was this translation helpful? Give feedback.
-
Yes, the API seems to have completely changed between ChemProp versions. The |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am trying to use Chemprop model for scoring. I use "reinvent -l scoring.log scoring.toml" command. My scoring toml file is in below:
run_type = "scoring"
json_out_config = "_scoring.json" # write this TOML to JSON
[parameters]
smiles_file = "home/Downloads/REINVENT4-main/configs/toml/sampling_hdac6.csv" # SMILES file with 1 molecule per line
output_csv = "scoring_example.csv" # name of output CSV to write, optional
[scoring]
type = "geometric_mean" # or arithmetic_mean
parallel = false # do not run scoring components in parallel
[[scoring.component]]
[scoring.component.custom_alerts]
[[scoring.component.custom_alerts.endpoint]]
name = "Alerts" # user chosen name for output
params.smarts = [
"[;r8]",
"[;r9]",
"[;r10]",
"[;r11]",
"[;r12]",
"[;r13]",
"[;r14]",
"[;r15]",
"[;r16]",
"[;r17]",
"[#8][#8]",
"[#6;+]",
"[#16][#16]",
"[#7;!n][S;!$(S(=O)=O)]",
"[#7;!n][#7;!n]",
"C#C",
"C(=[O,S])[O,S]",
"[#7;!n][C;!$(C(=[O,N])[N,O])][#16;!s]",
"[#7;!n][C;!$(C(=[O,N])[N,O])][#7;!n]",
"[#7;!n][C;!$(C(=[O,N])[N,O])][#8;!o]",
"[#8;!o][C;!$(C(=[O,N])[N,O])][#16;!s]",
"[#8;!o][C;!$(C(=[O,N])[N,O])][#8;!o]",
"[#16;!s][C;!$(C(=[O,N])[N,O])][#16;!s]"
]
[[scoring.component]]
[scoring.component.QED]
[[scoring.component.QED.endpoint]]
name = "QED"
weight = 0.25 # weight to fine-tune the importance of this component
[[scoring.component]]
[[scoring.component.ChemProp.endpoint]]
name = "ChemProp"
weight = 0.6
params.checkpoint_dir = "/home/Downloads/chemprop-main/chemprop_training/regression/2024-10-14T10-23-07/model_0/"
params.rdkit_2d_normalized = true
params.target_column = "dG"
transform.type = "reverse_sigmoid"
transform.high = -5.0
transform.low = -35.0
transform.k = 0.4
I am getting this error:
Traceback (most recent call last):
File "/nfs/home/myuecel3/anaconda3/envs/reinvent4/bin/reinvent", line 8, in
sys.exit(main())
File "/nfs/home/myuecel3/anaconda3/envs/reinvent4/lib/python3.10/site-packages/reinvent/Reinvent.py", line 334, in main
runner(
File "/nfs/home/myuecel3/anaconda3/envs/reinvent4/lib/python3.10/site-packages/reinvent/runmodes/scoring/run_scoring.py", line 58, in run_scoring
scoring_function = Scorer(config.scoring)
File "/nfs/home/myuecel3/anaconda3/envs/reinvent4/lib/python3.10/site-packages/reinvent/scoring/scorer.py", line 75, in init
self.components = get_components(config.component)
File "/nfs/home/myuecel3/anaconda3/envs/reinvent4/lib/python3.10/site-packages/reinvent/scoring/config.py", line 94, in get_components
component = Component(component_params)
File "/nfs/home/myuecel3/anaconda3/envs/reinvent4/lib/python3.10/site-packages/reinvent_plugins/components/comp_chemprop.py", line 78, in init
chemprop_model = chemprop.train.load_model(args=chemprop_args)
File "/nfs/home/myuecel3/anaconda3/envs/reinvent4/lib/python3.10/site-packages/chemprop/train/make_predictions.py", line 27, in load_model
train_args = load_args(args.checkpoint_paths[0])
File "/nfs/home/myuecel3/anaconda3/envs/reinvent4/lib/python3.10/site-packages/chemprop/utils.py", line 422, in load_args
vars(torch.load(path, map_location=lambda storage, loc: storage)["args"]),
File "/nfs/home/myuecel3/anaconda3/envs/reinvent4/lib/python3.10/site-packages/torch/serialization.py", line 1026, in load
return _load(opened_zipfile,
File "/nfs/home/myuecel3/anaconda3/envs/reinvent4/lib/python3.10/site-packages/torch/serialization.py", line 1438, in _load
result = unpickler.load()
File "/nfs/home/myuecel3/anaconda3/envs/reinvent4/lib/python3.10/site-packages/torch/serialization.py", line 1431, in find_class
return super().find_class(mod_name, name)
ModuleNotFoundError: No module named 'chemprop.nn'
Any help would be appreciated.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions