Transformer Token and Position Embedding with Keras
There are plenty of guides explaining how transformers work, and for building an intuition on a key element of them - token and position embedding. Positionally embedding tokens allowed transformers to represent non-rigid relationships between tokens (usually, words), which is much better at modelling our context-driven speech in language modelling....
5-Line GPT-Style Text Generation in Python with TensorFlow/Keras
Transformers, even though released in 2017, have only started gaining significant traction in the last couple of years. With the proliferation of the technology through platforms like HuggingFace, NLP and Large Language Models (LLMs) have become more accessible than ever. Yet - even with all the hype around them and...
Convert Numpy Array to Tensor and Tensor to Numpy Array with PyTorch
Tensors are multi-dimensional objects, and the essential data representation block of Deep Learning frameworks such as Tensorflow and PyTorch. A scalar has zero dimensions, a vector has one dimension, a matrix has two dimensions and tensors have three or more. In practice, we oftentimes refer to scalars and vectors and...
Split Train, Test and Validation Sets with Tensorflow Datasets - tfds
Tensorflow Datasets, also known as tfds is is a library that serves as a wrapper to a wide selection of datasets, with proprietary functions to load, split and prepare datasets for Machine and Deep Learning, primarily with Tensorflow. Note: While the Tensorflow Datasets library is used to get data, it's...
Image Classification with Transfer Learning in Keras - Create Cutting Edge CNN Models
Deep Learning models are very versatile and powerful - they're routinely outperforming humans in narrow tasks, and their generalization power is increasing at a rapid rate. New models are being released and benchmarked against community-accepted datasets frequently, and keeping up with all of them is getting harder. Most of these...
Translating Strings in Python with TextBlob
Text translation is a difficult computer problem that gets better and easier to solve every year. Big companies like Google are actively working on improving their text translation services which enables the rest of us to use them freely. Apart from their great personal use, these services can be used...