Graph Classification with Transformers
📰 Hugging Face Blog
Graph classification with Transformers using the Graphormer model
Action Steps
- Install the required libraries, including Transformers and PyTorch
- Load the graph data and preprocess it
- Load the Graphormer model and fine-tune it for graph classification
- Train and evaluate the model on the graph classification task
Who Needs to Know This
Data scientists and machine learning engineers can benefit from this tutorial to learn graph classification using Transformers, which can be applied to various graph-structured data
Key Insight
💡 The Graphormer model can be used for graph classification tasks using the Transformers library
Share This
🤖 Learn graph classification with Transformers using Graphormer! 📊
Key Takeaways
Graph classification with Transformers using the Graphormer model
Full Article
Published Time: 2023-04-14T00:00:00.204Z
# Graph Classification with Transformers
[Hugging Face](https://huggingface.co/)
* [Models](https://huggingface.co/models)
* [Datasets](https://huggingface.co/datasets)
* [Spaces](https://huggingface.co/spaces)
* [Buckets new](https://huggingface.co/storage)
* [Docs](https://huggingface.co/docs)
* [Enterprise](https://huggingface.co/enterprise)
* [Pricing](https://huggingface.co/pricing)
*
*
* * *
* [Log In](https://huggingface.co/login)
* [Sign Up](https://huggingface.co/join)
[Back to Articles](https://huggingface.co/blog)
# [](https://huggingface.co/blog/graphml-classification#graph-classification-with-transformers) Graph classification with Transformers
Published April 14, 2023
[Update on GitHub](https://github.com/huggingface/blog/blob/main/graphml-classification.md)
[- [x] Upvote 5](https://huggingface.co/login?next=%2Fblog%2Fgraphml-classification)
* [](https://huggingface.co/Charletta1 "Charletta1")
* [](https://huggingface.co/ardavey "ardavey")
* [](https://huggingface.co/Lucas-Hyun-Lee "Lucas-Hyun-Lee")
* [](https://huggingface.co/sadiiipc "sadiiipc")
* [](https://huggingface.co/prmidaghm "prmidaghm")
[](https://huggingface.co/clefourrier)
[Clémentine Fourrier clefourrier Follow](https://huggingface.co/clefourrier)
Published April 14, 2023.[Update on GitHub](https://github.com/huggingface/blog/blob/main/graphml-classification.md)
[ `clefourrier`Clémentine Fourrier](https://huggingface.co/clefourrier)
* [Requirements](https://huggingface.co/blog/graphml-classification#requirements "Requirements")
* [Data](https://huggingface.co/blog/graphml-classification#data "Data")
* [Loading](https://huggingface.co/blog/graphml-classification#loading "Loading")
* [Format](https://huggingface.co/blog/graphml-classification#format "Format")
* [Preprocessing](https://huggingface.co/blog/graphml-classification#preprocessing "Preprocessing")
* [Model](https://huggingface.co/blog/graphml-classification#model "Model")
* [Loading](https://huggingface.co/blog/graphml-classification#loading-1 "Loading")
* [Training or fine-tuning](https://huggingface.co/blog/graphml-classification#training-or-fine-tuning "Training or fine-tuning")
* [Ending note](https://huggingface.co/blog/graphml-classification#ending-note "Ending note")
In the previous [blog](https://huggingface.co/blog/intro-graphml), we explored some of the theoretical aspects of machine learning on graphs. This one will explore how you can do graph classification using the Transformers library. (You can also follow along by downloading the demo notebook [here](https://github.com/huggingface/blog/blob/main/notebooks/graphml-classification.ipynb)!)
At the moment, the only graph transformer model available in Transformers is Microsoft's [Graphormer](https://arxiv.org/abs/2106.05234), so this is the one we will use here. We are looking forward to seeing what other models people will use and integrate 🤗
## [](https://huggingface.co/blog/graphml-classification#requirements) Requirements
To follow this tutorial, you need to have installed `data
# Graph Classification with Transformers
[Hugging Face](https://huggingface.co/)
* [Models](https://huggingface.co/models)
* [Datasets](https://huggingface.co/datasets)
* [Spaces](https://huggingface.co/spaces)
* [Buckets new](https://huggingface.co/storage)
* [Docs](https://huggingface.co/docs)
* [Enterprise](https://huggingface.co/enterprise)
* [Pricing](https://huggingface.co/pricing)
*
*
* * *
* [Log In](https://huggingface.co/login)
* [Sign Up](https://huggingface.co/join)
[Back to Articles](https://huggingface.co/blog)
# [](https://huggingface.co/blog/graphml-classification#graph-classification-with-transformers) Graph classification with Transformers
Published April 14, 2023
[Update on GitHub](https://github.com/huggingface/blog/blob/main/graphml-classification.md)
[- [x] Upvote 5](https://huggingface.co/login?next=%2Fblog%2Fgraphml-classification)
* [](https://huggingface.co/Charletta1 "Charletta1")
* [](https://huggingface.co/ardavey "ardavey")
* [](https://huggingface.co/Lucas-Hyun-Lee "Lucas-Hyun-Lee")
* [](https://huggingface.co/sadiiipc "sadiiipc")
* [](https://huggingface.co/prmidaghm "prmidaghm")
[](https://huggingface.co/clefourrier)
[Clémentine Fourrier clefourrier Follow](https://huggingface.co/clefourrier)
Published April 14, 2023.[Update on GitHub](https://github.com/huggingface/blog/blob/main/graphml-classification.md)
[ `clefourrier`Clémentine Fourrier](https://huggingface.co/clefourrier)
* [Requirements](https://huggingface.co/blog/graphml-classification#requirements "Requirements")
* [Data](https://huggingface.co/blog/graphml-classification#data "Data")
* [Loading](https://huggingface.co/blog/graphml-classification#loading "Loading")
* [Format](https://huggingface.co/blog/graphml-classification#format "Format")
* [Preprocessing](https://huggingface.co/blog/graphml-classification#preprocessing "Preprocessing")
* [Model](https://huggingface.co/blog/graphml-classification#model "Model")
* [Loading](https://huggingface.co/blog/graphml-classification#loading-1 "Loading")
* [Training or fine-tuning](https://huggingface.co/blog/graphml-classification#training-or-fine-tuning "Training or fine-tuning")
* [Ending note](https://huggingface.co/blog/graphml-classification#ending-note "Ending note")
In the previous [blog](https://huggingface.co/blog/intro-graphml), we explored some of the theoretical aspects of machine learning on graphs. This one will explore how you can do graph classification using the Transformers library. (You can also follow along by downloading the demo notebook [here](https://github.com/huggingface/blog/blob/main/notebooks/graphml-classification.ipynb)!)
At the moment, the only graph transformer model available in Transformers is Microsoft's [Graphormer](https://arxiv.org/abs/2106.05234), so this is the one we will use here. We are looking forward to seeing what other models people will use and integrate 🤗
## [](https://huggingface.co/blog/graphml-classification#requirements) Requirements
To follow this tutorial, you need to have installed `data
DeepCamp AI