Graph Neural Network Project Update! (I'm coding GAT from scratch)

Aleksa Gordić - The AI Epiphany · Intermediate ·🧬 Deep Learning ·5y ago

Key Takeaways

This video teaches how to code Graph Attention Network (GAT) from scratch

Full Transcript

what's up folks so this video is going to be an update and not a classical video on my channel where i'm just covering some research paper so basically um what i've been doing is over the last seven days i think i've been uh coding this graph attention network or get for short from scratch and i actually started somewhere around new year's time and i just continued now i'll be just skipping the the classical research paper overview because for those of you who know me you know that i do i mix a lot of theoretical work uh but i also do a lot of hands-on like deploring projects and stuff so now the the the the time has come pretty much in my in my in my like uh workflow to to just kind of pause the the theory a little bit and focus on encoding as you probably know uh like my github profile has a lot of projects those are some of the the projects i've been developing throughout the last year make sure to check them out i've got a neural style transfer on my github you can play with that i've implemented both cadence's approach so that's the original optimization based approach i've also got johnson's approach which is the fast forward like just using cnn to stylize your images i've got us even some really cool uh projects where you can just basically segment yourself and stylize everything around or style as yourself whatever so that's cool check it out as well then i've got deep dream which was really awesome artistic project and you can learn a lot about cnns and deep learning in general by doing this project so make sure to check that one as well then i've been developing generative reseller networks as well so i did like develop the original one i did develop the conditional again and finally the dc game which kind of started the cambrian explosion uh in the world of generative research networks so that one is really cool and then continuing i was developing uh the transform i was working on transformers and i actually open source the original was funny transformer so i really like to think that that project is a super super good place to uh to start supplementing the paper and understanding how it actually works so every single detail so we got it's got a lot of comments so yeah uh hopefully you'll find that one useful as well so now i'm working on on get graphic attention network and as any as pretty much any deep learning project you can conceptually i kind of split it into a couple parts like the first one is data then we have the the model part and finally we have the training loop and some additional visualizations uh the stuff i usually put in playground a cool playground whatever and basically uh when it comes to data because these are graphs um i've been doing some stuff that i usually don't do when i'm exploring data so i'll be doing network analysis like uh just plotting the degree distribution of my network of quaran network and some other statistics uh i did some i i found this really good tool igraph uh and i actually plotted how coral looks like and that kind of just gives me a gut feeling for for how the graph looks like and that's that's kind of useful uh you feel better about yourself nothing else you probably don't need to know all of those details to make uh to make a this project successful but it's it's really cool and you learn a lot in the process to learn different tools you learn yeah uh basically that and um finally the the model part is um so i have like four i think i have four different implementations so the first one is similar to python geometric if you're not familiar with that project it's a really super awesome uh project that was implementing most of the uh main graph uh networks so gnns so do check it out uh but the thing is my implementation is actually like almost twice as fast because i was using some specialized pi torque functions like instead of using basic numpy indexing i was using index select i was using instead of using like some suffix function i was using torsum i also don't have the overhead of having to fit my my get project inside of this message passing framework as they do so it's it's it's cleaner and it's faster so but it's only for a graph attention network so hopefully you'll find it useful i'll open source it i think next weekend so stay tuned for that one and uh the other implementations one is using a torch sparse api which is currently in beta so that's going to be fun because i'll have to develop the backprop function explicitly so it doesn't handle so those sparse functions don't handle the back prop automatically the third one is the conceptually the easiest to understand but it's computationally most inefficient so yeah so that's the gradation the training loop part is really easy because core is just a simple classification problem so nothing new there just cross entropy like some masking because we have because it's a transactive training setting and that means you you have to mask out the training notes uh but you can see the uh test notes as well as the validation notes during the the procedure so uh yeah that's nothing interesting there uh then i've got the playground where i've been uh profiling different sparse uh formats for different matrices so like uh you probably heard of some of them like cool the coordinate form format then we have dok then we have lil we have csr css cs no csc sorry uh then we've got no not css that's that's that's not the best format and then um we've got um daya and bsr so about about seven formats which sci-fi supports and what i did is i just analyzed how how fast they are and actually figure out that some of the implementations out there like gcn by thomas coupe and even get the official get by petra velitcoach used they've used a little format for some arithmetic operations like summations and and stuff like that and that's actually sub-optimal because you want to use that one as you're building up your graph as you're just modifying the sparsity structure but you don't want to use it for arithmetic operations so yeah that's a that's a fun that was a fun experimentation and also of course i love visualizing stuff i played a little bit with t-sne where i visualized the embeddings that come out from the train gap model so yeah i also play with umap that's uh that's a relatively new algorithm uh most of the people are just using t-sne as the default method but umap is also cool but in this particular case i actually found that t-sne is as good as umap so i just kind of dumped it all together and finally i want to make a shout out to my patrons to petra velichkovic from deepmind who is the aio overlord of this channel and to jimx who is the ai disciple of this channel nothing less important just want to make a shout out and thank you for for supporting my channel nothing less important the whole community i love all of your comments keep them going i just want to read a couple of them here so the first one uh great one question have you noticed that arbitrary style transfer paper has more citations than your universal style transfer one so i love those geeky ones as well as these more simple ones like these man do you ever take a holiday uh lull i appreciate all your videos so just keep them coming i love your comments and i read all of your comments and uh i'm gonna try and answer all of them hi alexa can you make a video about your background and your journey into ai ml uh yeah basically if i see more of these uh comments i'll probably make some time and create a video where i'll walk you through my journey into deep learning so i also want to make a shout out to to phil who is also supporting my channel and thank you your channel is also amazing so love to collaborate one day with you uh yeah that was pretty much it you know the drill uh subscribe hit the like button and share this video that's how you can help me uh build up this channel build up the community i want to include you as more as i can in in my in in all of this so if you have any suggestions how i can do that please write them down in the comment section and until next time keep learning deep bye

Original Description

❤️ Become The AI Epiphany Patreon ❤️ ► https://www.patreon.com/theaiepiphany ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ A short update on some of my previous projects as well as my current project: the Graph Attention Network (GAT). You'll learn about: ✔️My previous deep learning projects ✔️Some of the challenges I faced implementing GAT ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ ✅ Neural Style Transfer (original): https://github.com/gordicaleksa/pytorch-neural-style-transfer ✅ Neural Style Transfer (fast): https://github.com/gordicaleksa/pytorch-neural-style-transfer-fast ✅ NST + video segmentation: https://github.com/gordicaleksa/pytorch-naive-video-neural-style-transfer ✅ DeepDream: https://github.com/gordicaleksa/pytorch-deepdream ✅ GANs: https://github.com/gordicaleksa/pytorch-gans ✅ Vaswani's transformer: https://github.com/gordicaleksa/pytorch-original-transformer ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ ⌚️ Timetable: 0:00 My previous deep learning projects 2:10 GAT 3:20 Profiling three/four different GAT implementations 5:10 Profiling different sparse formats (COO, LIL, CSR, ...) 6:10 t-SNE, UMAP 6:30 Patreon shoutout 6:45 Love you folks Credits: some of the images I used belong to other creators. I created this video for purely educational purposes without the goal of monetizing it. ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 💰 BECOME A PATREON OF THE AI EPIPHANY ❤️ If these videos, GitHub projects, and blogs help you, consider helping me out by supporting me on Patreon! The AI Epiphany ► https://www.patreon.com/theaiepiphany One-time donation: https://www.paypal.com/paypalme/theaiepiphany Much love! ❤️ ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 💡 The AI Epiphany is a channel dedicated to simplifying the field of AI using creative visualizations and in general, a stronger focus on geometrical and visual intuition, rather than the algebraic and numerical "intuition". ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 👋 CONNECT WITH ME ON SOCIAL LinkedIn ► https://www.linkedin.com/in/aleksagordic/ Twitter ► https://twitter.com/gordic_aleksa
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Aleksa Gordić - The AI Epiphany · Aleksa Gordić - The AI Epiphany · 31 of 60

1 Intro | Neural Style Transfer #1
Intro | Neural Style Transfer #1
Aleksa Gordić - The AI Epiphany
2 Basic Theory | Neural Style Transfer #2
Basic Theory | Neural Style Transfer #2
Aleksa Gordić - The AI Epiphany
3 Optimization method | Neural Style Transfer #3
Optimization method | Neural Style Transfer #3
Aleksa Gordić - The AI Epiphany
4 Advanced Theory | Neural Style Transfer #4
Advanced Theory | Neural Style Transfer #4
Aleksa Gordić - The AI Epiphany
5 Anyone can make deepfakes now!
Anyone can make deepfakes now!
Aleksa Gordić - The AI Epiphany
6 What is Computer Vision? | The Art of Creating Seeing Machines
What is Computer Vision? | The Art of Creating Seeing Machines
Aleksa Gordić - The AI Epiphany
7 Feed-forward method | Neural Style Transfer #5
Feed-forward method | Neural Style Transfer #5
Aleksa Gordić - The AI Epiphany
8 Alan Turing | Computing Machinery and Intelligence
Alan Turing | Computing Machinery and Intelligence
Aleksa Gordić - The AI Epiphany
9 Feed-forward method (training) | Neural Style Transfer #6
Feed-forward method (training) | Neural Style Transfer #6
Aleksa Gordić - The AI Epiphany
10 What is Google Deep Dream? (Basic Theory) | Deep Dream Series #1
What is Google Deep Dream? (Basic Theory) | Deep Dream Series #1
Aleksa Gordić - The AI Epiphany
11 Semantic Segmentation in PyTorch | Neural Style Transfer #7
Semantic Segmentation in PyTorch | Neural Style Transfer #7
Aleksa Gordić - The AI Epiphany
12 How to get started with Machine Learning
How to get started with Machine Learning
Aleksa Gordić - The AI Epiphany
13 How to learn PyTorch? (3 easy steps) | 2021
How to learn PyTorch? (3 easy steps) | 2021
Aleksa Gordić - The AI Epiphany
14 PyTorch or TensorFlow?
PyTorch or TensorFlow?
Aleksa Gordić - The AI Epiphany
15 3 Machine Learning Projects For Beginners (Highly visual) | 2021
3 Machine Learning Projects For Beginners (Highly visual) | 2021
Aleksa Gordić - The AI Epiphany
16 Machine Learning Projects (Intermediate level) | 2021
Machine Learning Projects (Intermediate level) | 2021
Aleksa Gordić - The AI Epiphany
17 Cheapest (0$) Deep Learning Hardware Options | 2021
Cheapest (0$) Deep Learning Hardware Options | 2021
Aleksa Gordić - The AI Epiphany
18 How to learn deep learning? (Transformers Example)
How to learn deep learning? (Transformers Example)
Aleksa Gordić - The AI Epiphany
19 How do transformers work? (Attention is all you need)
How do transformers work? (Attention is all you need)
Aleksa Gordić - The AI Epiphany
20 Developing a deep learning project (case study on transformer)
Developing a deep learning project (case study on transformer)
Aleksa Gordić - The AI Epiphany
21 Vision Transformer (ViT) - An image is worth 16x16 words | Paper Explained
Vision Transformer (ViT) - An image is worth 16x16 words | Paper Explained
Aleksa Gordić - The AI Epiphany
22 GPT-3 - Language Models are Few-Shot Learners | Paper Explained
GPT-3 - Language Models are Few-Shot Learners | Paper Explained
Aleksa Gordić - The AI Epiphany
23 Google DeepMind's AlphaFold 2 explained! (Protein folding, AlphaFold 1, a glimpse into AlphaFold 2)
Google DeepMind's AlphaFold 2 explained! (Protein folding, AlphaFold 1, a glimpse into AlphaFold 2)
Aleksa Gordić - The AI Epiphany
24 Attention Is All You Need (Transformer) | Paper Explained
Attention Is All You Need (Transformer) | Paper Explained
Aleksa Gordić - The AI Epiphany
25 Graph Attention Networks (GAT) | GNN Paper Explained
Graph Attention Networks (GAT) | GNN Paper Explained
Aleksa Gordić - The AI Epiphany
26 Graph Convolutional Networks (GCN) | GNN Paper Explained
Graph Convolutional Networks (GCN) | GNN Paper Explained
Aleksa Gordić - The AI Epiphany
27 Graph SAGE - Inductive Representation Learning on Large Graphs | GNN Paper Explained
Graph SAGE - Inductive Representation Learning on Large Graphs | GNN Paper Explained
Aleksa Gordić - The AI Epiphany
28 PinSage - Graph Convolutional Neural Networks for Web-Scale Recommender Systems | Paper Explained
PinSage - Graph Convolutional Neural Networks for Web-Scale Recommender Systems | Paper Explained
Aleksa Gordić - The AI Epiphany
29 OpenAI CLIP - Connecting Text and Images | Paper Explained
OpenAI CLIP - Connecting Text and Images | Paper Explained
Aleksa Gordić - The AI Epiphany
30 Temporal Graph Networks (TGN) | GNN Paper Explained
Temporal Graph Networks (TGN) | GNN Paper Explained
Aleksa Gordić - The AI Epiphany
Graph Neural Network Project Update! (I'm coding GAT from scratch)
Graph Neural Network Project Update! (I'm coding GAT from scratch)
Aleksa Gordić - The AI Epiphany
32 Graph Attention Network Project Walkthrough
Graph Attention Network Project Walkthrough
Aleksa Gordić - The AI Epiphany
33 How to get started with Graph ML? (Blog walkthrough)
How to get started with Graph ML? (Blog walkthrough)
Aleksa Gordić - The AI Epiphany
34 DQN - Playing Atari with Deep Reinforcement Learning | RL Paper Explained
DQN - Playing Atari with Deep Reinforcement Learning | RL Paper Explained
Aleksa Gordić - The AI Epiphany
35 AlphaGo - Mastering the game of Go with deep neural networks and tree search | RL Paper Explained
AlphaGo - Mastering the game of Go with deep neural networks and tree search | RL Paper Explained
Aleksa Gordić - The AI Epiphany
36 DeepMind's AlphaGo Zero and AlphaZero | RL paper explained
DeepMind's AlphaGo Zero and AlphaZero | RL paper explained
Aleksa Gordić - The AI Epiphany
37 OpenAI - Solving Rubik's Cube with a Robot Hand | RL paper explained
OpenAI - Solving Rubik's Cube with a Robot Hand | RL paper explained
Aleksa Gordić - The AI Epiphany
38 MuZero - Mastering Atari, Go, Chess and Shogi by Planning with a Learned Model | RL Paper explained
MuZero - Mastering Atari, Go, Chess and Shogi by Planning with a Learned Model | RL Paper explained
Aleksa Gordić - The AI Epiphany
39 EfficientNetV2 - Smaller Models and Faster Training | Paper explained
EfficientNetV2 - Smaller Models and Faster Training | Paper explained
Aleksa Gordić - The AI Epiphany
40 Implementing DeepMind's DQN from scratch! | Project Update
Implementing DeepMind's DQN from scratch! | Project Update
Aleksa Gordić - The AI Epiphany
41 MLP-Mixer: An all-MLP Architecture for Vision | Paper explained
MLP-Mixer: An all-MLP Architecture for Vision | Paper explained
Aleksa Gordić - The AI Epiphany
42 DeepMind's Android RL Environment - AndroidEnv
DeepMind's Android RL Environment - AndroidEnv
Aleksa Gordić - The AI Epiphany
43 When Vision Transformers Outperform ResNets without Pretraining | Paper Explained
When Vision Transformers Outperform ResNets without Pretraining | Paper Explained
Aleksa Gordić - The AI Epiphany
44 Non-Parametric Transformers | Paper explained
Non-Parametric Transformers | Paper explained
Aleksa Gordić - The AI Epiphany
45 Chip Placement with Deep Reinforcement Learning | Paper Explained
Chip Placement with Deep Reinforcement Learning | Paper Explained
Aleksa Gordić - The AI Epiphany
46 Text Style Brush - Transfer of text aesthetics from a single example | Paper Explained
Text Style Brush - Transfer of text aesthetics from a single example | Paper Explained
Aleksa Gordić - The AI Epiphany
47 Graphormer - Do Transformers Really Perform Bad for Graph Representation? | Paper Explained
Graphormer - Do Transformers Really Perform Bad for Graph Representation? | Paper Explained
Aleksa Gordić - The AI Epiphany
48 GANs N' Roses: Stable, Controllable, Diverse Image to Image Translation | Paper Explained
GANs N' Roses: Stable, Controllable, Diverse Image to Image Translation | Paper Explained
Aleksa Gordić - The AI Epiphany
49 VQ-VAEs: Neural Discrete Representation Learning | Paper + PyTorch Code Explained
VQ-VAEs: Neural Discrete Representation Learning | Paper + PyTorch Code Explained
Aleksa Gordić - The AI Epiphany
50 VQ-GAN: Taming Transformers for High-Resolution Image Synthesis | Paper Explained
VQ-GAN: Taming Transformers for High-Resolution Image Synthesis | Paper Explained
Aleksa Gordić - The AI Epiphany
51 Multimodal Few-Shot Learning with Frozen Language Models | Paper Explained
Multimodal Few-Shot Learning with Frozen Language Models | Paper Explained
Aleksa Gordić - The AI Epiphany
52 Focal Transformer: Focal Self-attention for Local-Global Interactions in Vision Transformers
Focal Transformer: Focal Self-attention for Local-Global Interactions in Vision Transformers
Aleksa Gordić - The AI Epiphany
53 AudioCLIP: Extending CLIP to Image, Text and Audio | Paper Explained
AudioCLIP: Extending CLIP to Image, Text and Audio | Paper Explained
Aleksa Gordić - The AI Epiphany
54 RMA: Rapid Motor Adaptation for Legged Robots | Paper Explained
RMA: Rapid Motor Adaptation for Legged Robots | Paper Explained
Aleksa Gordić - The AI Epiphany
55 DALL-E: Zero-Shot Text-to-Image Generation | Paper Explained
DALL-E: Zero-Shot Text-to-Image Generation | Paper Explained
Aleksa Gordić - The AI Epiphany
56 DETR: End-to-End Object Detection with Transformers | Paper Explained
DETR: End-to-End Object Detection with Transformers | Paper Explained
Aleksa Gordić - The AI Epiphany
57 DINO: Emerging Properties in Self-Supervised Vision Transformers | Paper Explained!
DINO: Emerging Properties in Self-Supervised Vision Transformers | Paper Explained!
Aleksa Gordić - The AI Epiphany
58 DeepMind DetCon: Efficient Visual Pretraining with Contrastive Detection | Paper Explained
DeepMind DetCon: Efficient Visual Pretraining with Contrastive Detection | Paper Explained
Aleksa Gordić - The AI Epiphany
59 Do Vision Transformers See Like Convolutional Neural Networks? | Paper Explained
Do Vision Transformers See Like Convolutional Neural Networks? | Paper Explained
Aleksa Gordić - The AI Epiphany
60 Fastformer: Additive Attention Can Be All You Need | Paper Explained
Fastformer: Additive Attention Can Be All You Need | Paper Explained
Aleksa Gordić - The AI Epiphany

Related Reads

Chapters (7)

My previous deep learning projects
2:10 GAT
3:20 Profiling three/four different GAT implementations
5:10 Profiling different sparse formats (COO, LIL, CSR, ...)
6:10 t-SNE, UMAP
6:30 Patreon shoutout
6:45 Love you folks
Up next
RNNs Explained in 60 Seconds #ai #coding #machinelearning
Ascent
Watch →