{"id":13689033,"url":"https://github.com/DeepGraphLearning/torchdrug","last_synced_at":"2025-05-01T23:31:45.046Z","repository":{"id":40045015,"uuid":"394517440","full_name":"DeepGraphLearning/torchdrug","owner":"DeepGraphLearning","description":"A powerful and flexible machine learning platform for drug discovery","archived":false,"fork":false,"pushed_at":"2024-08-12T02:07:40.000Z","size":2754,"stargazers_count":1438,"open_issues_count":122,"forks_count":200,"subscribers_count":29,"default_branch":"master","last_synced_at":"2024-11-11T18:52:23.418Z","etag":null,"topics":["deep-learning","drug-discovery","graph-neural-networks","pytorch"],"latest_commit_sha":null,"homepage":"https://torchdrug.ai/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DeepGraphLearning.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-08-10T03:51:24.000Z","updated_at":"2024-11-11T13:02:49.000Z","dependencies_parsed_at":"2024-01-17T06:11:05.327Z","dependency_job_id":"59260ab2-4f8b-40f8-9796-49a23a650008","html_url":"https://github.com/DeepGraphLearning/torchdrug","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepGraphLearning%2Ftorchdrug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepGraphLearning%2Ftorchdrug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepGraphLearning%2Ftorchdrug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepGraphLearning%2Ftorchdrug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DeepGraphLearning","download_url":"https://codeload.github.com/DeepGraphLearning/torchdrug/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224282089,"owners_count":17285769,"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","drug-discovery","graph-neural-networks","pytorch"],"created_at":"2024-08-02T15:01:31.300Z","updated_at":"2024-11-12T13:30:36.839Z","avatar_url":"https://github.com/DeepGraphLearning.png","language":"Python","readme":"[![TorchDrug](asset/torchdrug_logo_full.svg)](https://torchdrug.ai/)\n\u003ch1 align=\"center\"\u003e\n  with\n  \u003ca href=\"https://torchprotein.ai/\"\u003e\n    \u003cimg src=\"asset/torchprotein_logo_tight.svg\" alt=\"TorchProtein\" style=\"height:26px\" /\u003e\n  \u003c/a\u003e\n\u003c/h1\u003e\n\n[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1Tbnr1Fog_YjkqU1MOhcVLuxqZ4DC-c8-#forceEdit=true\u0026sandboxMode=true)\n[![Contributions](https://img.shields.io/badge/contributions-welcome-blue)](https://github.com/DeepGraphLearning/torchdrug/blob/master/CONTRIBUTING.md)\n[![License Apache-2.0](https://img.shields.io/github/license/DeepGraphLearning/torchdrug?color=blue)](https://github.com/DeepGraphLearning/torchdrug/blob/master/LICENSE)\n[![PyPI downloads](https://static.pepy.tech/personalized-badge/torchdrug?period=total\u0026units=international_system\u0026left_color=grey\u0026right_color=blue\u0026left_text=downloads)](https://pypi.org/project/torchdrug/)\n[![TorchDrug Twitter](https://img.shields.io/twitter/url?label=TorchDrug\u0026style=social\u0026url=https%3A%2F%2Ftwitter.com%2FDrugTorch)](https://twitter.com/DrugTorch)\n\n[Docs] | [Tutorials] | [Benchmarks] | [Papers Implemented]\n\n[Docs]: https://deepgraphlearning.github.io/torchdrug-site/docs\n[Tutorials]: https://deepgraphlearning.github.io/torchdrug-site/docs/tutorials\n[Benchmarks]: https://deepgraphlearning.github.io/torchdrug-site/docs/benchmark\n[Papers Implemented]: https://deepgraphlearning.github.io/torchdrug-site/docs/paper\n\nTorchDrug is a [PyTorch]-based machine learning toolbox designed for several purposes.\n\n- Easy implementation of graph operations in a PyTorchic style with GPU support\n- Being friendly to practitioners with minimal knowledge about drug discovery\n- Rapid prototyping of machine learning research\n\n[PyTorch]: https://pytorch.org/\n\nInstallation\n------------\n\nTorchDrug can be installed on either Linux, Windows or macOS. It is compatible with\n3.7 \u003c= Python \u003c= 3.10 and PyTorch \u003e= 1.8.0.\n\n### From Conda ###\n\n```bash\nconda install torchdrug -c milagraph -c conda-forge -c pytorch -c pyg\n```\n\n### From Pip ###\n\n```bash\npip install torch==1.9.0\npip install torch-scatter torch-cluster -f https://pytorch-geometric.com/whl/torch-1.9.0+cu102.html\npip install torchdrug\n```\n\nTo install `torch-scatter` for other PyTorch or CUDA versions, please see the\ninstructions in https://github.com/rusty1s/pytorch_scatter\n\n### From Source ###\n\n```bash\ngit clone https://github.com/DeepGraphLearning/torchdrug\ncd torchdrug\npip install -r requirements.txt\npython setup.py install\n```\n\n### Windows (PowerShell) ###\n\nWe need to first install the build tools for Visual Studio. We then install the\nfollowing modules in PowerShell.\n\n```powershell\nInstall-Module Pscx -AllowClobber\nInstall-Module VSSetup\n```\n\nInitialize Visual Studio in PowerShell with the following commands. We may setup\nthis for all PowerShell sessions by writing it to the PowerShell profile. Change\nthe library path according to your own case.\n\n```powershell\nImport-VisualStudioVars -Architecture x64\n$env:LIB += \";C:\\Program Files\\Python37\\libs\"\n```\n\n### Apple Silicon (M1/M2 Chips) ###\n\nWe need PyTorch \u003e= 1.13 to run TorchDrug on Apple silicon. For `torch-scatter` and\n`torch-cluster`, they can be compiled from their sources. Note TorchDrug doesn't\nsupport `mps` devices.\n\n```bash\npip install torch==1.13.0\npip install git+https://github.com/rusty1s/pytorch_scatter.git\npip install git+https://github.com/rusty1s/pytorch_cluster.git\npip install torchdrug\n```\n\nQuick Start\n-----------\n\nTorchDrug is designed for humans and focused on graph structured data.\nIt enables easy implementation of graph operations in machine learning models.\nAll the operations in TorchDrug are backed by [PyTorch] framework, and support GPU\nacceleration and auto differentiation.\n\n```python\nfrom torchdrug import data\n\nedge_list = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 0]]\ngraph = data.Graph(edge_list, num_node=6)\ngraph = graph.cuda()\n# the subgraph induced by nodes 2, 3 \u0026 4\nsubgraph = graph.subgraph([2, 3, 4])\n```\n\nMolecules are also supported in TorchDrug. You can get the desired molecule\nproperties without any domain knowledge.\n\n```python\nmol = data.Molecule.from_smiles(\"CCOC(=O)N\", atom_feature=\"default\", bond_feature=\"default\")\nprint(mol.node_feature)\nprint(mol.atom_type)\nprint(mol.to_scaffold())\n```\n\nYou may also register custom node, edge or graph attributes. They will be\nautomatically processed during indexing operations.\n\n```python\nwith mol.edge():\n\tmol.is_CC_bond = (mol.edge_list[:, :2] == td.CARBON).all(dim=-1)\nsub_mol = mol.subgraph(mol.atom_type != td.NITROGEN)\nprint(sub_mol.is_CC_bond)\n```\n\nTorchDrug provides a wide range of common datasets and building blocks for drug\ndiscovery. With minimal code, you can apply standard models to solve your own\nproblem.\n\n```python\nimport torch\nfrom torchdrug import datasets\n\ndataset = datasets.Tox21()\ndataset[0].visualize()\nlengths = [int(0.8 * len(dataset)), int(0.1 * len(dataset))]\nlengths += [len(dataset) - sum(lengths)]\ntrain_set, valid_set, test_set = torch.utils.data.random_split(dataset, lengths)\n```\n\n```python\nfrom torchdrug import models, tasks\n\nmodel = models.GIN(dataset.node_feature_dim, hidden_dims=[256, 256, 256, 256])\ntask = tasks.PropertyPrediction(model, task=dataset.tasks)\n```\n\nTraining and inference are accelerated by multiple CPUs or GPUs.\nThis can be seamlessly switched in TorchDrug by just a line of code.\n```python\nfrom torchdrug import core\n\n# Single CPU / Multiple CPUs / Distributed CPUs\nsolver = core.Engine(task, train_set, valid_set, test_set, optimizer)\n# Single GPU\nsolver = core.Engine(task, train_set, valid_set, test_set, optimizer, gpus=[0])\n# Multiple GPUs\nsolver = core.Engine(task, train_set, valid_set, test_set, optimizer, gpus=[0, 1, 2, 3])\n# Distributed GPUs\nsolver = core.Engine(task, train_set, valid_set, test_set, optimizer, gpus=[0, 1, 2, 3, 0, 1, 2, 3])\n```\n\nExperiments can be easily tracked and managed through [Weights \u0026 Biases platform].\n```python\nsolver = core.Engine(task, train_set, valid_set, test_set, optimizer, logger=\"wandb\")\n```\n\n[Weights \u0026 Biases platform]: https://wandb.ai/\n\nContributing\n------------\n\nEveryone is welcome to contribute to the development of TorchDrug.\nPlease refer to [contributing guidelines](CONTRIBUTING.md) for more details.\n\nLicense\n-------\n\nTorchDrug is released under [Apache-2.0 License](LICENSE).\n","funding_links":[],"categories":["Python","药物发现、药物设计","Ranked by starred repositories"],"sub_categories":["网络服务_其他"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDeepGraphLearning%2Ftorchdrug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDeepGraphLearning%2Ftorchdrug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDeepGraphLearning%2Ftorchdrug/lists"}