Akshay 🚀
banner
akshay-pachaar.bsky.social
Akshay 🚀
@akshay-pachaar.bsky.social
Simplifying LLMs, MLOps, Python & Machine Learning for you! • Co-founder DailyDoseofDS • BITS Pilani • 3 Patents • ex-AI Engineer @ LightningAI
F-strings also support formatting for different data types, such as dates and times:
December 25, 2024 at 12:30 PM
If you need to use braces literally in an f-string, you can escape them with double braces:
December 25, 2024 at 12:30 PM
F-strings also support the `=` specifier, which can be handy for debugging or logging purposes.

It allows you to include the variable name and its value in the formatted string:
December 25, 2024 at 12:30 PM
F-strings support multiline strings using triple quotes!

It's one of my favourite features, I use it for creating prompt templates.

Here's an example:
December 25, 2024 at 12:30 PM
Need to format numbers or strings❓

F-strings support format specifiers:
December 25, 2024 at 12:30 PM
You can also perform operations & call functions inside the braces.

This makes f-strings incredibly versatile for constructing dynamic strings with computed values.

Check this out👇
December 25, 2024 at 12:30 PM
Simply put, f-strings are strings prefixed with 'f' that allow you to embed expressions inside string literals.

Here's an example:
December 25, 2024 at 12:30 PM
f-strings were introduced in Python 3.6 and have since become a favorite among developers for their simplicity and readability.

Today, we'll start with the basics and dive into all the ninja tricks of using f-strings.

Let's go! 🚀
December 25, 2024 at 12:30 PM
7️⃣ Evaluate finetuned T-5 small RAG program

**Notice the score, it beats a vanilla Mistral RAG 🔥
December 12, 2024 at 12:30 PM
6️⃣ Define a T-5 small RAG & Finetune it

The code below will perform finetuning & provide a checkpoint for the best model weights saved during the process.

Check this out👇
December 12, 2024 at 12:30 PM
5️⃣ Evaluate RAG powered by Mistral

Let's first evaluate our RAG program that uses Mistral-7B as LLM

** Notice the score, this is what we want to beat!

Check this out👇
December 12, 2024 at 12:30 PM
4️⃣ Define the RAG program

Let's define a basic DSPy program which is a RAG pipeline for answer generation.

It's like defining a model that we want to finetune & evaluate.

Check this out👇
December 12, 2024 at 12:30 PM
3️⃣ Set eval metric

DSPy provides out of the box support for many evaluation metrics & you can define a custom metric as well.

Our program is expected to produce short factoid answers & hence, exact match with the ground truth is a good eval metric here.

Check this out👇
December 12, 2024 at 12:30 PM
2️⃣ Load dataset

Next we load the HotPotQA dataset for training & validation. HotPotQA dataset in available in `dspy.datasets`

Check this out👇
December 12, 2024 at 12:30 PM
1️⃣ Set Up

We start by setting up the LM (Mistral-7B served using @Ollama & retriever model, RM which is ColBERTv2)

Check this out👇
December 12, 2024 at 12:30 PM
DSPy is a framework for algorithmically optimizing LM prompts and weights.

DSPy : RAG :: PyTorch : DNNs

I'll make sure today's tutorial can be followed with minimal background knowledge!

Let's go! 🚀
December 12, 2024 at 12:30 PM
6️⃣ Polymorphism 🌀

This allows us to use a single interface for different data types or classes.

We can achieve this through method overriding, where a subclass provides a different implementation for a method defined in its parent class.

Let's understand with an example 👇
December 10, 2024 at 12:32 PM
5️⃣ Abstraction 🎭

This concept focuses on exposing only essential information to the outside world while hiding implementation details.

We use abstract classes and methods to define a common interface.

Here's an example 👇
December 10, 2024 at 12:31 PM
4️⃣ Encapsulation 🔐

Encapsulation helps to bundle data and methods inside a class, restricting direct access to certain attributes and methods.

We use private attributes/methods (with a `_` or `__` prefix) to achieve this.

Here's an example 👇
December 10, 2024 at 12:31 PM
3️⃣ Inheritance 🧬

Let's say we want to create an Electric car & don't want to define all the properties and methods of the basic Car class.

Inheritance helps us to inherit all the properties/methods of parent class & add new ones or override existing.

Check this out👇
December 10, 2024 at 12:31 PM
2️⃣ Class 🏗️

A class is like a blueprint for creating objects.

It defines a set of properties & functions (methods) that will be common to all objects created from the class.

So, we start with a simple example & follow along!

Let's define a class Car & create it's Object👇
December 10, 2024 at 12:31 PM
We break it down to 6 important concepts:

- Object 🚘
- Class 🏗️
- Inheritance 🧬
- Encapsulation 🔐
- Abstraction 🎭
- Polymorphism 🌀

Let's take them one-by-one... 🚀
December 10, 2024 at 12:30 PM
Synthetic datasets with Llama 3? It's easier than you think.

I've been playing with a Distilabel, an open-source framework that lets you generate domain-specific synthetic text data using Llama 3.

Try it yourself: lightning.ai/lightning-a...
December 9, 2024 at 12:30 PM
Image to LaTeX powered by multimodal Llama 3.2!
.
.
Upload image of an equation, and it gives you the corresponding LaTeX code.

Find code here: github.com/patchy631/a...
December 8, 2024 at 12:48 PM
PydanticAI: Build production-grade Agentic AI apps in pure Python!

PydanticAI offers the same elegance and ease of use as FastAPI, now extending that experience to building production-grade LLM applications.

GitHub repo: github.com/pydantic/py...
December 6, 2024 at 12:30 PM