Comments (3)
Hi gaoshan, thank you for using paddlehelix! As for the model inference, you can refer to the
Part III: Downstream Inference of the pretrained_compound tutorial. Hope this can be helpful to you.
from paddlehelix.
Hi gaoshan, thank you for using paddlehelix! As for the model inference, you can refer to the Part III: Downstream Inference of the pretrained_compound tutorial. Hope this can be helpful to you.
Thanks! I will try
from paddlehelix.
I refer to the above tutorial pointed by @Noisyntrain to run an inference case for a finetuned qm7 model, However , it looks the tutorial code does not work for qm7 model. Here is my code , just a few slight changes from the tutorial example ,
All the json config file of inference is same with that of model training
def main(args):
compound_encoder_config = load_json_config( './model_configs/geognn_l8.json')
task_type = 'regr'
dataset_name = 'qm7'
task_names = get_downstream_task_names(dataset_name, './chemrl_downstream_datasets/qm7')
model_config = load_json_config( 'model_configs/down_mlp3.json' )
model_config['task_type'] = task_type
model_config['num_tasks'] = len(task_names)
compound_encoder = GeoGNNModel(compound_encoder_config)
model = DownstreamModel(model_config, compound_encoder)
model.set_state_dict(paddle.load( './model/model.pdparams' )) <- this model is trained by the same config file
transform_fn = DownstreamTransformFn(is_inference=True )
collate_fn = DownstreamCollateFn(
atom_names=compound_encoder_config['atom_names'],
bond_names=compound_encoder_config['bond_names'],
bond_float_names=compound_encoder_config['bond_float_names'],
bond_angle_float_names=compound_encoder_config['bond_angle_float_names'],
is_inference=True,
task_type=task_type)
SMILES="Cc1c(O)nc2ccccn2c1=O"
graph=collate_fn([transform_fn({'smiles':SMILES})])
preds=model(graph.tensor()).numpy()[0]
print('SMILES:%s' % SMILES)
print('Predictions:')
print(str(preds))
for name,prob in zip(task_names.preds):
print(" %s:\t%s" % (name, prob))
Then I got the following errors:
Traceback (most recent call last):
File "inference_regr.py", line 206, in
main(args)
File "inference_regr.py", line 177, in main
preds=model(graph.tensor()).numpy()[0]
AttributeError: 'tuple' object has no attribute 'tensor'
I do not understand what differences between 'qm7' model and the tutorial model ? It looks the tutorial should be applicable to all the finetune models here, right? Could you give me some hints please? Thanks in advance
from paddlehelix.
Related Issues (20)
- 为什么在用rdkit生成3D分子数据时使用最低能量的呢?
- retrosynthesis module didn't work properly
- Get Embedding Layer HOT 2
- Could you please provide the CASP14 test set which you evaluated on? HOT 2
- GEM pretrain model. HOT 1
- GEM does't work HOT 2
- 在使用paddlehelix安装时,sh scripts/build.sh,会出现make: *** makefile。 停止。的错误
- 使用命令 pip install --upgrade git+https~ 时候会出现sklearn is depreciation use scikit-learn instead
- when will Code for "Multimodal Pre-Training Model for Sequence-based Prediction of Protein-Protein Interaction" be released?
- Encountered ImportError when using HelixFold-Single. HOT 1
- 运行JTVAE的代码,preprocess没有问题,训练代码报错,使用的是你们官方提供的数据集 HOT 1
- how to inference with DCU
- ask for the generation of processed.pkl in the geomGCL HOT 1
- 运行tutorial的时候出现与cuda有关的error HOT 1
- 权重
- Get distogram prediction from Helix-single
- paddlehelix安装问题 HOT 4
- 加载GEM pretrain model提示模型shape和权重shape不一致 HOT 1
- 运行脚本train_cls.py报错:AttributeError: type object 'paddle.fluid.libpaddle.VarBase' has no attribute '__getitem__'
- 运行脚本train_cls.py报错,AttributeError: type object 'paddle.fluid.libpaddle.VarBase' has no attribute '__getitem__'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paddlehelix.