Sunday, September 8, 2024
Large Language Model: Installation and Usage Precautions on Local Machine
Author:
Yuwei Yang
文章封面圖片
Recently, due to the rapid advancements in AI and large language models, our community has seen some new changes. This week, the group held two online sessions to share how to run large language models on personal computers. I was fortunate to attend both sessions, and during some short breaks, I quickly organized the key points. Everyone is welcome to add more insights!
The first session had about 70 participants (September 2, 2024), the second session had 100 participants (September 5, 2024). Unfortunately, we only found out on the day that Google Meet has a maximum limit of 100 people, so some people couldn't participate. The third session will be held on September 9, 2024.
Scientific Maker AI Project
Recently, there have been many AI-related discussions in the main Facebook group 'Scientific Maker'. The group has set up multiple Discord servers for public AI usage.
The main server 'ScientificMakerCampus' offers various AI models for project supporters to use, with rapid iterative updates over the past six months.
Secondary servers 'Health Consultation med4o', 'Financial and Business Consultation rich4o', 'Legal Consultation law4o' use the most advanced AI large language models and databases to provide free consultations to everyone, making society more fair and reasonable.
The participation method for the Scientific Maker AI Project is still evolving and should follow the rules announced for each session.
Four Steps to Use Large Language Models Locally
Apply for Hugging Face Account ➜ Download Large Language Model ➜ Download Msty ➜ Basic Operations of Msty
By completing these four steps, you can use large language models on your computer and adjust the model responses to your preferences. The following sections will introduce each step:
(1) Apply for a Hugging Face Account
段落圖片
Hugging Face is a platform where the machine learning community collaborates on models, datasets, and applications. It offers various large language models for download, some free and some requiring application. You need to create a Hugging Face account before downloading.
1. Go to the Hugging Face official website and click the Sign Up button
段落圖片
2. Enter your desired email and password. The email will be your login account.
段落圖片
3. Enter your user ID, real name, and check the box to agree to the usage policy.
段落圖片
4. After completion, you will return to the Hugging Face homepage in a logged-in state.
段落圖片
5. Go to your email and click the link in the Hugging Face verification email to proceed with subsequent operations.
段落圖片
6. Return to the Hugging Face page to see the verification success message.
段落圖片
7. Enter 'SciMaker' in the search box to see the group's current model list.
段落圖片
(2) Download Large Language Models
SciMaker currently has three large language models, with more to come in the future. This article explains two of them.
TaiwanPro Download Steps
段落圖片
1. Log in to Hugging Face and find SciMaker/TaiwanPro-Llama-3.1-8B in the search box.
段落圖片
2. Click the apply button to request access to TaiwanPro. Note: Currently, there are only two ways to apply for download: using SciSpot points or making a small donation to the 'Scientific Maker AI Project'.
段落圖片
3. Click 'your settings' to check the application status.
段落圖片
4. On the application status page, 'PENDING' means the application has been submitted but not yet approved.
段落圖片
5. If you try to download the model before approval, it won't be successful. You can skip to (3) Download Msty while waiting for notification.
段落圖片
6. When approved, you'll receive an email notification. Click 'in your settings' in the email to go to the Hugging Face page and check the application status.
段落圖片
7. The SciMaker/TaiwanPro-Llama-3.1-8B in the application list will change to ACCEPTED.
段落圖片
8. Return to the TaiwanPro-Llama-3.1-8B page to see the approval message.
段落圖片
9. Switch to the 'Files and versions' page.
段落圖片
10. Click the download button to start downloading TaiwanPro-Llama-3.1-8B.
段落圖片
Qwen2-0.5B_Q4_test Download Steps
段落圖片
1. Log in to Hugging Face and find SciMaker/Qwen2-0.5B_Q4_test in the search box.
段落圖片
2. Switch to the 'Files and versions' page.
段落圖片
3. Click the download button to start downloading Qwen2-0.5B_Q4_test.
段落圖片
(3) Download Msty
段落圖片
Msty is a tool that allows users to run various large language models on their local computer with a beautiful interface. Anyone can learn to use it quickly.
1. Go to the Msty official website and click the 'Download Msty' button.
段落圖片
2. Please choose to download and install the version that corresponds to your computer.
段落圖片
3. After successful download, you'll see the interface below. First, click the 'SETUP LOCAL AI' button to install Msty's default local large language model Gemma2 (you can chat with different large language models simultaneously).
段落圖片
4. When the progress bar reaches 100%, it means Gemma2 download is complete.
段落圖片
(4) Basic Operations of Msty
If you want to use different large language models in Msty, you just need to import them individually. The following will explain how to import TaiwanPro-Llama-3.1-8B and Qwen2-0.5B_Q4_test into Msty, and their respective settings.
Using TaiwanPro-Llama-3.1-8B in Msty
段落圖片
1. Click the 'Computer' button in the left menu.
段落圖片
2. Click the 'Import GGUF Model...' button.
段落圖片
3. Select the TaiwanPro-Llama-3.1-8B model you just downloaded.
段落圖片
4. Name this model, for example: TaiwanPro.
段落圖片
5. In the 'Prompt Template' section, select Llmma3 Instruct as the template. Note: When importing different large language models, you need to select the corresponding template.
段落圖片
6. After selection, click the 'Create' button in the bottom right corner to start creating a new model chat interface.
段落圖片
7. After creation, you'll see a brief green box notification message, then you can go to the 'Installed Models' tab to view the list of currently imported models.
段落圖片
8. Seeing TaiwanPro-Llama-3.1-8B means successful import. Press the 'X' button in the top right to close the window.
段落圖片
9. Move your mouse to the Misc position, and a small button will appear. Click the button with the 'message icon and plus sign' to open a new chat.
段落圖片
10. From the menu below, switch the language model. Select TaiwanPro (the name you just gave).
段落圖片
11. Enter the content you want to chat about in the input box.
段落圖片
12. You'll get TaiwanPro's response.
段落圖片
Using Qwen2-0.5B_Q4_test in Msty
段落圖片
1. Click the 'Computer' button in the left menu.
段落圖片
2. Click the 'Import GGUF Model...' button.
段落圖片
3. Select the Qwen2-0.5B_Q4_test model you just downloaded.
段落圖片
4. Name this model, for example: Qwen2.
段落圖片
5. In the 'Prompt Template' section, select ChatML as the template. Note: When importing different large language models, you need to select the corresponding template.
段落圖片
6. After selection, click the 'Create' button in the bottom right corner to start creating a new model chat interface.
段落圖片
7. After creation, you'll see a brief green box notification message, then you can go to the 'Installed Models' tab to view the list of currently imported models.
段落圖片
8. Seeing Qwen2-0.5B_Q4_test means successful import. Press the 'X' button in the top right to close the window.
段落圖片
9. Move your mouse to the Misc position, and a small button will appear. Click the button with the 'message icon and plus sign' to open a new chat.
段落圖片
10. From the menu below, switch the language model. Select Qwen2 (the name you just gave).
段落圖片
11. Enter the content you want to chat about in the input box.
段落圖片
12. You'll get Qwen2's response.
段落圖片
Advantages of Using Large Language Models in Msty
(1) Simple and Easy to Use: The interface is like a chat window, anyone can learn it easily, and you can also use more advanced parameter settings.
(2) Protects Personal Privacy: Input information stays only on your computer.
(3) Built-in Assistant Roles: When asking questions, you can choose specific roles, with over 230 options, making the responses more suitable for your needs.
段落圖片
(4) Can Compare Multiple Models: Use the split window feature to use different large language models simultaneously and compare their responses.
段落圖片
(5) Built-in RAG Function: Can make large language models respond based on different data sources. Can import personal documents, connect to Obsidian vaults, link to multiple YouTube videos, etc.
段落圖片
(6) Can Use Web Search: Can answer questions based on real-time web data.
段落圖片
Frequently Asked Questions
Q: Can TaiwanPro-Llama-3.1-8B be used commercially?
A: It can only be used for personal or educational purposes.
Q: What should I do if I selected the wrong template (Prompt Template)?
A: Just import the model again and select the correct template.
Q: What computer hardware specifications are needed to use TaiwanPro-Llama-3.1-8B?
A: It's recommended to have a GPU with 8GB or more VRAM, or a Mac computer with M1, M2, or M3 chips.
Q: What hardware specifications are needed to use Qwen2-0.5B_Q4_test?
A: This is a very small large language model, suitable for most computer hardware.
Q: What should I do if TaiwanPro-Llama-3.1-8B keeps repeating the same content and won't stop?
A: You can add stop parameters in the advanced settings (needs to be set when first importing the model). Click Advanced, in the Parameters section, select stop, and paste the following content.
1PARAMETER stop "<|start_header_id|>"
2PARAMETER stop "<|end_header_id|>"
3PARAMETER stop "<|eot_id|>"
4PARAMETER stop "<|end_of_text|>"
段落圖片
Advanced Questions
Q: Can Msty generate API Keys for other software to use?
A: Currently not possible.
Q: Does TaiwanPro have voice functionality?
A: No.
About Author