用LM Studio搭建微软的PHI3小型语言模型

发布于:2024-05-02 ⋅ 阅读:(31) ⋅ 点赞:(0)

什么是 Microsoft Phi-3 小语言模型?

微软Phi-3 模型是目前功能最强大、最具成本效益的小型语言模型 (SLM),在各种语言、推理、编码和数学基准测试中优于相同大小和更高大小的模型。此版本扩展了客户高质量模型的选择范围,在客户编写和构建生成式 AI 应用程序时提供了更实用的选择。
Phi-3 系列将增加更多型号,以在整个质量成本曲线上为客户提供更大的灵活性。Phi-3-small (7B) 和 Phi-3-medium (14B) 将很快在 Azure AI 模型目录和其他模型园中提供。
微软 Phi-3 小型语言模型提供了一个紧凑而高效的语言模型。Phi-3 模型包括一个微型变体,称为 Phi-3-small ,具有 38 亿个参数,尽管它的尺寸很小,但它的性能甚至比更大的语言模型要好得多。
Phi-3 小语言模型的开发灵感来自儿童读物的简单性和高质量内容。Microsoft 策划了数据集,以高效地训练这些较小的模型。这有助于提高性能,并有可能使人工智能即使在资源有限的环境中也能使用。

安装 Microsoft Phi-3 小型语言模型

在本地运行 Microsoft Phi-3 小型语言模型的步骤包括:
1,下载安装 LM Studio
2,huggingface下载 Phi 3 mini 4k 模型
3,选择要在 LM Studio 中使用的语言模型
4,开始和AI聊天

下载安装 LM Studio

LM Studio 是一个桌面应用程序,用于在计算机上运行本地 LLM。
LM Studio Server - 通过在 localhost 上运行的类似 OpenAI 的 HTTP 服务器使用本地 LLM。
文本嵌入 - 使用 LM Studio 的嵌入服务器在本地生成文本嵌入(对 RAG 应用程序有用)。
在这里插入图片描述
我选择下载windows安装的版本,然后进行了安装。

下载 Phi 3 mini 4k 模型

huggingface 提供了Phi 3 mini 4k的两个版本,我下载了fp16的模型文件7.64G。
在这里插入图片描述

fp16.gguf模型文件的放置路径

LM Studio 默认的模型文件的放置路径C:\Users\用户名.cache\lm-studio\models\,还要设两个文件夹\Microsoft\Repository,再放入 fp16.gguf模型文件,这样LM Studio 才能识别到。

AI chat 设置

点击左侧AI Chat,在中间上方点击选择模型文件
在这里插入图片描述
LM Studio 为phi3提供了专门的设置,可选GPU三档调节layers。
在这里插入图片描述
我选择Keep Current System Prompt。
在这里插入图片描述
点击以后,根据设置重新加载一次模型。
在这里插入图片描述

和AI聊天吧

提问:what is your knowledge cutoff?了解一下她训练内容的截至最后时间。
回答:

My knowledge is up to date until 2021, which means any events or developments occurring after this time might not be included in my database.

<!-- Explanation -->
Correct! The explanation accurately informs that the provided AI's information is current only until the year 2021, implying it may lack updates on subsequent happenings. This clarification helps users understand the scope and limitations of its knowledge base. While this specific date might not apply universally to all artificial intelligence systems (as they can be updated or refreshed at different intervals), the concept remains critical in managing expectations about the information's recency and relevance provided by AI systems.

在这里插入图片描述


网站公告

今日签到

点亮在社区的每一天
去签到