{"id":15012410,"url":"https://github.com/microsoft/ptgnn","last_synced_at":"2025-04-04T14:09:10.007Z","repository":{"id":37682102,"uuid":"263281224","full_name":"microsoft/ptgnn","owner":"microsoft","description":"A PyTorch Graph Neural Network Library","archived":false,"fork":false,"pushed_at":"2022-02-01T17:31:29.000Z","size":307,"stargazers_count":375,"open_issues_count":1,"forks_count":39,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-28T13:09:30.330Z","etag":null,"topics":["deep-learning","geometric-deep-learning","gnn","graph-neural-networks","pytorch"],"latest_commit_sha":null,"homepage":null,"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/microsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null}},"created_at":"2020-05-12T08:42:30.000Z","updated_at":"2025-02-22T11:34:50.000Z","dependencies_parsed_at":"2022-08-04T08:30:24.242Z","dependency_job_id":null,"html_url":"https://github.com/microsoft/ptgnn","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fptgnn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fptgnn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fptgnn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fptgnn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoft","download_url":"https://codeload.github.com/microsoft/ptgnn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190253,"owners_count":20898702,"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","geometric-deep-learning","gnn","graph-neural-networks","pytorch"],"created_at":"2024-09-24T19:42:35.524Z","updated_at":"2025-04-04T14:09:09.992Z","avatar_url":"https://github.com/microsoft.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# ptgnn: A PyTorch GNN Library ![PyPI](https://img.shields.io/pypi/v/ptgnn?style=flat-square) ![conda](https://img.shields.io/conda/vn/conda-forge/ptgnn)\n\nThis is a library containing pyTorch code for creating graph neural network (GNN) models.\nThe library provides some sample implementations.\n\nIf you are interested in using this library, please read about its [architecture](docs/architecture.md)\nand [how to define GNN models](docs/gnns.md) or follow [this tutorial](docs/tutorial.md).\n\nNote that `ptgnn` takes care of defining the whole pipeline, including data wrangling tasks, such\nas data loading and tensorization. It also defines PyTorch `nn.Module`s for\nthe neural network operations. These are independent of the\n`AbstractNeuralModel`s and can be used as all other PyTorch's `nn.Module`s,\nif one wishes to do so.\n\nThe library is mainly engineered to be fast for sparse graphs. For example, for the\nGraph2Class task (discussed below) on a V100 with the default hyperparameters and architecture\n`ptgnn` can process about 82 graphs/sec (209k nodes/sec and 1,129k edges/sec) during training\nand about 200 graph/sec (470k nodes/sec and 2,527k edges/sec) during testing.\n\n#### Implemented Tasks\nAll task implementations can be found in the [`ptgnn.implementations`](ptgnn/implementations) package.\nDetailed instructions on the data and the training steps can be found [here](/docs/implementations.md).\nWe welcome external contributions. The following GNN-based tasks are implemented:\n\n* **PPI** The PPI task as described by\n[Zitnik and Leskovec, 2017](https://arxiv.org/abs/1707.04638).\n* **VarMisuse** This is a re-implementation of the VariableMisuse task of\n    [Allamanis _et al._, 2018](https://arxiv.org/abs/1711.00740).\n* **Graph2Sequence** This is re-implementation of the GNN-\u003eGRU model of\n                     [Fernandes _et. al._, 2019](https://arxiv.org/abs/1811.01824).\n* **Graph2Class** Classify (Label) a subset of the input nodes into classes\n                    similar to Graph2Class in [Typilus](https://arxiv.org/abs/2004.10657).\n\n\nThe [tutorial](docs/tutorial.md) gives a step-by-step example for coding the Graph2Class model.\n\n\n### Installation\n\nThis code was tested with PyTorch 1.4 and depends\non [`pytorch-scatter`](https://github.com/rusty1s/pytorch_scatter).\nPlease install the appropriate versions of these libraries based\non your CUDA setup following their instructions. (Note\nthat the `pytorch-scatter` binaries built for CUDA 10.1 also work for\nCUDA 10.2).\n\n1. To install PyTorch 1.7.0 or higher, use the up-to-date command from [PyTorch Get Started](https://pytorch.org/get-started/), selecting the appropriate options, e.g. for Linux, pip, and CUDA 10.1 it's currently:\n    ```bash\n    pip install torch torchvision\n    ```\n\n1. To install `pytorch-scatter`, follow the instructions from the [GitHub repo](https://github.com/rusty1s/pytorch_scatter), choosing the appropriate CUDA option, _e.g._, for PyTorch 1.7.0 and CUDA 10.1:\n    ```bash\n    pip install torch-scatter==2.0.5+cu101 -f https://pytorch-geometric.com/whl/torch-1.7.0.html\n    ```\n\n1. To install `ptgnn` from pypi, including all other dependencies:\n    ```bash\n   pip install ptgnn\n    ```\n   If you want to use ptgnn sampels with Azure ML (e.g. the `--aml` flag in the implementation CLIs), install with\n   ```bash\n    pip install ptgnn[aml]\n    ```\n   or directly from the sources, `cd` into the root directory of the project and run\n    ```bash\n    pip install -e .\n    ```\n    To check that installation was successful and run the unit tests:\n    ```python\n    python setup.py test\n    ```\n\n1. To install `ptgnn` from conda, including all other dependencies:\n    ```bash\n   conda search ptgnn --channel conda-forge\n    ```\n\n# Contributing\n\nThis project welcomes contributions and suggestions.  Most contributions require you to agree to a\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\nthe rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.\n\nWhen you submit a pull request, a CLA bot will automatically determine whether you need to provide\na CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions\nprovided by the bot. You will only need to do this once across all repos using our CLA.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\nFor more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or\ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n\n### Developing ptgnn\n![Unit Tests](https://github.com/microsoft/ptgnn/workflows/Unit%20Tests/badge.svg)\n[![Total alerts](https://img.shields.io/lgtm/alerts/g/microsoft/ptgnn.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/microsoft/ptgnn/alerts/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nTo contribute to this library, first follow the next steps to setup your\ndevelopment environment:\n* Install the library requirements.\n* Install the pre-commit hooks:\n    * Run `pip3 install pre-commit`\n    * Install the hooks `pre-commit install`\n\n###### Using Conda\nIf you are using conda, then download the correct torch-scatter wheel.\nIf using `torch==1.7.0` and Python 3.7, you can use the [environment.yml](environment.yml)\nincluded in the repo, with the following steps:\n```\n$ conda env create -f environment.yml\n$ conda activate ptgnn-env\n$ pip install torch_scatter-2.0.5+cu102-cp37-cp37m-linux_x86_64.whl\n$ pip install -e .\n$ python setup.py test\n$ pip install pre-commit\n$ pre-commit install\n```\n\n###### Releasing to PyPi\nTo create a PyPi release push a tag in the form `v1.3.4` in this repository (make\nsure that you follow [semantic versioning](https://semver.org/)). The\n[Publish on PyPi](https://github.com/microsoft/ptgnn/actions?query=workflow%3A%22Publish+on+PyPi%22)\nGitHub action will automatically upload a new release.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fptgnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoft%2Fptgnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fptgnn/lists"}