Data Loading for Machine Learning

When we load data to train a neural network model, We usually split data into the training data and testing data. Then the training data is further split into batches to train the model. This is done to reduce the memory usage and speed up the training process. Let’s see how to load data into a neural network model using PyTorch. Dataset pytorch provides a Dataset class to load data into a neural network model. We can create a custom dataset by inheriting the Dataset class and implementing the __len__ and __getitem__ methods. ...

Neural Network Model Dissection

Data Flow Inside a Neural Network Model Inside a Neural Network Model, when we pass in a value it should some other value. Let’s inspect an example model import torch import torch.nn as nn class NeuralNetwork(nn.Module): def __init__(self): super(NeuralNetwork, self).__init__() self.input_layer = nn.Linear(1, 1) def forward(self, x): x = self.input_layer(x) return x Here, we have a simple neural network model with a single input and output layer. The input layer has a single node and the output layer has a single node. ...

Neural Networks

AI had been really influencing our daily life, It’s a powerful tool to help us with a lot of tasks. As of 2024 There are prototypes of self driving cars to humanoid robots that does chores. Neural Network is the core of the whole Machiene Learning and AI all around us. Let’s break down Neural Networks with examples in pytorch. What is a Neural Network? Neural Network is a programmable network of neurons called nodes with layers to compute and return few outputs. It’s a model that can be trained to recognize patterns in data. ...

Running AI Coder Locally

AI Coding tools like copilot, cody etc.. are becoming very relevant and helpful. But, the problem is that they are not available offline. This became a problem when I wanted to travel and had no internet access. So, I remembered about ollama and was looking for a way to use it for my local development. Ollama Ollama is a tool that allows us to run LLMs locally. You can get it simply by: ...

Why are we fascinated by AI ?

Why are we fascinated by AI? I’ve been thinking of this for a while now. People are so hyped about AI, especially generative AI. It would be a lie if I said I wasn’t impressed, but behind all the excitement I also paused to analyze the whys. To gain an answer to this, I stepped back and thought about the scenarios where we get fascinated before the AI hype was there. All I could think of was, how a beginner musician get impressed by a skilled musician, how a beginner sportsman gets impressed by a skilled sportsman etc… ...