Share
Explore

f23 IN4023 Asgn 2 Building the AI Application with LMStudio

image.png
Your Hand In Work:
Make a Word Document: Name your Word Doc as StudentName_StudentID.docx
Add some some shots as Proof of Work.
Version A of the Lab: Follow the Instructions here in the Notebook: Use Screenshots to Journal your progress and write down descriptions of what you have done: Make your Lab into an Instruction Book that would someone else how to Install and Run LMStudio.

Version B:
Write a 1000 Word Word Document addressing these questions:
What is LM Studio. What do we do with it and how do we use it?
What is HuggingFace?
What is an LLM Large language Model.
How does LMStudio enable us to create our own ChatBox: How can we train our LM Studio Chatbot with out own Data?
Discuss and describe why training and running AI Models requires many GPU Cores.
Discuss what it means to say that I am working with a Quantized Version of a Model.
Make a comparative Table, comparing the s of:
LM Studio
Google Collab Notebook
By your own research: Your find one other AI Application Development tool and make the 3 way comparison with LM Studio and Google Collab Notebook.


Download and Install LM Studio

LM Studio is a user-friendly tool that allows you to run large language models on your local machine.
It provides a convenient interface to download, customize, and manage different models.
Here's a step-by-step guide on how to use LM Studio to create your own language model:

Installation and Setup

Download LM Studio: Visit the LM Studio website () and download the application. LM Studio is available for Apple, Windows, and Linux systems, ensuring wide accessibility
.
Install LM Studio: The installation process is straightforward. After downloading the installer, run it to install LM Studio on your computer. The software is designed to be accessible even to those with limited technical background
.

Model Training

Explore Models: Once you've installed LM Studio, you can start exploring different models.(The models are obtained from HUGGINGSPACE: an online cloud platform that provides tools for the AI hobbyist).
LM Studio provides a search box where you can search for different models that you want to try out. Any model available on Hugging Face is also available in LM Studio
.
Download Models: After finding a model you're interested in, you can download it directly from LM Studio. There's a download button for each model
.
Run Models: After downloading a model, go to the chat section on the left-hand side and click "New Chat". At the top, you should be able to choose the model you want to use. Once you've chosen a model, you can start interacting with it by typing in the chat box
. ​
Customize Models: LM Studio allows you to configure and customize prompt templates, model settings, and system prompts for different models
. ​
Manage Models: LM Studio allows for efficient management of different model versions, including quantized versions, tailored to your system specifications. You can manage and delete downloaded models, change their storage location, and even serve models through an API
. ​
Remember, LM Studio is a tool for running pre-trained models. If you want to train your own model from scratch, you'll need to use a different tool or platform that supports model training, such as Hugging Face's Transformers library. You can use Google Collab Notebook for that.

Downloading and installing LM Studio is a straightforward process. Here are the steps you need to follow:

Visit the LM Studio Website: Go to the LM Studio website at
.
Download the Installer: On the website, you will find options to download the installer for different operating systems, including Windows, Mac, and Linux
. Choose the appropriate installer for your system and download it.
Run the Installer: Once the installer is downloaded, run it to install LM Studio on your computer. The installation process is simple and doesn't require much technical knowledge
.
Launch LM Studio: After the installation is complete, you can launch LM Studio. The software has a user-friendly interface that allows you to discover, download, and run local Large Language Models (LLMs)
.
For Mac users, there's also an option to install LM Studio using Homebrew, a package manager for macOS. The command for this is brew install --cask lm-studio
.
Remember, LM Studio is a lightweight program that doesn't require much hardware to operate, making it accessible for a wide range of users
.

LM Studio offers several benefits over other language model tools, making it a powerful and user-friendly platform for working with large language models (LLMs). Here are some of the key advantages:

Ease of Use: LM Studio is designed to be user-friendly, allowing users to discover, download, and run LLMs with ease. It provides a graphical user interface (GUI) that simplifies the process of working with LLMs, making it accessible even to those without coding experience
.
Cost-Effective: Running LLMs locally with LM Studio can be more cost-effective than using cloud-based AI services, especially for high-volume applications
.
Privacy and Control: If you're concerned about data privacy, running LLMs locally with LM Studio gives you more control over your data
.
Reduced Latency: Cloud-based AI services can have latency issues, which can be problematic for real-time applications. Running LLMs locally with LM Studio can eliminate these latency issues
.
Fine-Tuning Capabilities: LM Studio allows you to fine-tune LLMs without any coding experience, making it easy to experiment with different models and hyperparameters
.
Cross-Platform Compatibility: LM Studio is compatible with different operating systems, including Windows, Mac, and Linux, and can take advantage of the GPU when available, optimizing performance during model execution
.
Offline Accessibility: With LM Studio, you can run LLMs on your laptop without requiring an internet connection, ensuring complete offline accessibility
.
Model Comparison: LM Studio provides a collection of standardized JSON descriptors for LLM files, making it easy to compare different models and select the best one for your needs
.
Integration with Hugging Face Models: LM Studio is compatible with Hugging Face models, allowing you to leverage a wide range of pre-trained models for various tasks
.
API for Developers: LM Studio can serve models through an API, offering developers the opportunity to integrate language models into their projects
.
In summary, LM Studio offers a user-friendly, cost-effective, and versatile platform for working with LLMs, making it a valuable tool for both developers and researchers
.
ShareShare
Rewrite
Not AccurateView SourcesCopyEdit Query

For students who are new to creating chatbots, a simple and effective model to use is the GPT-3 model by OpenAI. This model can be fine-tuned on specific training data provided by the students, making it a good choice for creating a simple chatbot
.

Here are the steps to create a simple chatbot using GPT-3:
Prepare the Training Data: The first step is to prepare the training data. This could be a collection of dialogues or conversations that the chatbot should learn from. The data should be formatted properly, usually in a JSON format, with clear demarcations for the inputs and the expected outputs
.
Fine-Tune the Model: Once the data is ready, the next step is to fine-tune the GPT-3 model on this data. This involves running the model on the data and adjusting the model's parameters to minimize the difference between the model's predictions and the actual outputs in the training data
.
Test the Model: After fine-tuning, the model should be tested to ensure that it is working as expected. This can be done by providing the model with new inputs that it hasn't seen before and checking if the outputs are correct
.
Deploy the Model: Once the model has been tested and validated, it can be deployed as a chatbot. This could involve integrating the model with a messaging platform or creating a standalone application
.
Monitor and Update the Model: After deployment, the model should be monitored to ensure that it continues to perform well. If the model's performance drops, or if new training data becomes available, the model can be updated by repeating the fine-tuning process
.
It's important to note that while GPT-3 is a powerful model, it may not be the best choice for all applications. Depending on the specific requirements of the chatbot, other models or approaches may be more appropriate. For example, for a chatbot that needs to handle very specific tasks, a rule-based approach might be more suitable
.
Finally, there are also many tools and platforms available that can simplify the process of creating a chatbot. These include Tidio, Botsify, and Chatfuel, which offer ready-made chatbot templates and visual drag-and-drop bot editors, making it easy for beginners to create a chatbot without any coding
.


Once you've installed your ChatGPT 3.5 model into LMStudio, you can chat with the model by following these steps:

Open LMStudio: Start by launching the LMStudio application on your computer
. ​
Select the Model: In the LMStudio interface, click on "Select a model to load" and choose the ChatGPT 3.5 model that you've installed
.
Start Chatting: Once the model is loaded, you can start chatting with the AI model. You can do this by typing your input into the chat window and pressing enter. The model will then generate a response based on your input
.
End the Session: When you're done chatting with the model, you can click on "Eject Model" to offload the model from the RAM
.
Remember, all your chats are private and you can use LMStudio in offline mode as well
.

Hugging Face

is a leading organization in the field of machine learning, particularly in the development and deployment of large language models (LLMs). Their mission is to advance and democratize artificial intelligence through open source and open science 1. They have made significant contributions to AI research with their powerful, general models that can take on a wide variety of new language tasks from user instructions 2.

Large Language Models (LLMs) and Hugging Face
LLMs are statistical models of language that have made a significant impact on AI research They are trained with the objective of completing an incomplete text or generating text from scratch as a response to a given instruction or question 3. Famous examples of LLMs include GPT-3 by OpenAI and Llama by Meta AI.
Hugging Face has developed BLOOM, the first multilingual LLM trained in complete transparency, which is the result of the largest collaboration of AI researchers ever involved in a single research project 2. BLOOM is an autoregressive LLM, trained to continue text from a prompt on vast amounts of text data using industrial resources 4.
Hugging Face's LLM Leaderboard
Hugging Face hosts an LLM leaderboard, which is created by evaluating community-submitted models on text generation benchmarks on Hugging Face's clusters 3. This leaderboard helps users find the best model for their specific language or domain needs. They also have an LLM Performance leaderboard, which evaluates the latency and throughput of large language models available on Hugging Face Hub 3.
Deployment of LLMs with Hugging Face
Hugging Face has partnered with Amazon Web Services to release a new Hugging Face Deep Learning Container (DLC) for inference with LLMs. This DLC is powered by Text Generation Inference (TGI), an open-source, purpose-built solution for deploying and serving LLMs. TGI enables high-performance text generation using Tensor Parallelism and dynamic batching for the most popular open-source LLMs, including StarCoder, BLOOM, GPT-NeoX, StableLM, Llama, and T5 5.
Hugging Face and Docker
Hugging Face's large collection of pretrained models and user-friendly interfaces have entirely changed how we approach AI/ML deployment and spaces. They have integrated with Docker to provide more control over infrastructure and data, making it easier to deploy advanced language models for a variety of applications 6.
Responsible Use of LLMs
While LLMs are powerful tools, they can sometimes exhibit undesirable behaviors like revealing personal information and generating misinformation, bias, hatefulness, or toxic content. Hugging Face and the broader AI community are actively working on strategies to steer LLMs away from these undesirable outcomes.
In conclusion, Hugging Face is a significant player in the field of LLMs, providing powerful tools and resources for the AI community. They are committed to advancing and democratizing AI through open source and open science, and their work is helping to shape the future of AI research and application.
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.