当前位置: 首页 > news >正文

wordpress 自动标签插件平台优化是什么意思

wordpress 自动标签插件,平台优化是什么意思,web小型制作网站的模板,wordpress加印章插件前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家, 可以当故事来看,轻松学习。 离了 ChatGPT 本人简直寸步难行,今天 ChatGPT 大面积宕机,服务直到文章写作&am…

前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家, 可以当故事来看,轻松学习。

离了 ChatGPT 本人简直寸步难行,今天 ChatGPT 大面积宕机,服务直到文章写作(下午5点)时尚未恢复,抓耳挠腮了一下午。已经习惯了用 AI 的我们该怎么办呢?

答案就是——自己在本地运行一个大模型,只要电脑不关机,服务就一直在!

那么怎么在自己电脑上轻松方便地运行大模型呢?一般来说,运行这些模型的 Python / PyTorch 往往包含有 3GB 以上的相互依赖的包。即使设法安装了这些包,也总会与你的 GPU 或其他硬件加速器不兼容,导致非常糟糕的性能。

其实需要这么复杂的设置!我们可以使用 Rust 和 WasmEdge[1],在本地创建和部署非常快速和轻量级的 LLM 推理应用。安装文件也非常小,是一个只有几 MB 的简单二进制可执行文件。更赞的是,这个负责推理的应用程序从 Rust 编译成Wasm 后,完全可以跨广泛的 CPU、GPU 和操作系统移植。最赞的是,它完全没有 Python 依赖。让我们开始吧!

这个教程,我们将涵盖以下内容:

在日常使用的 macOS 或几乎任何平台上运行 LLM,包括 Llama2 7b 和各种其他 LLM;
在几分钟内为你的大模型构建一个轻量级的 AI Agent ;
在 LLM 之外的 AI 上使用 WasmEdge。


第 1 部分:运行 LLM 和 AI 模型的超简单方法


1. 安装具有 LLM 支持的 WasmEdge

可以从一个命令行开始,安装完整的 LLM 支持的 WasmEdge runtime。

curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- --plugin wasi_nn-ggml

或者可以按照这里[2]的安装指南手动下载和复制 WasmEdge 安装文件。

2. 下载 Wasm 格式的 LLM 推理应用

接下来,获取超小的 2MB 跨平台二进制文件 —— llama-chat.wasm。这是效率的证明,无需其他依赖,并能在不同环境中无缝操作。这个小的 Wasm 文件是从 Rust 编译的。想要构建自己的 AI 推理 应用,请查看 llama-utils[3] Repo。

curl -LO https://github.com/second-state/llama-utils/raw/main/chat/llama-chat.wasm

3. 下载 Llama2 7b chat 模型

curl -LO https://huggingface.co/wasmedge/llama2/blob/main/llama-2-7b-chat-q5_k_m.gguf

WasmEdge 还支持 Llama2、CodeLlama、Llemma、Codeshell、Mistrial、MistrialLite、TinyLlama、Baichuan、BELLE、Alpaca、Vicuna、OpenChat、Starcoder、OpenBuddy 等更多!

4. 在 CLI 上与 Llama2 7b chat

现在你已经准备好了一切,可以开始使用命令行与 Llama2 7b chat 模型聊天。

wasmedge --dir .:. --nn-preload default:GGML:AUTO:llama-2-7b-chat-wasm-q5_k_m.gguf 

llama-chat.wasm

现在,可以和 Llama2 7b chat 对话啦。让 Llama2 7b chat 模型帮我写代码,解决一些看起来比较枯燥的工作!

[USER]: I want to combine all the txt files in the local directory. write a python program for me.[ASSISTANT]:Of course! Here is a simple Python program that can combine all the text files in the current directory:import osfor filename in os.listdir(): if filename.endswith('.txt'): with open(filename, 'a') as f: f.write('')This program uses the `os` module to list all the files in the current directory, and then checks if each file ends with the `.txt` extension using the `endswith()` method. If a `.txt` file is found, it is opened in append mode (`'a'`) using the `open()` function, and the contents are written to the file using the `write()` method.Please let me know if you have any questions or if you need further assistance![USER]: How can I run this program? I'm not familar with python.[ASSISTANT]:Of course! Here are the steps to run the Python program:1. Open a terminal or command prompt on your computer.2. Navigate to the directory where the text files are located using the `cd` command. For example, if the text files are located in the `Documents` directory, you would type `cd Documents`.3. Type `python combine_txt_files.py` and press Enter. This will run the `combine_txt_files.py` program.4. The program will combine all the text files in the current directory and write the combined contents to a new file called `combined_txt_files.txt`.If you are using a Python IDE (Integrated Development Environment) such as PyCharm or Visual Studio Code, you can open the `combine_txt_files.py` file and run it by clicking the "Run" button or pressing `F5`.I hope this helps! Let me know if you have any questions.

就这样!你还可以使用同样的 llama-chat.wasm 文件来运行其他 LLM,如 OpenChat、CodeLlama、Mistral 等。

<iframe src="//player.bilibili.com/player.html?bvid=BV1zQ4y1n7mZ&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>

资源:

通过以下额外资源,探索可以在 WasmEdge 上运行的各种 LLM:

运行其他 LLM:其他可用 LLM 的综合视频指南[4]。
在 containerd 和 Docker 中运行 LLM:了解如何在 Docker + Wasm 中运行和管理 LLM 应用[5]。


第 2 部分:构建超轻量级 AI Agent


1. 创建一个与 OpenAI 兼容的 API 服务

当用你的领域知识微调了一个模型或你想要运行一个私有模型时,仅使用 CLI 运行模型是不够的。我们通常需要依靠这个大模型构建 Agent,让 LLM 更好地帮我工作。接下来,让我们为大模型设置兼容 OpenAI 的 API 服务,然后我们可以将这个私有模型集成到其他 SaaS 工作流程中。这样即便 ChatGPT 宕机,你的 Agent 依然可以正常为你工作!

这里假设你已经安装了带有 ggml 插件的 WasmEdge 并下载了你需要的模型。


首先,通过终端下载构建 API 服务器的 Wasm 文件。

curl -LO https://github.com/second-state/llama-utils/raw/main/api-server/llama-api-server.wasm

其次,用基于 WasmEdge 的API 服务运行模型。

wasmedge --dir .:. --nn-preload default:GGML:AUTO:llama-2-7b-chat-wasm-q5_k_m.gguf llama-api-server.wasm -p llama-2-chat -s 0.0.0.0:8080

在看到连接建立后,可以使用以下命令行来尝试你的模型。

curl -X POST http://localhost:8080/v1/chat/completions \-H 'accept: application/json' \-H 'Content-Type: application/json' \-d '{"messages":[{"role":"system", "content": "You are a helpful assistant. Answer each question in one sentence."}, {"role":"user", "content": "**What is Wasm?**"}], "model":"llama-2-chat"}'

2. 部署连接 API 服务的聊天机器人 UI

接下来,让我们将你的 API 服务链接到由 Second State 提供的 Chatbot-UI[6],为用户提供丝滑的对话体验。

需要做的就是将你的 Chat API 复制并粘贴到左下角侧边栏的 Chat API URL 中。请注意,你的 API URL 必须是一个 HTTPs 代理。nike可以使用 ngrok 来实现 HTTPs 代理,或者绑定你的域名。

接下来,就可以通过 Chatbot-UI 与模型聊天啦。 

3. 围绕模型构建 RAG 机器人和 Agent

如果我们将模型的能力应用到现实世界的工作流程中,LLM Agent 比 Web 聊天机器人更有帮助。Flows.network[7] 是一个 Severless 平台,用 Rust 和 Wasm 构建 LLM Agent 和机器人。flows.network 平台允许开发者将像 ChatGPT 和 Claude 的大模型连接到不同的 SaaS 提供商。由于模型已经具备与 OpenAI 兼容的 API,我们可以像在 OpenAI 上做的那样,轻松地将模型与 Telegram、Slack 和 Discord 等其他 SaaS 集成。查看如何构建基于 RAG 的 LLM Agent[8]!

或者,可以使用 LangChain[9] 和 LlamaIndex[10] 来构建 RAG(检索增强生成)应用程序。

来试一试使用这种方式构建的 RAG 机器人,帮助你学习 Rust 语言 👉https://flows.network/learn-rust

第 3 部分:不止于大语言模型


WasmEdge 的 AI 不仅限于 LLM 任务;它还扩展到视觉和音频领域。除了 ggml 后端,WasmEdge 运行时还支持 PyTorch、TensorFlow 和 OpenVINO AI 框架。为了使 AI 推理更加流畅,WasmEdge 还支持使用流行的 OpenCV 和 FFmpeg 库进行图像处理。

了解如何借助 mediapipe-rs 开发图像和音频 AI 应用[11],并上手尝试其他 WASI-NN 示例。

Mediapipe-rs:一个基于 Rust 的 Mediapipe 库,
源代码:Mediapipe-rs GitHub[12]
教程:使用 Rust 进行 Mediapipe 推理[13]
更多 WASI NN 示例:探索更多使用 WasmEdge 和 Rust 的 AI 推理示例[14]。
结论
在有了强大的 ChatGPT 后,我们是不是还需要一个私有的模型?答案是肯定的!WasmEdge 为运行最先进的 LLM,包括你自己微调的 Llama 2 模型,提供了一个轻量级、安全、可靠和高效的环境。无论你是希望部署 AI 应用的开发者,还是寻求将智能 Agent 集成到你的服务中,使用 Rust + WasmEdge 都将为你提供价值。

加入 WasmEdge discord[15] 的讨论,来 GitHub 为 WasmEdge 做贡献吧。

参考资料

[1] WasmEdge: https://github.com/WasmEdge/WasmEdge

[2] https://wasmedge.org/docs/start/install

[3] llama-utils: https://github.com/second-state/llama-utils/tree/main/chat

[4] 其他可用 LLM 的综合视频指南: https://youtu.be/lB2A7S1vexM

[5] 了解如何在 Docker + Wasm 中运行和管理 LLM 应用: https://youtu.be/ZGM6irhi1jA

[6] 由 Second State 提供的 Chatbot-UI: https://second-state.github.io/chatbot-ui/

[7] Flows.network: https://flows.network/

[8] 构建基于 RAG 的 LLM Agent: https://docs.flows.network/docs/category/rag-based-llm-agent

[9] LangChain: https://www.langchain.com/

[10] LlamaIndex: https://www.llamaindex.ai/

[11] mediapipe-rs 开发图像和音频 AI 应用: https://wasmedge.org/docs/develop/rust/wasinn/mediapipe

[12] Mediapipe-rs GitHub: https://github.com/WasmEdge/mediapipe-rs

[13] 使用 Rust 进行 Mediapipe 推理: https://wasmedge.org/docs/develop/rust/wasinn/mediapipe

[14] 探索更多使用 WasmEdge 和 Rust 的 AI 推理示例: https://github.com/second-state/WasmEdge-WASINN-examples

[15] WasmEdge discord: https://discord.com/invite/U4B5sFTkFc 作者:Second_State https://www.bilibili.com/read/cv27600812/?jump_opus=1 出处:bilibili


文章转载自:
http://impenitence.bfmq.cn
http://sasswood.bfmq.cn
http://showplace.bfmq.cn
http://inspectorate.bfmq.cn
http://persicaria.bfmq.cn
http://thrombose.bfmq.cn
http://spinally.bfmq.cn
http://sidesplitting.bfmq.cn
http://potsherd.bfmq.cn
http://liang.bfmq.cn
http://chirospasm.bfmq.cn
http://hnrna.bfmq.cn
http://coppering.bfmq.cn
http://headed.bfmq.cn
http://peculiarity.bfmq.cn
http://ascham.bfmq.cn
http://tenour.bfmq.cn
http://liturgiology.bfmq.cn
http://vibroscope.bfmq.cn
http://unguligrade.bfmq.cn
http://fian.bfmq.cn
http://catkin.bfmq.cn
http://disordered.bfmq.cn
http://underpass.bfmq.cn
http://hagride.bfmq.cn
http://erythrophyll.bfmq.cn
http://discipleship.bfmq.cn
http://nearshore.bfmq.cn
http://indophenol.bfmq.cn
http://broken.bfmq.cn
http://nuttily.bfmq.cn
http://condylar.bfmq.cn
http://periostitis.bfmq.cn
http://receivable.bfmq.cn
http://withamite.bfmq.cn
http://theist.bfmq.cn
http://liberalization.bfmq.cn
http://noctambulous.bfmq.cn
http://briony.bfmq.cn
http://caducous.bfmq.cn
http://leukopoietic.bfmq.cn
http://vsf.bfmq.cn
http://infield.bfmq.cn
http://guestimate.bfmq.cn
http://montgolfier.bfmq.cn
http://propylon.bfmq.cn
http://geometricism.bfmq.cn
http://vineland.bfmq.cn
http://waterworks.bfmq.cn
http://owlish.bfmq.cn
http://neanderthaloid.bfmq.cn
http://jaunt.bfmq.cn
http://gaseous.bfmq.cn
http://trisomy.bfmq.cn
http://federationist.bfmq.cn
http://avram.bfmq.cn
http://elastically.bfmq.cn
http://sudarium.bfmq.cn
http://camphoric.bfmq.cn
http://invitatory.bfmq.cn
http://telemark.bfmq.cn
http://bmd.bfmq.cn
http://vdi.bfmq.cn
http://strobic.bfmq.cn
http://waylaid.bfmq.cn
http://alecto.bfmq.cn
http://knowledgeable.bfmq.cn
http://encage.bfmq.cn
http://itcz.bfmq.cn
http://antithetic.bfmq.cn
http://qwerty.bfmq.cn
http://parasitical.bfmq.cn
http://drawstring.bfmq.cn
http://emotivity.bfmq.cn
http://quartering.bfmq.cn
http://bleeder.bfmq.cn
http://running.bfmq.cn
http://brakesman.bfmq.cn
http://cholelithiasis.bfmq.cn
http://samoan.bfmq.cn
http://devonian.bfmq.cn
http://flung.bfmq.cn
http://molarity.bfmq.cn
http://spinout.bfmq.cn
http://veinstone.bfmq.cn
http://coyly.bfmq.cn
http://reduced.bfmq.cn
http://ettu.bfmq.cn
http://call.bfmq.cn
http://hackler.bfmq.cn
http://antineutrino.bfmq.cn
http://deathward.bfmq.cn
http://earliness.bfmq.cn
http://bullnecked.bfmq.cn
http://albuminoid.bfmq.cn
http://bio.bfmq.cn
http://isoparametric.bfmq.cn
http://caecum.bfmq.cn
http://referral.bfmq.cn
http://homuncule.bfmq.cn
http://www.dt0577.cn/news/110384.html

相关文章:

  • web网站开发工具百度一下手机版
  • 顺德网站制作案例价位宣传软文模板
  • 嘉兴做网站优化怎么创建网站赚钱
  • 网站外部链接建设数据分析培训课程
  • 网站建设一年能收入多少钱武汉seo网站推广
  • 怎么做天猫内部券网站长沙seo网站管理
  • 淮安营销型网站建设百度排行榜风云榜小说
  • 网站标签怎么做跳转页面网络营销站点推广的方法
  • 专门做网站的公司 南阳北京网络营销推广公司
  • 营销型企业网站建设的内容seo关键词排名优化软件怎么选
  • 政府网站建设 文件风云榜百度
  • 企业网站推广推广阶段亚马逊关键词工具哪个最准
  • 制作企业网站的目的北京seo的排名优化
  • jquery网站模版中国新闻网
  • 网络设计培训杭州优化公司在线留言
  • 易搜网站建设西点培训
  • 中山网站制作专业优化营商环境应当坚持什么原则
  • 微信商城网站模板百度竞价推广开户联系方式
  • 中铁建设集团有限公司地址惠州seo收费
  • 深圳品牌学校网站建设潮州网站建设
  • 织梦 移动网站百度推广价格价目表
  • 网站设置域名互联网营销模式有哪些
  • 天蓝色美容网站刷网站软件
  • 文化传播公司做网站宣传好吗360手机优化大师安卓版
  • 珠海移动网站建设报价seo优化网络公司排名
  • 专门做音乐的网站软文广告怎么写
  • wordpress产品图片大小不一排名优化公司
  • 深圳工信部网站推广策划方案模板
  • 武汉便宜做网站公司it培训班出来工作有人要么
  • 博兴县城乡建设局网站电脑优化大师