赞
踩
Ollama 是一个开源的大型语言模型(LLM)服务工具,它允许用户在本地机器上运行和部署大型语言模型。Ollama 设计为一个框架,旨在简化在 Docker 容器中部署和管理大型语言模型的过程,使得这一过程变得简单快捷。用户可以通过简单的命令行操作,快速在本地运行如 Llama 3 这样的开源大型语言模型。
“
注意:推荐下载 GGUF文件格式的模型,可以快速简洁的导入 Ollama 中
“
下载地址:
https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat-GGUF-8bit/tree/main
下载 Llama3-8B-Chinese-Chat-q8_0-v2_1.gguf
模型文件
“
Modelfile
文件内容如下:
# FROM 指定 GGUF 文件的路径 FROM D:/AI/Download/Llama3-8B-Chinese-Chat-q8_0-v2_1.gguf
“
使用
ollama create
命令可以根据Modelfile
创建一个新的模型
ollama create tinywan-Llama3-8B-Chinese -f ./Modelfile transferring model data using existing layer sha256:ea6e8d5cda0fc798898b67f6e728eb2d02877a2599aa3c8290aaa6f681c2bb9e creating new layer sha256:e6e86a160950a92b7b32fcd6fcbc830e38634be6d616ec57452561bfe2a243fb writing manifest success
这个命令会读取Modelfile
中的配置,并创建一个名为tinywan-Llama3-8B-Chinese
的新模型。
“
通过命令
ollama list
查看模型列表
> ollama list NAME ID SIZE MODIFIED tinywan-Llama3-8B-Chinese:latest adcb30feaee5 16 GB About a minute ago llama3:8b a6990ed6be41 4.7 GB 2 weeks ago
使用 ollama run
命令来验证tinywan-Llama3-8B-Chinese
新模型
ollama run tinywan-Llama3-8B-Chinese:latest
>>> 写一首诗吧 。"我说。 他眨了眨眼,微笑着回答道:“好啊,我试试看。”然后,他闭上眼睛,开始吟唱: 在星空之下, 月光洒银辉。 风轻轻地舞, 树叶低语。 山川河流静默, 夜晚笼罩大地。 但就在这宁静中, 我感受到生命的脉动, 它如同诗歌般跳跃, 穿梭于每一颗心中。
除了命令行界面,OLlama
还提供了REST API
,使得您可以通过HTTP请求与模型交互。这对于在Web应用程序中集成ollama尤其有用。
要生成模型的响应,您可以发送一个POST请求到 /api/generate
curl -X POST http://localhost:11434/api/generate -d '{ "model": "llama3:8b", "prompt": "中文回答。你是什么大模型?", "stream": false }'
返回一个JSON对象流:
{ "model": "llama3:8b", "created_at": "2024-05-12T09:00:01.9513668Z", "response": "I'm LLaMA, a large language model developed by Meta AI that can understand and respond to human input in a conversational manner. I've been trained on a massive dataset of text from the internet and can generate human-like responses to a wide range of topics and questions. My training data includes but is not limited to:\n\n* Web pages: articles, blogs, forums\n* Books: fiction and non-fiction\n* Research papers: academic journals, research articles\n* User-generated content: social media, comments, reviews\n\nI'm able to generate responses that are contextualized to the conversation I'm having with you. This means I can recall previous statements or questions in our conversation and respond accordingly.\n\nMy capabilities include:\n\n* Answering questions on a wide range of topics, from science and history to entertainment and culture\n* Generating text summaries of long pieces of content\n* Translating text from one language to another (in this case, Chinese to English)\n* Responding to natural language input in a conversational manner\n\nI'm constantly learning and improving my responses based on the conversations I have with users like you. So feel free to ask me anything, and I'll do my best to provide helpful and accurate information!", "done": true, "done_reason": "stop", "context": [ 128006, ... 128009 ], "total_duration": 37185731000, "load_duration": 10876300, "prompt_eval_count": 13, "prompt_eval_duration": 1058480000, "eval_count": 248, "eval_duration": 36115711000 }
“
更多了解:https://github.com/ollama/ollama/blob/main/docs/api.md
“
项目开源地址:https://github.com/meta-llama/llama3
模型下载直接在在Hugging Face
上下载就是了。模型地址:https://huggingface.co/models
“
注意:推荐下载
GGUF
文件格式的模型,可以快速简洁的导入Ollama
中。有了gguf
格式的模型文件这样就不需要通过llama.cpp
项目进行模型格式转换了。
删除模型
如果需要删除一个本地的模型,可以使用ollama rm
命令。这将从您的本地环境中删除名为my-model
的模型。
ollama rm my-model
复制模型
您可以使用ollama cp命令复制一个模型,创建一个新的模型副本:
ollama cp original-model new-model
由于新岗位的生产效率,要优于被取代岗位的生产效率,所以实际上整个社会的生产效率是提升的。
但是具体到个人,只能说是:
“最先掌握AI的人,将会比较晚掌握AI的人有竞争优势”。
这句话,放在计算机、互联网、移动互联网的开局时期,都是一样的道理。
我在一线互联网企业工作十余年里,指导过不少同行后辈。帮助很多人得到了学习和成长。
我意识到有很多经验和知识值得分享给大家,也可以通过我们的能力和经验解答大家在人工智能学习中的很多困惑,所以在工作繁忙的情况下还是坚持各种整理和分享。但苦于知识传播途径有限,很多互联网行业朋友无法获得正确的资料得到学习提升,故此将并将重要的AI大模型资料包括AI大模型入门学习思维导图、精品AI大模型学习书籍手册、视频教程、实战学习等录播视频免费分享出来。
该阶段让大家对大模型 AI有一个最前沿的认识,对大模型 AI 的理解超过 95% 的人,可以在相关讨论时发表高级、不跟风、又接地气的见解,别人只会和 AI 聊天,而你能调教 AI,并能用代码将大模型和业务衔接。
该阶段我们正式进入大模型 AI 进阶实战学习,学会构造私有知识库,扩展 AI 的能力。快速开发一个完整的基于 agent 对话机器人。掌握功能最强的大模型开发框架,抓住最新的技术进展,适合 Python 和 JavaScript 程序员。
恭喜你,如果学到这里,你基本可以找到一份大模型 AI相关的工作,自己也能训练 GPT 了!通过微调,训练自己的垂直大模型,能独立训练开源多模态大模型,掌握更多技术方案。
到此为止,大概2个月的时间。你已经成为了一名“AI小子”。那么你还想往下探索吗?
对全球大模型从性能、吞吐量、成本等方面有一定的认知,可以在云端和本地等多种环境下部署大模型,找到适合自己的项目/创业方向,做一名被 AI 武装的产品经理。
学习是一个过程,只要学习就会有挑战。天道酬勤,你越努力,就会成为越优秀的自己。
如果你能在15天内完成所有的任务,那你堪称天才。然而,如果你能完成 60-70% 的内容,你就已经开始具备成为一名大模型 AI 的正确特征了。
保证100%免费
】Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。