Techno Blender
Digitally Yours.
Browsing Tag

Politi

Importance Sampling with Python. Learn how to sample from a distribution… | by Marcello Politi | May, 2023

Photo by Edge2Edge Media on UnsplashLearn how to sample from a distribution when you only have access to another distributionIntroductionAmong the various sampling methods that a data scientist must know one of the most important is the one called Importance Sampling.This method allows us to sample from one distribution even though we are actually only able to sample from a different distribution! Let’s see how it works.Importance SamplingSuppose, for example, that taking samples x from the distribution g(x) is infeasible…

Develop applications powered by Language Models with LangChain | by Marcello Politi | Apr, 2023

Photo by Choong Deng Xiang on UnsplashGet started using LangChain with Python to leverage LLMsLangChain is a framework that enables quick and easy development of applications that make use of Large Language Models, for example, GPT-3.The framework, however, introduces additional possibilities, for example, the one of easily using external data sources, such as Wikipedia, to amplify the capabilities provided by the model. I am sure that you have all probably tried to use Chat-GPT and find that it fails to answer about…

Fine-tune a Large Language Model with Python | by Marcello Politi | Apr, 2023

Photo by Manouchehr Hejazi on UnsplashLearn how to fine-tune a BERT from scratch on a custom datasetIn this article, we will deal with the fine-tuning of BERT for sentiment classification using PyTorch. BERT is a large language model that offers a good balance between popularity and model size, which can be fine-tuned using a simple GPU. We can download a pre-trained BERT from Hugging Face (HF), so there is no need to train it from scratch. In particular, we will use the distilled (smaller) version of BERT, called…

Hands-on Generative AI with GANs using Python: DCGAN | by Marcello Politi | Apr, 2023

Photo by Vinicius "amnx" Amano on UnsplashImproving synthetic image generation with convolutional layers in PyTorchIntroductionIn my previous article, we have seen how to use GANs to generate images of the type of MNIST dataset. We achieved good results and succeeded in our intent. However, the two networks G (generator) and D (discriminator) were composed mostly of dense layers. At this point, you will know that usually when working with images we use CNNs (convolutional neural networks) since they use convolutional…

Hands-on Generative AI with GANs using Python: Image Generation | by Marcello Politi | Mar, 2023

Image by AuthorLearn how to implement GANs with PyTorch to generate synthetic imagesIntroductionIn my previous article, we learned about Autoencoders, now let’s continue to talk about Generative AI. By now everyone is talking about it and everyone is excited about the practical applications that have been developed. But we continue to see the foundations of these AIs step by step.There are several Machine Learning models that allow us to build generative AI, to name a few we have Variational Autoencoders (VAE),…

Hands-on Generative AI with GANs using Python: Autoencoders | by Marcello Politi | Mar, 2023

Photo by GR Stocks on UnsplashStart with Autoencoders to better understand GANsIntroductionIn recent years, generative models have gained popularity due to Artificial Intelligent’s ability to produce synthetic instances that are almost indistinguishable from real data. Neural Networks like Chat GPT, which can generate text, and DALLE, which can generate wholly original graphics, may be familiar to you.The website thispersondoesnotexist.com, where an AI-generated image of a person who doesn’t exist shows each time you…

Clean Code in PyTorch: Best Practices for Readable ML | by Marcello Politi | Mar, 2023

Photo by Greyson Joralemon on UnsplashFive Tips for Writing Clean, Efficient and readable Code in PyTorchIntroductionIn the field of data science and programming in general, it is very important to be able to write code that is easy to read and maintain. Surely you too have had the experience of writing code that seemed to work fine and that was pretty clear, but then you reread it a day or a week later and it looked incomprehensible. Even more obvious is this difficulty when you have to review code written by other…

Visualized Linear Algebra to Get Started with Machine Learning: Part 2 | by Marcello Politi | Feb, 2023

Photo by Michael Dziedzic on UnsplashMaster elements of linear algebra, start with simple and visual explanations of basic conceptsIntroductionIn this article, we continue the work we started in “Visualized Linear Algebra to Get Started with Machine Learning: Part 1”. We tackle new concepts of linear algebra in a simple and intuitive way. These articles are intended to introduce you to the world of linear algebra and make you understand how strongly the study of this subject and other mathematical subjects is related to…

Visualized Linear Algebra to Get Started with Machine Learning: Part 1 | by Marcello Politi | Feb, 2023

Photo by Michael Dziedzic on UnsplashMaster elements of linear algebra, start with simple and visual explanations of basic conceptsOften the main difficulty one faces when one wants to begin one’s journey into the world of machine learning is having to understand math concepts. Sometimes this can be difficult if you do not have a solid background in subjects such as linear algebra, statistics, probability, optimization theory, or others. 🤔💭🔢✖️🧮In this article then, I would like to start by giving intuitive explanations of…

ONNX: The Standard for Interoperable Deep Learning Models | by Marcello Politi | Jan, 2023

Photo by Jonny Caspari on UnsplashLearn about the benefits of using the ONNX standard for deploying models across frameworks and hardware platformsThe first time I heard about ONNX was during my internship at INRIA. I was working to develop Neural Network Pruning algorithms in the Julia language. There weren’t many pre-trained models yet that I could use, so utilizing ONNX to import models developed with other languages and frameworks might have been a solution.In this article, I want to introduce ONNX and explain its…