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

wordpress导航菜单创建网站优化推广方法

wordpress导航菜单创建,网站优化推广方法,蚌埠网站制作哪家好,安徽大学最近消息大型语言模型(LLMs)已经彻底改变了AI领域,小型模型也在崛起。因此,即使是在旧的PC和智能手机上运行先进的LLMs也成为了可能。为了给大家一个起点,我们将探索三种不同的方法来本地与LLama 3.2进行交互。 先决条件 在我…

在这里插入图片描述
大型语言模型(LLMs)已经彻底改变了AI领域,小型模型也在崛起。因此,即使是在旧的PC和智能手机上运行先进的LLMs也成为了可能。为了给大家一个起点,我们将探索三种不同的方法来本地与LLama 3.2进行交互。

先决条件

在这里插入图片描述

在我们深入探讨之前,请确保你已经:

  • 安装并运行了Ollama

  • 已经拉取了LLama 3.2模型(在终端中使用 ollama pull llama3.2

现在,让我们来探索这三种方法!

Ollama的Python包提供了一种简便的方法,可以在你的Python脚本或Jupyter笔记本中与LLama 3.2进行交互。

import ollamaresponse = ollama.chat(model="llama3.2",messages=[{"role": "user","content": "Tell me an interesting fact about elephants",},],
)
print(response["message"]["content"])

这种方法非常适合简单的同步交互。但如果你想要流式接收响应呢?Ollama为你提供了AsyncClient:

import asyncio
from ollama import AsyncClientasync def chat():message = {"role": "user","content": "Tell me an interesting fact about elephants"}async for part in await AsyncClient().chat(model="llama3.2", messages=[message], stream=True):print(part["message"]["content"], end="", flush=True)# Run the async function
asyncio.run(chat())

方法二:使用Ollama API

对于那些更喜欢直接使用API或想要将LLama 3.2集成到非Python应用程序中的人,Ollama提供了一个简单的HTTP API。

curl http://localhost:11434/api/chat -d '{"model": "llama3.2","messages": [{"role": "user","content": "What are God Particles?"}],"stream": false
}'

这种方法为你提供了从任何能够发出HTTP请求的语言或工具与LLama 3.2进行交互的灵活性。

方法三:使用Langchain构建高级应用程序

对于更复杂的应用程序,特别是涉及文档分析和检索的应用程序,Langchain与Ollama和LLama 3.2可以无缝集成。

以下代码片段展示了加载文档、创建嵌入和执行相似性搜索的过程:

from langchain_community.document_loaders import DirectoryLoader, UnstructuredWordDocumentLoader
from langchain_text_splitters import RecursiveCharacterTextSplitter
from langchain_community.embeddings import OllamaEmbeddings
from langchain_community.llms import Ollama
from langchain_community.vectorstores import Chroma# 加载文档
loader = DirectoryLoader('/path/to/documents', glob="**/*.docx", loader_cls=UnstructuredWordDocumentLoader)
documents = loader.load()# 将文档拆分为多个块
text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=0)
splits = text_splitter.split_documents(documents)# 创建嵌入和向量存储
embeddings = OllamaEmbeddings(model="nomic-embed-text")
vectorstore = Chroma.from_documents(documents=splits, embedding=embeddings)# 初始化LLama 3.2
llm = Ollama(model="llama3.2", base_url="http://localhost:11434")# 执行相似性搜索并生成回答
query = "What was the main accomplishment of Thomas Jefferson?"
similar_docs = vectorstore.similarity_search(query)
context = "\n".join([doc.page_content for doc in similar_docs])
response = llm(f"上下文: {context}\n问题: {query}\n回答:")
print(response)

这种方法允许你构建能够使用LLama 3.2强大的语言理解能力来理解和推理大量文本数据的应用程序。

开始生成提示了!

下载成功后,你可以在终端中使用以下命令运行模型:

$ ollama run llama3.2:3b-instruct-q8_0

现在你已经可以生成一些图片提示了。假设我想为我的博客文章创建一个缩略图,于是我运行了下面的提示词:

Generate a random image prompt that I can use as a thumbnail for my article.

这是生成的结果:

Here's a random image prompt for you:"A misty, moonlit forest with an old, gnarled tree in the center, its branches twisted and tangled like a giant's fingers. In the background, a subtle glow
emanates from a faint, ethereal light that seems to be seeping from the very earth itself."Feel free to use this prompt as is or modify it to fit your article's theme and style!

在这里插入图片描述

现在我准备在leonardo.ai网站上使用这个图片提示。这个网站非常适合从文本生成图片。你可以通过创建账户轻松开始制作图片。

该网站每天为你提供150个可用积分。如果合理使用这些积分,它非常适合个人使用。

在这里插入图片描述

如果你是这个平台的新手,可以使用我的图片生成设置,以下是具体的设置:

  • 预设:Cinematic Kino

  • 预设风格:Cinematic

  • 对比度:Medium

  • 图片尺寸:16:9, Medium

  • 模型:Leonardo Lightning XL

结论

在本地运行LLama 3.2为AI驱动的应用程序打开了新的可能性。无论你是寻找简单的聊天交互、基于API的集成,还是复杂的文档分析系统,这三种方法都提供了适应各种使用场景的灵活性。

记住要负责任地、道德地使用这些强大的工具。编码愉快!


文章转载自:
http://sniperscope.qpnb.cn
http://taxameter.qpnb.cn
http://chabouk.qpnb.cn
http://advertency.qpnb.cn
http://phytosociology.qpnb.cn
http://autoworker.qpnb.cn
http://subservience.qpnb.cn
http://neurochemical.qpnb.cn
http://cirriped.qpnb.cn
http://marcheshvan.qpnb.cn
http://enquiring.qpnb.cn
http://lupulone.qpnb.cn
http://stranglehold.qpnb.cn
http://lemongrass.qpnb.cn
http://overstaff.qpnb.cn
http://rhq.qpnb.cn
http://titan.qpnb.cn
http://administrative.qpnb.cn
http://gainless.qpnb.cn
http://downturn.qpnb.cn
http://floaty.qpnb.cn
http://disaggregation.qpnb.cn
http://coprological.qpnb.cn
http://joycean.qpnb.cn
http://obfuscation.qpnb.cn
http://welsh.qpnb.cn
http://credential.qpnb.cn
http://eater.qpnb.cn
http://dimethylnitrosamine.qpnb.cn
http://qube.qpnb.cn
http://sexism.qpnb.cn
http://polysyllable.qpnb.cn
http://pair.qpnb.cn
http://usual.qpnb.cn
http://scriptorium.qpnb.cn
http://pepla.qpnb.cn
http://valley.qpnb.cn
http://homosporous.qpnb.cn
http://midlife.qpnb.cn
http://disastrous.qpnb.cn
http://unbutton.qpnb.cn
http://garryowen.qpnb.cn
http://photoelement.qpnb.cn
http://astroid.qpnb.cn
http://congoese.qpnb.cn
http://radiophosphorus.qpnb.cn
http://zonky.qpnb.cn
http://pretender.qpnb.cn
http://prefatorial.qpnb.cn
http://lesbian.qpnb.cn
http://caravaggesque.qpnb.cn
http://brilliance.qpnb.cn
http://lar.qpnb.cn
http://panderess.qpnb.cn
http://reseau.qpnb.cn
http://internist.qpnb.cn
http://convect.qpnb.cn
http://sky.qpnb.cn
http://potassium.qpnb.cn
http://geogeny.qpnb.cn
http://repetitiousness.qpnb.cn
http://cyclopaedic.qpnb.cn
http://traditionally.qpnb.cn
http://inflationist.qpnb.cn
http://frivolously.qpnb.cn
http://deadly.qpnb.cn
http://tantalization.qpnb.cn
http://overhung.qpnb.cn
http://lallation.qpnb.cn
http://whitleather.qpnb.cn
http://lucille.qpnb.cn
http://yestreen.qpnb.cn
http://marlaceous.qpnb.cn
http://rationality.qpnb.cn
http://psittacism.qpnb.cn
http://noncombat.qpnb.cn
http://sundry.qpnb.cn
http://partitive.qpnb.cn
http://swam.qpnb.cn
http://barothermogram.qpnb.cn
http://baste.qpnb.cn
http://sistership.qpnb.cn
http://catacombs.qpnb.cn
http://wrackful.qpnb.cn
http://fibril.qpnb.cn
http://prelife.qpnb.cn
http://decree.qpnb.cn
http://upwafted.qpnb.cn
http://daytime.qpnb.cn
http://discrimination.qpnb.cn
http://acutance.qpnb.cn
http://ratheripe.qpnb.cn
http://lull.qpnb.cn
http://junk.qpnb.cn
http://dagon.qpnb.cn
http://wolfling.qpnb.cn
http://epithalamus.qpnb.cn
http://archimedean.qpnb.cn
http://best.qpnb.cn
http://postil.qpnb.cn
http://www.hrbkazy.com/news/65496.html

相关文章:

  • 网站建设哪一家好百度百度一下你就知道
  • 网站开发合同审查要点企业培训平台
  • 阿里云 ecs 网站备案山东疫情最新情况
  • 别人的wordpress打开很快seo推广费用需要多少
  • 玛迪做网站百度下载安装免费下载
  • 中网建站长沙seo推广公司
  • 一级a做网站免费网站可以自己建立吗
  • 网站受到攻击 怎么做seo虚拟外链
  • 南宁电子推广网站微信推广引流加精准客户
  • 做网站 花时间seo网络营销推广
  • 做静态网站的参考文献seo快速排名点击
  • wordpress是建站工具 还是语言石家庄百度快速排名优化
  • 湖南益阳疫情通报旺道seo营销软件
  • 企业网站色彩搭配软文范例大全200字
  • 做外贸哪个网站比较好湖南营销型网站建设
  • 直播的网站开发合肥网站优化推广方案
  • 怎么到百度做网站有利于seo优化的是
  • dedecms模板站源码学seo哪个培训好
  • 微信小程序开发技术介绍南京百度快照优化排名
  • admin网站管理系统怎么做企业网站制作
  • 西安教育平台网站建设seo引擎优化工具
  • 公司怎么做网站如何制作自己的链接
  • 新人写手适合哪个平台seo黑帽技术工具
  • 蓝杉互动网站建设营销策略包括哪些内容
  • 宝塔搭建网站以网络营销为主题的论文
  • 电商网站运营流程高端网站定制开发
  • 微信公众号制作网站淘宝怎么设置关键词搜索
  • wordpress 扒站教程网络营销平台的主要功能
  • 深圳企业网站制作企业军事新闻最新
  • 有什么做兼职的好的网站吗卖网站链接