Avi Chawla Profile picture
Jan 25 7 tweets 2 min read Read on X
Let's build a mini-ChatGPT that's powered by DeepSeek-R1 (100% local):
Here's a mini-ChatGPT app that runs locally on your computer. You can chat with it just like you would chat with ChatGPT.

We use:
- @DeepSeek_AI R1 as the LLM
- @Ollama to locally serve R1
- @chainlit_io for the UI

Let's build it!
We begin with the import statements and define the start_chat method.

It is invoked as soon as a new chat session starts. Image
Next, we define another method which will be invoked to generate a response from the LLM:

• The user inputs a prompt.
• We add it to the interaction history.
• We generate a response from the LLM.
• We store the LLM response in the interaction history. Image
Finally, we define the main method and run the app as follows: Image
Done!

This launches our 100% locally running mini-ChatGPT that is powered by DeepSeek-R1.
That's a wrap!

If you enjoyed this tutorial:

Find me → @_avichawla

Every day, I share tutorials and insights on DS, ML, LLMs, and RAGs.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Avi Chawla

Avi Chawla Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @_avichawla

Feb 6
Decorators in Python, clearly explained (with code):
Decorators are one of the most powerful features of Python!

However, understanding them can be a bit overwhelming!

Today, let's understand how decorators work! Image
Before we jump onto decorator, we must understand that functions in python are "first-class" objects!

This means, just like integers or strings, a function can be:
- passed around as an argument
- used in expressions
- returned as values of other functions Image
Read 9 tweets
Feb 1
90% of Python programmers don't know these 7 uses of underscore:
1) Retrieve the last computed value

You can retrieve the last computed value using underscore, as demonstrated below: Image
2) Placeholder for loop variable

Instead of explicitly declaring a loop variable, you can also use it as a placeholder for a loop variable: Image
Read 10 tweets
Jan 31
Traditional RAG vs. Graph RAG, clearly explained (with visuals):
RAG has many issues.

Imagine you want to summarize a biography, and each chapter of the document covers a specific accomplishment of a person (P).

This is difficult with traditional RAG since it only retrieves the top-k relevant chunks, but this task needs full context. Image
Graph RAG solves this.

The following visual depicts how it differs from naive RAG.

The core idea is to:
- Create a graph (entities & relationships) from documents.
- Traverse the graph during retrieval to fetch context.
- Pass the context to the LLM to get a response.
Read 7 tweets
Jan 30
Let's build a Multimodal RAG with DeepSeek's latest Janus-Pro (100% local):
The video depicts a multimodal RAG running locally on your computer.

We use:
- Colpali to understand and embed docs using vision capabilities.
- @qdrant_engine as the vector database.
- @deepseek_ai's latest Janus-Pro multimodal LLM to generate a response.

Let's build it!
0) Data

I used this complex multimodal PDF here.

It has several complex diagrams, text within visualizations, and tables—perfect for multimodal RAG.

Let's jump into the implementation now.
Read 10 tweets
Jan 28
Let's fine-tune DeepSeek-R1 (distilled Llama) 100% locally:
Before we begin, here's what we'll be doing.

We'll fine-tune our private and locally running DeepSeek-R1 (distilled Llama variant).

To do this, we'll use:
- @UnslothAI for efficient fine-tuning.
- @ollama to run it locally.

Let's begin!
1) Load the model

We start by loading the Distilled Llama-8B model and the tokenizer of DeepSeek-R1 using Unsloth: Image
Read 10 tweets
Jan 27
5 LLM fine-tuning techniques, clearly explained (with visuals):
Traditional fine-tuning (depicted below) is infeasible with LLMs.

This is because LLMs have billions of parameters (and 100s of GBs in size).

Not everyone has access to such computing infrastructure, and it does not make business sense either.
Here are 5 optimal ways to fine-tune LLMs:

Let's understand them one by one below.
Read 11 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(