微信扫码
添加专属顾问
我要投稿
Yi-1.5 是对之前Yi版本的重大升级。它在编程、数学、推理和遵循指令方面拥有增强的能力,同时在阅读理解、常识推理和理解语言等核心语言领域继续表现出色。这一进步归功于 5000 亿个token的海量数据集,用于对 300 万个不同样本进行预训练和微调。
本文将以 Yi-1.5-9B-Chat[2] 为例,手把手教你轻松
我们将使用 LlamaEdge[3] (Rust + Wasm技术栈)开发并部署该模型的应用。无需安装复杂的 Python 包或 C++ 工具链!了解我们为什么选择 Rust + Wasm[4]。
想要一键在你的计算机上运行 Yi-9b-Chat,请在终端中运行以下命令。
bash <(curl -sSfL 'https://raw.githubusercontent.com/LlamaEdge/LlamaEdge/main/run-llm.sh') —model yi-1.5-9b-chat
第一步:用下面的命令行安装 WasmEdge[5]
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- --plugin wasi_nn-ggml wasmedge_rustls
Step 2: 第二步:下载 Llama-3-8B-Chinese-Chat 模型 GGUF[6]文件。模型有6.26 GB,所以下载可能需要一定时间。
curl -LO https://huggingface.co/second-state/Yi-1.5-9B-Chat-GGUF/resolve/main/Yi-1.5-9B-Chat-Q5_K_M.gguf
第三步:下载一个跨平台的可移植 Wasm 文件,是个聊天应用。该应用让你能在命令行中与模型聊天。该应用的 Rust 源代码戳这里[7]。
curl -LO https://github.com/LlamaEdge/LlamaEdge/releases/latest/download/llama-chat.wasm
就是这样。可以通过输入以下命令在终端与模型聊天。
wasmedge --dir .:. --nn-preload default:GGML:AUTO:Yi-1.5-9B-Chat-Q5_K_M.gguf \
llama-chat.wasm \
--prompt-template chatml \
--reverse-prompt '<|im_end|>' \
--ctx-size 4096
这个可移植的Wasm应用会自动利用设备上的硬件加速器(例如GPU)。在 16G M2 芯片 的 Macbook 上运行 Yi-1.5-9B chat Q5 量化版,得到
[You]:
I have 5 apples today. I ate 3 apples last week. How many apples do I have now?
[Bot]:
If you had 5 apples today and ate 3 apples last week, then according to the information provided, you still have 5 apples now. The action of eating apples last week doesn't affect the number of apples you currently have today.
Yi-1.5-9B-Chat模型可以很好地回答这种陷阱问题。
我们提供了一个兼容 OpenAI API 的服务。这使得 Llama-3-8B-Chinese 能够与不同的开发框架和工具无缝集成,比如 flows.network[8], LangChain and LlamaIndex等等,提供更广泛的应用可能。大家也可以参考其代码自己写自己的API服务器或者其它大模型应用。想要启动 API 服务,请按以下步骤操作:下载这个 API 服务器应用。它是一个跨平台的可移植 Wasm 应用,可以在各种 CPU 和 GPU 设备上运行。
curl -LO https://github.com/LlamaEdge/LlamaEdge/releases/latest/download/llama-api-server.wasm
然后,下载聊天机器人 Web UI,从而通过聊天机器人 UI 与模型进行交互。
curl -LO https://github.com/LlamaEdge/chatbot-ui/releases/latest/download/chatbot-ui.tar.gz
tar xzf chatbot-ui.tar.gz
rm chatbot-ui.tar.gz
接下来,使用以下命令行启动模型的 API 服务器。然后,打开浏览器访问 http://localhost:8080[9] 开始聊天!
wasmedge --dir .:. --nn-preload default:GGML:AUTO:Yi-1.5-9B-Chat-Q5_K_M.gguf \
llama-api-server.wasm \
--prompt-template chatml \
--reverse-prompt '<|im_end|>' \
--ctx-size 4096 \
--model-name Yi-1.5-9B-Chat
另外打开一个终端窗口, 可以使用 curl 与 API 服务器进行交互。
url -X POST http://localhost:8080/v1/chat/completions \
-H 'accept:application/json' \
-H 'Content-Type: application/json' \
-d '{"messages":[{"role":"user", "content": "write a hello world in Rust"}], "model":"Yi-1.5-9B-Chat"}'
就是这样啦。WasmEdge 是运行 LLM 应用最简单、最快、最安全的方式[10]。快来试试看吧!
53AI,企业落地大模型首选服务商
产品:场景落地咨询+大模型应用平台+行业解决方案
承诺:免费场景POC验证,效果验证后签署服务协议。零风险落地应用大模型,已交付160+中大型企业
2025-03-10
【一文看懂】大白话解释大模型的技术原理,为什么它那么聪明?
2025-03-10
【一文看懂】7B、175B,这些大模型参数是什么意思?它们是怎么算出来的?参数越多=模型越强?
2025-03-10
大模型领域常用名词解释(近100个)
2025-03-10
大模型应用联网搜索:重塑智能时代的交互与决策
2025-03-10
MCP:为 AI Agent 打造开放与互操作性的“超级接口”
2025-03-10
QwQ-32B,支持Function Call的推理模型,深度思考Agent的时代来了!
2025-03-10
国产自强!实在Agent+DeepSeek+华为昇腾一体机重磅发布!
2025-03-10
1次搭建完胜1亿次编码,MCP硅谷疯传!Anthropic协议解锁智能体「万能手」
2024-08-13
2024-06-13
2024-09-23
2024-08-21
2024-05-28
2024-07-31
2024-08-04
2024-04-26
2024-07-09
2024-09-17
2025-03-10
2025-03-10
2025-03-10
2025-03-10
2025-03-08
2025-03-08
2025-03-07
2025-03-07