ollama一、ollama下载地址二、ollama拉取模型三、模型部署1、deepseek模型部署2、千问模型部署四、模型运行五、ollama API六、编程1、ollama client2、Ollama Langchain一、ollama下载地址ollama官网下载地址# 检查ollama版本号ollama--version二、ollama拉取模型# 官方仓库ollama pull llama3.2# 直接用huggingface上的模型ollama pull hf.co/Qwen/Qwen2-7B-Instruct-GGUF:Q4_K_M# 使用魔搭社区的模型ollama pull modelscope.cm/Qwen/Qwen/Qwen2.5-3B-Instruct-GGUF# 查看当前拉取了哪些模型ollamals三、模型部署1、deepseek模型部署ollama run deepseek-r1# 1.5b模型ollama run deepseek-r1:1.5b# 14b模型ollama run deepseek-r1:14b备注deepseek v3模型在个人电脑很难部署运行推荐使用deepseek的R模型2、千问模型部署# 默认7b模型按需选择ollama run qwen2.5 ollama run qwen2.5:0.5b ollama run qwen2.5:14b四、模型运行ollama run llama3.2 ollama run qwen2.5五、ollama API# generate ,windows流式输出不长时间卡顿体验感更好curlhttp://localhost:11434/api/generate-d{\model\:\llama3.2\,\prompt\:\天空为什么是蓝的?\}# generate ,关闭流式输出curlhttp://localhost:11434/api/generate-d{\model\:\llama3.2\,\prompt\:\天空为什么是蓝的?\,\stream\:false}# chatcurlhttp://localhost:11434/api/chat-d{\model\:\llama3.2\,\messages\: [{\role\:\user\,\content\:\天空为什么是蓝的?\}]}# 嵌入模型curlhttp://localhost:11434/api/embed-d{\model\:\mxbai-embed-large\,\input\:\Why is the sky blue?\}六、编程1、ollama clientimportollama responseollama.chat(modelllama3.2,messages[{role:user,content:Why is the sky blue?,},])print(response[message][content])2、Ollama Langchain#pip install -qU langchain-ollamafromlangchain_ollamaimportChatOllamadeftest_qwen():llmChatOllama(modelllama3.2,temperature0)query上海天气如何resultllm.invoke([(user,query)])print(result)
【ollama部署】
ollama一、ollama下载地址二、ollama拉取模型三、模型部署1、deepseek模型部署2、千问模型部署四、模型运行五、ollama API六、编程1、ollama client2、Ollama Langchain一、ollama下载地址ollama官网下载地址# 检查ollama版本号ollama--version二、ollama拉取模型# 官方仓库ollama pull llama3.2# 直接用huggingface上的模型ollama pull hf.co/Qwen/Qwen2-7B-Instruct-GGUF:Q4_K_M# 使用魔搭社区的模型ollama pull modelscope.cm/Qwen/Qwen/Qwen2.5-3B-Instruct-GGUF# 查看当前拉取了哪些模型ollamals三、模型部署1、deepseek模型部署ollama run deepseek-r1# 1.5b模型ollama run deepseek-r1:1.5b# 14b模型ollama run deepseek-r1:14b备注deepseek v3模型在个人电脑很难部署运行推荐使用deepseek的R模型2、千问模型部署# 默认7b模型按需选择ollama run qwen2.5 ollama run qwen2.5:0.5b ollama run qwen2.5:14b四、模型运行ollama run llama3.2 ollama run qwen2.5五、ollama API# generate ,windows流式输出不长时间卡顿体验感更好curlhttp://localhost:11434/api/generate-d{\model\:\llama3.2\,\prompt\:\天空为什么是蓝的?\}# generate ,关闭流式输出curlhttp://localhost:11434/api/generate-d{\model\:\llama3.2\,\prompt\:\天空为什么是蓝的?\,\stream\:false}# chatcurlhttp://localhost:11434/api/chat-d{\model\:\llama3.2\,\messages\: [{\role\:\user\,\content\:\天空为什么是蓝的?\}]}# 嵌入模型curlhttp://localhost:11434/api/embed-d{\model\:\mxbai-embed-large\,\input\:\Why is the sky blue?\}六、编程1、ollama clientimportollama responseollama.chat(modelllama3.2,messages[{role:user,content:Why is the sky blue?,},])print(response[message][content])2、Ollama Langchain#pip install -qU langchain-ollamafromlangchain_ollamaimportChatOllamadeftest_qwen():llmChatOllama(modelllama3.2,temperature0)query上海天气如何resultllm.invoke([(user,query)])print(result)