LM Studio CLI: Speed Up Your AI App Development (100% Local + UI)

Mervin Praison · Beginner ·🧠 Large Language Models ·2y ago

Key Takeaways

This video tutorial demonstrates how to use LM Studio CLI to integrate large language models into applications, including downloading and loading models, starting a local server, and creating a user interface with Chainlit.

Full Transcript

this is amazing now we have LM Studio CLI so what is CLI you are able to run LM Studio from your terminal like this you are able to download large language models you are able to load the large language model same like you do it for Olo you can load and unload llms or large language Model start stop local server debug your workloads this is going to be super useful for developers who want to integrate a large language model in their application or for those who create AI application I'm going to show you how you can use LM Studio CLI and use it more efficiently how to integrate that with your python application and finally teach you how to create a user interface such as a chatboard like this where you can ask give me a meal plan for today or any question and it can automatically generate response which is directly linked with LM Studio that's exactly what we're going to see today let's get started hi everyone I'm really excited to show you about LMS LMS is LM studio in your terminal I'm going to take you through step by step on how to install this application show you the different commands which you can use to access this application and finally create a user interface like this but before that I regularly create videos in regards to Artificial Intelligence on my YouTube channel so do subscribe and click the Bell icon to stay tuned make sure you click the like button so this video can be helpful for many ofs like you in this video going to see how to to download a large language model then how to start the server using CLI then how to load the model via CLI then finally how to integrate that in your own application so first go to LM studio. a website there you can download LM Studio application after that open that application and search for the model which you want to use I'm going to use llama 3 8B instruct by clicking the download button of your choice you can download the model here I'm going to use llama 3 which you can see I have downloaded that here so the next step is to stop the server so instead of using the application I'm coming to the terminal here make sure you have downloaded nodejs you can download nodejs from nodejs.org website after that you can type npix LM Studio install hyphen CLI and then click enter this will install the CLI package next pip install open AI chain lit and then click enter we are using open a as a proxy for our LM Studio server using Chang it we are going to set up a chatbot like user interface now we are ready to start the server just type LMS server start and then click enter now you can see the server got started in port number 1 2 3 4 so that is Local Host colon 2 34 next you can see the list of models downloaded by just typing LMS LS and then click enter here you can see the list of models I've downloaded and totally it's taking 7 22 GB of disk space and next step is to load the launch language model to do that LMS load llama 3 hyphen hyphen GPU equals Max and then click enter now you can see the Llama 3 Model is loading model loaded successfully now you can test if the server has started or Not by typing curl and the end point Local Host 1 2 3 4 chat completions and then click enter now you can see the response is getting generated and it is done so this confirms it is working fine I can even stop the streaming by just typing stream equals false and then click answer now I got a response instantly without streaming so this is all working in the terminal now we're going to integrate that in the python application to do that let's create a file called app.py and let's open it inside the file from open AI import open AI next Define the open AI function next chat completions create function here we are providing the lar language model name that is meta Lama 38b instruct ggf if you want to get the information of this you can even get that from your terminal by typing LMS LS and click enter and here you can see the loaded model so you can just copy this model name and then paste that here that's it then you're providing the usual information the messages temperature finally you're going to print the response that's it now I'm going to run this code in your terminal Python app.py and then click enter and here is a response so I asked introduce yourself and here's the response I'm a lost language model my name is llama it's true I'll chat with you and see this conversation through because we gave a instruction saying that always answer in Rhymes that's why you saw the response as Rhymes to scream the response I just modify stream equals true and added this four Loop that's it now let's see running this the question I'm going to ask is give me a meal plan for today you are a Heth F chatbot as the instruction now I'm going to run this Python stream. piy and click enter now we can see the response is getting generated by streaming now the final step is to integrate this with your chain L application or user interface to do that I'm using Asing open AI function then added all the settings in one settings variable then I have two chain lit decorator one is cl. onchat start and second is CL do on message so this is triggered when the UI starts this is triggered when you send a message in the chat interface so here you can see it's getting all the history so that it can remember the context of the conversation same as before we are using client. chat. completion. Create and there we pause the message history and the stream equals true same as the full loop which we had before here we have a for Loop we are appending the result to the message history and finally message. update that's it now we have successfully created a user interface for our AI application which is going to look like a chatbot now I'm going to run this code in your terminal chain lit run ui. piy and then click enter now the application is running in port number 8,000 which you can see here I'm going to open this URL and here is the user interface I'm going to ask a question give me a meal plan for me today and clicking enter and you can see the response is getting generated this is directly from LM Studio which we started using our CLI now here is asking a few more questions do you have any food allergies are there any specific interest I'm going to say everything is your choice and you can see it's generating the response using the context we provided earlier now we have successfully created a chatbot which is directly interacting with LM Studio running completely locally on your computer few other commands which I want to tell you one is LMS unload so just type LMS unload hyphen hyphen all and then click enter so now it unloaded one model so initially if you saw we loaded one model which is llama 3 and now we have unloaded it now I'm going to test LMS LS and click enter here now you can see there's no model loaded based on the command we entered I'm going to load the model again and there's LMS log stream this will automatically stream the log that means whenever this endpoint is used or API is used or the server is used you can see the log here so for example I'm going to run this parall write an email to my manager about holiday and then click answer now you can see immediately you can see the log on the right hand side similarly whenever you start typing you can see the log on the right hand side in this way you are able to track if any error occurs finally you can stop the server by typing LMS server stop and then click enter I stopped the server on port number 1 2 3 4 now it's all done now you are able to create an application like this or chatbot like this and able to integrate that with LM Studio I'm really excited about this I'm going to create more videos similar to this so stay tuned I hope you like this video do like share and subscribe and thanks for watching

Original Description

🚀 Dive into the world of AI with our comprehensive tutorial on LM Studio CLI! In this video, I'll guide you step-by-step on how to effectively use LM Studio CLI to integrate large language models into your applications, straight from your terminal. 🖥️ 🔗 Starting with the basics, learn how to download, install, and manage models. Then, I'll show you how to set up a local server, debug processes, and integrate a fully functional chatbot interface into your Python applications. Whether you're a seasoned developer or just starting out, this video has everything you need to leverage AI for your projects! 👇 Key Features You'll Learn: How to install and configure LM Studio CLI Commands for managing models and servers Integrating AI into applications with Python Creating a responsive chatbot UI 🔗 Resources: Sponsor a Video: https://mer.vin/contact/ Do a Demo of Your Product: https://mer.vin/contact/ Patreon: https://patreon.com/MervinPraison Ko-fi: https://ko-fi.com/mervinpraison Discord: https://discord.gg/nNZu5gGT59 Twitter / X : https://twitter.com/mervinpraison Code: https://mer.vin/2024/05/lm-studio-chainlit/ 📌 Timestamps: 0:00 - Introduction to LM Studio CLI 0:35 - Setting up LM Studio CLI 1:39 - Downloading and Managing Models 2:34 - Starting and Testing the Server 3:45 - Building a Chatbot Interface 6:07 - Final Overview & How to Unload Models 🌟 Don’t forget to like, share, and subscribe for more AI tutorials and tips! Click the bell icon to stay updated on all our latest content. #LMstudio #CLI #local #Ai #LMStudioTutorial #LMStudio #ArtificialIntelligence #LLM #OpenSourceLLM #LMStudioFirstSteps #LMStudioAI #LMStudioGuide #Llama #HowToLMStudioLLM #UsingLMStudioQuickGuide #LMStudioServer #Llama3LMStudio #LMStudioInstallGuide #LMStudioLLM #PresetsInLMStudio #HowToConfigureLMStudio #LocalServerOnLMStudio #RunAILocally #OpenSourceLLMs #OpenSourceLLM #LLMLocalOnPC #RunLLMsLocally
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Mervin Praison · Mervin Praison · 0 of 60

← Previous Next →
1 Build GCP Infra using Pulumi in YAML format
Build GCP Infra using Pulumi in YAML format
Mervin Praison
2 How to Convert a Pulumi YAML File to Python Format
How to Convert a Pulumi YAML File to Python Format
Mervin Praison
3 Speed Up AWS EKS: A Complete Guide to Performance Tuning & Debugging!
Speed Up AWS EKS: A Complete Guide to Performance Tuning & Debugging!
Mervin Praison
4 Learn GCP GKE to AWS EKS Migration in Just 5 Minutes: Quick Guide
Learn GCP GKE to AWS EKS Migration in Just 5 Minutes: Quick Guide
Mervin Praison
5 AWS & Kubernetes: The Definitive Guide to Data Persistence with PV and PVC
AWS & Kubernetes: The Definitive Guide to Data Persistence with PV and PVC
Mervin Praison
6 ChatGPT Voice Conversation RELEASED! It's AMAZING!! (Demo)
ChatGPT Voice Conversation RELEASED! It's AMAZING!! (Demo)
Mervin Praison
7 How to Install Mistral 7B in Minutes: Quick & Easy Guide! ✅
How to Install Mistral 7B in Minutes: Quick & Easy Guide! ✅
Mervin Praison
8 Code Llama Install Locally: 🐍💻 Elevate Your Python Skills!
Code Llama Install Locally: 🐍💻 Elevate Your Python Skills!
Mervin Praison
9 Orca Mini: Your Ultimate Guide to Install and Test on Mac & Linux 💻
Orca Mini: Your Ultimate Guide to Install and Test on Mac & Linux 💻
Mervin Praison
10 Quick & Easy Vicuna Setup on Mac and Linux 💻
Quick & Easy Vicuna Setup on Mac and Linux 💻
Mervin Praison
11 Quick Guide: Llama2 Local Installation and ChatGPT with pip! Python🛠️
Quick Guide: Llama2 Local Installation and ChatGPT with pip! Python🛠️
Mervin Praison
12 Query PDFs Like a Pro with Local GPT: Full Setup Guide! 📜
Query PDFs Like a Pro with Local GPT: Full Setup Guide! 📜
Mervin Praison
13 LM Studio: EASIEST way to Run Large Language Models Locally!
LM Studio: EASIEST way to Run Large Language Models Locally!
Mervin Praison
14 AMAZING ChatGPT Vision is OUT! 🤯 14+ Examples (Step-by-Step) FULL Tutorial
AMAZING ChatGPT Vision is OUT! 🤯 14+ Examples (Step-by-Step) FULL Tutorial
Mervin Praison
15 Unbelievable! Build ANY App Instantly with Smol AI! 😲🔥
Unbelievable! Build ANY App Instantly with Smol AI! 😲🔥
Mervin Praison
16 Amazing! AutoGen Made Easy: A Step-by-Step Beginners Guide 📚
Amazing! AutoGen Made Easy: A Step-by-Step Beginners Guide 📚
Mervin Praison
17 How to Set Up LoLLMS and Run LLMs Locally! 🚀 Step-by-Step Tutorial
How to Set Up LoLLMS and Run LLMs Locally! 🚀 Step-by-Step Tutorial
Mervin Praison
18 GPT4All: INSANE Way to Run Large Language Models Locally! 😲 Step-By-Step Tutorial
GPT4All: INSANE Way to Run Large Language Models Locally! 😲 Step-By-Step Tutorial
Mervin Praison
19 Incredible AI-Powered NPCs in Unity Game Engine: Step by Step Tutorial!🤯
Incredible AI-Powered NPCs in Unity Game Engine: Step by Step Tutorial!🤯
Mervin Praison
20 MemGPT 🧠 LLM as Operating System. It's INSANE! Step-by-Step Tutorial 🤯
MemGPT 🧠 LLM as Operating System. It's INSANE! Step-by-Step Tutorial 🤯
Mervin Praison
21 Text Generation Web UI: MIND-BLOWING Way to Run LLM Locally! 🤯
Text Generation Web UI: MIND-BLOWING Way to Run LLM Locally! 🤯
Mervin Praison
22 Unlock the INSANE Power of OpenAI GPT-4 with C#/.NET! 😲
Unlock the INSANE Power of OpenAI GPT-4 with C#/.NET! 😲
Mervin Praison
23 Integrate Langchain and Ollama for Local AI Power 🤯 Indeed POWERFUL!
Integrate Langchain and Ollama for Local AI Power 🤯 Indeed POWERFUL!
Mervin Praison
24 ChatDev: INSANE Virtual AI Agents! Future of Software Development 😲
ChatDev: INSANE Virtual AI Agents! Future of Software Development 😲
Mervin Praison
25 Query PDFs Using Mistral: Unlock INSANE Power! 🤯
Query PDFs Using Mistral: Unlock INSANE Power! 🤯
Mervin Praison
26 AutoGen + Open-Source LLMs: UNBELIEVABLE! Step-by-Step Tutorial You Can't Miss! 🤯
AutoGen + Open-Source LLMs: UNBELIEVABLE! Step-by-Step Tutorial You Can't Miss! 🤯
Mervin Praison
27 AutoGen + Text Generation WebUI: Unbelievable 100% Local Private Setup 🤯
AutoGen + Text Generation WebUI: Unbelievable 100% Local Private Setup 🤯
Mervin Praison
28 MemGPT: Amazing! External Context for LLM #ai #llm #memgpt  #generativeai #mem #gpt #openai #chatgpt
MemGPT: Amazing! External Context for LLM #ai #llm #memgpt #generativeai #mem #gpt #openai #chatgpt
Mervin Praison
29 GeniA: Kubernetes + AI for MIND-BLOWING Operational Efficiency! 🤯 FULL Tutorial
GeniA: Kubernetes + AI for MIND-BLOWING Operational Efficiency! 🤯 FULL Tutorial
Mervin Praison
30 VertexAI Meets LangChain for Mind-Blowing AI Conversations! 😲 Step by Step Tutorial
VertexAI Meets LangChain for Mind-Blowing AI Conversations! 😲 Step by Step Tutorial
Mervin Praison
31 Simplified ChatGPT API Setup on Node.js for Newbies! 😍 Step by Step Tutorial
Simplified ChatGPT API Setup on Node.js for Newbies! 😍 Step by Step Tutorial
Mervin Praison
32 Autogen: Ollama integration 🤯 Step by Step Tutorial. Mind-blowing!
Autogen: Ollama integration 🤯 Step by Step Tutorial. Mind-blowing!
Mervin Praison
33 LiteLLM: One-Function Call to ANY Large Language Model! 🤯 UNBELIEVABLE!
LiteLLM: One-Function Call to ANY Large Language Model! 🤯 UNBELIEVABLE!
Mervin Praison
34 ChatGPT Chatbot in Less Time Than You Think! 🚀😎 Step-by-Step Tutorial
ChatGPT Chatbot in Less Time Than You Think! 🚀😎 Step-by-Step Tutorial
Mervin Praison
35 LiteLLM Chatbot: Build Your Own in MINUTES! INSANE! 🤖🔥
LiteLLM Chatbot: Build Your Own in MINUTES! INSANE! 🤖🔥
Mervin Praison
36 Create Chatbot: Turn ANY Open-Source LLM into a Conversation Pro! 🤖
Create Chatbot: Turn ANY Open-Source LLM into a Conversation Pro! 🤖
Mervin Praison
37 Create Chatbot: Ollama Integration Made UNBELIEVABLY Easy! 🎉
Create Chatbot: Ollama Integration Made UNBELIEVABLY Easy! 🎉
Mervin Praison
38 LlamaIndex + ChatGPT: Ingest Data and Experience UNBELIEVABLE Query Results! 🌟
LlamaIndex + ChatGPT: Ingest Data and Experience UNBELIEVABLE Query Results! 🌟
Mervin Praison
39 INSANE! OpenAgents: Automated Data Analysis with Kaggle 🤯
INSANE! OpenAgents: Automated Data Analysis with Kaggle 🤯
Mervin Praison
40 React.js LLM Agent for Next-Gen Coding using ChatGPT 🚀 Mind-Blowing 🤯
React.js LLM Agent for Next-Gen Coding using ChatGPT 🚀 Mind-Blowing 🤯
Mervin Praison
41 MemGPT + Any LLM 🚀 100% Local & Private Integration Unveiled! Unlimited Memory
MemGPT + Any LLM 🚀 100% Local & Private Integration Unveiled! Unlimited Memory
Mervin Praison
42 MemGPT  + AutoGen 🧠🤖 Unlimited Memory & Autonomous AI Agents! INSANE🤯
MemGPT + AutoGen 🧠🤖 Unlimited Memory & Autonomous AI Agents! INSANE🤯
Mervin Praison
43 AutoGen + Google's Palm LLM & More! Revolutionary AI Integration 🚀
AutoGen + Google's Palm LLM & More! Revolutionary AI Integration 🚀
Mervin Praison
44 MemGPT & LM Studio Integration Revealed! 🔥 Next-Level AI
MemGPT & LM Studio Integration Revealed! 🔥 Next-Level AI
Mervin Praison
45 🚀 AutoLLM: Unlock the Power of 100+ Language Models! Step-by-Step Tutorial
🚀 AutoLLM: Unlock the Power of 100+ Language Models! Step-by-Step Tutorial
Mervin Praison
46 AutoLLM & Gradio Integration You Won't Believe! 🤯 Mind-Blowing
AutoLLM & Gradio Integration You Won't Believe! 🤯 Mind-Blowing
Mervin Praison
47 AutoLLM & FastAPI Tutorial: Query 100+ Language Models! 😱
AutoLLM & FastAPI Tutorial: Query 100+ Language Models! 😱
Mervin Praison
48 Quivr: LLM's Second Brain - Transforming Data Management & Advanced Query with AI! 🤯
Quivr: LLM's Second Brain - Transforming Data Management & Advanced Query with AI! 🤯
Mervin Praison
49 AutoGen & MemGPT with Local LLM: A Complete Setup Tutorial! 🧠 AMAZING 🤯
AutoGen & MemGPT with Local LLM: A Complete Setup Tutorial! 🧠 AMAZING 🤯
Mervin Praison
50 LocalAI: Free, Open Source OpenAI Alternative 🚀 INSANE 🤯 Step-by-Step Tutorial
LocalAI: Free, Open Source OpenAI Alternative 🚀 INSANE 🤯 Step-by-Step Tutorial
Mervin Praison
51 Yarn Mistral 7B 128k LARGE context window, Small size 🤯 INSANE 🚀 Setup Tutorial!
Yarn Mistral 7B 128k LARGE context window, Small size 🤯 INSANE 🚀 Setup Tutorial!
Mervin Praison
52 Zephyr-7B: The Small and Mighty LLM 🤯 Step by Step Tutorial! 📘
Zephyr-7B: The Small and Mighty LLM 🤯 Step by Step Tutorial! 📘
Mervin Praison
53 Promptfoo: How to Test Your LLM ? 🚀  VERY EASY!
Promptfoo: How to Test Your LLM ? 🚀 VERY EASY!
Mervin Praison
54 Pydantic: How to Validate LLM Responses? 🚀 Quality Response. VERY EASY!!!!
Pydantic: How to Validate LLM Responses? 🚀 Quality Response. VERY EASY!!!!
Mervin Praison
55 Pydantic: FORCE Your AI to Respond Back in UPPERCASE! 🤯 Step-by-Step Tutorial 🔥
Pydantic: FORCE Your AI to Respond Back in UPPERCASE! 🤯 Step-by-Step Tutorial 🔥
Mervin Praison
56 Pydantic: How to use LLM to convert unstructured data to structured data?
Pydantic: How to use LLM to convert unstructured data to structured data?
Mervin Praison
57 AutoGen Function Calling: INSANE 🚀 Custom Integrations! Step-by-Step Tutorial 🤯
AutoGen Function Calling: INSANE 🚀 Custom Integrations! Step-by-Step Tutorial 🤯
Mervin Praison
58 OpenAI Assistants API + Python 🤖 How to get started? (FULL Tutorial) 🤯 INSANE
OpenAI Assistants API + Python 🤖 How to get started? (FULL Tutorial) 🤯 INSANE
Mervin Praison
59 GPT-4 Vision API 🤯 INSANE Video Recognition Powers! Step-by-Step Tutorial 🚀
GPT-4 Vision API 🤯 INSANE Video Recognition Powers! Step-by-Step Tutorial 🚀
Mervin Praison
60 GPT-4 Vision API 🚀 The Future of Image Recognition! 🤯 Step-by-Step Tutorial
GPT-4 Vision API 🚀 The Future of Image Recognition! 🤯 Step-by-Step Tutorial
Mervin Praison

This video teaches how to use LM Studio CLI to integrate large language models into applications and create a user interface with Chainlit. It covers downloading and loading models, starting a local server, and testing the application.

Key Takeaways
  1. Download and install LM Studio CLI
  2. Download a large language model
  3. Start the LM Studio server
  4. Load the language model
  5. Test the server
  6. Create a user interface with Chainlit
  7. Integrate the language model with the user interface
💡 LM Studio CLI allows developers to integrate large language models into applications and create a user interface with Chainlit, enabling the creation of chatbots and other AI-powered applications.

Related Reads

📰
How Pulse matches you with the right provider — semantic AI search vs keyword lookup. BizNode Pulse uses embedding-based...
Learn how BizNode Pulse uses semantic AI search to match clients with the right service providers, outperforming traditional keyword-based systems
Dev.to AI
📰
Prompt Chaining: How to Break Down Complex Tasks Into Simple Steps
Learn to break down complex tasks into simple steps using prompt chaining for LLMs, improving model performance and output quality
Dev.to AI
📰
High-Performance MoE Inference: Qwen3.6–35B-A3B on an AI PC with OpenVINO
Run high-performance MoE inference with Qwen3.6–35B-A3B on an AI PC using OpenVINO and INT4 quantization
Medium · Machine Learning
📰
The Use Of Ai In Today’s World
Discover how AI is transforming industries and daily life in today's world
Medium · Deep Learning

Chapters (6)

Introduction to LM Studio CLI
0:35 Setting up LM Studio CLI
1:39 Downloading and Managing Models
2:34 Starting and Testing the Server
3:45 Building a Chatbot Interface
6:07 Final Overview & How to Unload Models
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →