{"id":15140776,"url":"https://github.com/yuyangw/molclr","last_synced_at":"2025-04-07T17:10:26.715Z","repository":{"id":37509481,"uuid":"424375328","full_name":"yuyangw/MolCLR","owner":"yuyangw","description":"Implementation of MolCLR: \"Molecular Contrastive Learning of Representations via Graph Neural Networks\" in PyG.","archived":false,"fork":false,"pushed_at":"2023-11-04T04:25:44.000Z","size":14201,"stargazers_count":274,"open_issues_count":8,"forks_count":64,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T17:09:56.024Z","etag":null,"topics":["deep-learning","graph-neural-networks","molecule","pytorch","pytorch-geometric","self-supervised-learning"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yuyangw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-03T20:45:58.000Z","updated_at":"2025-04-06T08:28:06.000Z","dependencies_parsed_at":"2024-09-26T08:51:22.969Z","dependency_job_id":null,"html_url":"https://github.com/yuyangw/MolCLR","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"3d3bc1912be27b0c97435fd9134f4d4c73d4c5ab"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuyangw%2FMolCLR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuyangw%2FMolCLR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuyangw%2FMolCLR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuyangw%2FMolCLR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuyangw","download_url":"https://codeload.github.com/yuyangw/MolCLR/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247694876,"owners_count":20980733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","graph-neural-networks","molecule","pytorch","pytorch-geometric","self-supervised-learning"],"created_at":"2024-09-26T08:41:06.678Z","updated_at":"2025-04-07T17:10:26.680Z","avatar_url":"https://github.com/yuyangw.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Molecular Contrastive Learning of Representations via Graph Neural Networks ##\n\n#### Nature Machine Intelligence [[Paper]](https://www.nature.com/articles/s42256-022-00447-x) [[arXiv]](https://arxiv.org/abs/2102.10056/) [[PDF]](https://www.nature.com/articles/s42256-022-00447-x.pdf) \u003c/br\u003e\n[Yuyang Wang](https://yuyangw.github.io/), [Jianren Wang](https://www.jianrenw.com/), [Zhonglin Cao](https://www.linkedin.com/in/zhonglincao/?trk=public_profile_browsemap), [Amir Barati Farimani](https://www.meche.engineering.cmu.edu/directory/bios/barati-farimani-amir.html) \u003c/br\u003e\nCarnegie Mellon University \u003c/br\u003e\n\n\u003cimg src=\"figs/pipeline.gif\" width=\"450\"\u003e\n\nThis is the official implementation of \u003cstrong\u003e\u003cem\u003eMolCLR\u003c/em\u003e\u003c/strong\u003e: [\"Molecular Contrastive Learning of Representations via Graph Neural Networks\"](https://www.nature.com/articles/s42256-022-00447-x). In this work, we introduce a contrastive learning framework for molecular representation learning on large unlabelled dataset (~10M unique molecules). \u003cstrong\u003e\u003cem\u003eMolCLR\u003c/em\u003e\u003c/strong\u003e pre-training greatly boosts the performance of GNN models on various downstream molecular property prediction benchmarks. \nIf you find our work useful in your research, please cite:\n\n```\n@article{wang2022molclr,\n  title={Molecular contrastive learning of representations via graph neural networks},\n  author={Wang, Yuyang and Wang, Jianren and Cao, Zhonglin and Barati Farimani, Amir},\n  journal={Nature Machine Intelligence},\n  pages={1--9},\n  year={2022},\n  publisher={Nature Publishing Group},\n  doi={10.1038/s42256-022-00447-x}\n}\n```\n\n\n## Getting Started\n\n### Installation\n\nSet up conda environment and clone the github repo\n\n```\n# create a new environment\n$ conda create --name molclr python=3.7\n$ conda activate molclr\n\n# install requirements\n$ pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 -f https://download.pytorch.org/whl/torch_stable.html\n$ pip install torch-geometric==1.6.3 torch-sparse==0.6.9 torch-scatter==2.0.6 -f https://pytorch-geometric.com/whl/torch-1.7.0+cu110.html\n$ pip install PyYAML\n$ conda install -c conda-forge rdkit=2020.09.1.0\n$ conda install -c conda-forge tensorboard\n$ conda install -c conda-forge nvidia-apex # optional\n\n# clone the source code of MolCLR\n$ git clone https://github.com/yuyangw/MolCLR.git\n$ cd MolCLR\n```\n\n### Dataset\n\nYou can download the pre-training data and benchmarks used in the paper [here](https://drive.google.com/file/d/1aDtN6Qqddwwn2x612kWz9g0xQcuAtzDE/view?usp=sharing) and extract the zip file under `./data` folder. The data for pre-training can be found in `pubchem-10m-clean.txt`. All the databases for fine-tuning are saved in the folder under the benchmark name. You can also find the benchmarks from [MoleculeNet](https://moleculenet.org/).\n\n### Pre-training\n\nTo train the MolCLR, where the configurations and detailed explaination for each variable can be found in `config.yaml`\n```\n$ python molclr.py\n```\n\nTo monitor the training via tensorboard, run `tensorboard --logdir ckpt/{PATH}` and click the URL http://127.0.0.1:6006/.\n\n### Fine-tuning \n\nTo fine-tune the MolCLR pre-trained model on downstream molecular benchmarks, where the configurations and detailed explaination for each variable can be found in `config_finetune.yaml`\n```\n$ python finetune.py\n```\n\n### Pre-trained models\n\nWe also provide pre-trained GCN and GIN models, which can be found in `ckpt/pretrained_gin` and `ckpt/pretrained_gcn` respectively. \n\n## Acknowledgement\n\n- PyTorch implementation of SimCLR: [https://github.com/sthalles/SimCLR](https://github.com/sthalles/SimCLR)\n- Strategies for Pre-training Graph Neural Networks: [https://github.com/snap-stanford/pretrain-gnns](https://github.com/snap-stanford/pretrain-gnns)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuyangw%2Fmolclr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuyangw%2Fmolclr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuyangw%2Fmolclr/lists"}