【AI实践】Ollama本地安装大模型服务

Ollama安装运行

安装与配置

Download Ollama

安装默认在C盘,成功后,window任务栏图标会有Ollama Logo

为了不占用C盘更大的空间,修改模型下载路径,修改环境变量

下载模型

由于我电脑是第六代Intel,集显,没有独立显卡;这里选择3B比较小的模型,防止模型太大响应太慢;

在Window系统的PowerShell软件,或者Windows Terminal中输入命令

ollama run phi3

此处使用微软的phi3模型,3B的版本,2.4GB大小;

下载完成

首次安装完成,就进入了,运行模型的窗口

后续运行模型

PS C:\Users\iamlv> ollama run phi3
>>> 

回复速度如下图

另外安装运行模型llama3, 7B版本

PS C:\Users\iamlv> ollama run llama3
>>> 

网页界面交互

open WebUI提供web网页

open WebUI的安装有很多方法,如下文,推荐docker容器安装,

🚀 Getting Started | Open WebUI

安装docker Windows 桌面版

PS C:\Users\iamlv> docker version
Client:Cloud integration: v1.0.35+desktop.13Version:           26.1.1API version:       1.45Go version:        go1.21.9Git commit:        4cf5afaBuilt:             Tue Apr 30 11:48:43 2024OS/Arch:           windows/amd64Context:           defaultServer: Docker Desktop 4.30.0 (149282)Engine:Version:          26.1.1API version:      1.45 (minimum version 1.24)Go version:       go1.21.9Git commit:       ac2de55Built:            Tue Apr 30 11:48:28 2024OS/Arch:          linux/amd64Experimental:     falsecontainerd:Version:          1.6.31GitCommit:        e377cd56a71523140ca6ae87e30244719194a521runc:Version:          1.1.12GitCommit:        v1.1.12-0-g51d5e94docker-init:Version:          0.19.0GitCommit:        de40ad0

在docker下载open Web UI的镜像,注意Ollama不在你电脑和使用Nvidia GPU驱动Open WebUI的情况;

docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main
PS C:\Users\iamlv> docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main
Unable to find image 'ghcr.io/open-webui/open-webui:main' locally
main: Pulling from open-webui/open-webui
2cc3ae149d28: Pull complete
87c0edd565e2: Pull complete
3df7545512d5: Pull complete
8f26d42ebf67: Pull complete
8951c7adce45: Pull complete
e68b3f3b28fc: Pull complete
4f4fb700ef54: Pull complete
04910e925ba2: Pull complete
e00576178709: Pull complete
7b74341f8bd7: Pull complete
46aff8bb649e: Pull complete
d2f7110849c1: Pull complete
672fa8e030d8: Pull complete
90d4d9484fcc: Pull complete
4889567b5c13: Pull complete
4ec90e217655: Pull complete
Digest: sha256:0fa56a9d947413cba22e4029df88e8c47acc78c013f68df303619ed05e45d9cf
Status: Downloaded newer image for ghcr.io/open-webui/open-webui:main
47b3c067e2d2b254336194add3431dd151664c8d4095f3ae4f5b3b5fb7acf139
PS C:\Users\iamlv>

测试一个英语题和翻译解读

总结

  1. 纯CPU运行(8核),3B速度较快(和人阅读接近),7B左右的模型,延迟可以接受;
  2. 3B 7B,指令遵循能力更准确;7B 的对话承前启后的接话能力更好
    1. 以英文完型填空为例,3B模型默认会给答案,让他不要给,还是会给;
    2. 7B对话前会有一个偏感性的反馈;最后可能会追问 

 ollama run phi3
>>> help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct optionThe cat sat patiently on the mat, waiting for its owner to return home. What does "patiently" mean?A) Without any noise
B) With great speed
C) In a calm and still manner
D) In an aggressive wayThe correct answer is: C) In a calm and still manner>>> help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option. do
... not give me the answer. let me answer first.During their weekend retreat, the family decided to engage in an activity that would foster unity and encourage
open communication among its members. What does "foster" mean?A) To hinder or prevent
B) To promote growth or development
C) To disconnect or distance oneself from
D) To repeat actions without variationThe correct answer is: B) To promote growth or development>>> help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option. ddo
... not give me the correct answer. let me answer first.The philosopher's writings were renowned for their ability to provoke profound reflection and challenge
conventional wisdom. What does "provocative" mean?A) Tending to soothe or pacify
B) Having a tendency to cause annoyance or irritation
C) Capable of inducing deep thought or strong emotions, often controversially
D) Lacking in stimulation or interestThe correct answer is: C) Capable of inducing deep thought or strong emotions, often controversially>>> give me another sentence, donot tell the correct answerThe diplomat's speech was lauded for its eloquence and persuasive power in swaying international opinions. What
does "eloquent" mean?A) Lacking clarity or precision in expression
B) Characterized by a high level of articulation and effectiveness in communication
C) Filled with errors and unclear language
D) Of little importance or influenceThe correct answer is: B) Characterized by a high level of articulation and effectiveness in communication>>> /bye
PS C:\Users\iamlv> ollama run llama3
>>> help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option. ddo
... not give me the correct answer. let me answer first.
I'd be happy to help you study vocabulary. Here's your sentence:The new employee was _______________________ by her coworkers from day one.You can choose from the following options:A) intimidated
B) impressed
C) confused
D) frustratedGo ahead and fill in the blank with the option you think is correct!>>> D
Interesting choice!Here's another sentence for you to try:The tourists got _______________________ when they saw the famous landmark looming above them.You can choose from the following options:A) awestruck
B) annoyed
C) exhausted
D) excitedWhat's your answer?>>> D
Another choice!Here's another sentence for you to try:The teacher encouraged her students to _______________________ their creative writing skills.You can choose from the following options:A) develop
B) demonstrate
C) illustrate
D) improvise>>> D. till now I answered 3 question, are these answer all correct ?
Let me check!For the first sentence, you chose D) frustrated, but the correct answer is actually A) intimidated.For the second sentence, you chose D) excited, which is... CORRECT! Well done!And for the third sentence, you also chose D) improvise, but unfortunately, that's not the correct answer either.
The correct answer is actually A) develop.So, out of three questions, one was correct and two were incorrect. Not bad, though! You're still learning, and
that's what matters!Keep going?>>> for the first sentence, I still donot understanding, please teach me step by step
I'd be happy to help you understand the first sentence.Here's the original sentence:The new employee was _______________________ by her coworkers from day one.You chose D) frustrated, but let's break it down step by step:1. **"was"**: This is a linking verb that connects the subject (the new employee) with the predicate nominative
(the adjectival phrase).
2. **"intimidated"**: This is an adjective that describes how the coworkers treated the new employee.
3. **"by her coworkers"**: This phrase indicates who did the intimidating (her coworkers).
4. **"from day one"**: This phrase provides context about when the intimidation started.Now, think about what it means to be "intimidated"...* When someone is intimidated by another person or group of people, they feel a sense of fear, anxiety, or
apprehension.
* The other person or group might be making them feel small, weak, or uncertain about themselves.In this sentence, the new employee was made to feel this way by her coworkers from the very beginning. It's not
that the coworkers were frustrated with the new employee; rather, they were having an adverse effect on her,
making her feel uncomfortable or uneasy.So, the correct answer is A) intimidated.Does this explanation help clarify things for you?>>> Send a message (/? for help)

附录

PS C:\Users\jacob> ollama -h
Large language model runnerUsage:ollama [flags]ollama [command]Available Commands:serve       Start ollamacreate      Create a model from a Modelfileshow        Show information for a modelrun         Run a modelpull        Pull a model from a registrypush        Push a model to a registrylist        List modelsps          List running modelscp          Copy a modelrm          Remove a modelhelp        Help about any commandFlags:-h, --help      help for ollama-v, --version   Show version informationUse "ollama [command] --help" for more information about a command.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/351886.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Linux DNS域名解析

DNS系统的作用及类型 整个 Internet 大家庭中连接了数以亿计的服务器、个人主机,其中大部分的网站、邮件等服务器都使用了域名形式的地址,如www.google.com、mail.163.com 等。很显然这种地址形式要比使用 64.233.189.147、202.108.33.74的IP地址形式更…

H5小程序视频编辑解决方案,广泛适用,灵活部署

如何在微信小程序、网页、HTML5等WEB场景中实现轻量化视频制作,满足多样化的运营需求,一直是企业面临的挑战。美摄科技凭借其在视频编辑领域的深厚积累和创新技术,为企业量身打造了一套H5/小程序视频编辑解决方案,助力企业轻松应对…

C语言学习系列:初识C语言

前言,C语言是什么 语言,比如中文、英语、法语、德语等,是人与人交流的工具。 C语言也是语言,不过是一种特殊的语言,是人与计算机交流的工具。 为什么叫C语言呢? 这就要从C语言的历史说起了。 一&#…

做好程序前设计

不要小看任何一道编程题目!一定一定一定要想好之后再动手!!! 带上你的草稿本!!!!!!!!!!!&#xf…

Spring和SpringBoot(概述与功能)

目录 一、SpringBoot 概念 (1)基本介绍 (2)部分注解 (3)其它介绍 ​编辑 二、 Spring 缺点 (1)配置繁琐 (2)依赖繁琐 三、SpringBoot 功能&#xff0…

【ARM】MDK出现报错error: A\L3903U的解决方法

【更多软件使用问题请点击亿道电子官方网站】 1、 文档目标 解决MDK出现报错error: A\L3903U这样类型的报错 2、 问题场景 电脑或者软件因为意外情况导致崩溃,无法正常关闭,强制电脑重启之后,打开工程去编译出现下面的报错信息(…

盘点有趣的人工智能开源项目一

字幕导出 zh_recogn是一个专注于中文语音识别的字幕生成工具,基于魔塔社区Paraformer模型。它不仅支持音频文件,还能处理视频文件,输出标准的SRT字幕格式。这个项目提供了API接口和简单的用户界面,使得用户可以根据自己的需求灵活…

探索C嘎嘎的奇妙世界:第三关---缺省参数与函数重载

在c语言中,我们常常在对有参函数进行传参,这样的繁琐过程,C祖师爷对此进行了相关改进,多说无益,上干货: 1 缺省参数: 缺省参数是指在声明或定义函数时为函数的形参指定一个默认值(默认参数)。在调用该函数时,如果没有指定实参,则…

Qt实现单例模式:Q_GLOBAL_STATIC和Q_GLOBAL_STATIC_WITH_ARGS

目录 1.引言 2.了解Q_GLOBAL_STATIC 3.了解Q_GLOBAL_STATIC_WITH_ARGS 4.实现原理 4.1.对象的创建 4.2.QGlobalStatic 4.3.宏定义实现 4.4.注意事项 5.总结 1.引言 设计模式之单例模式-CSDN博客 所谓的全局静态对象,大多是在单例类中所见,在之前…

高端品牌网站建设

随着互联网的快速发展,越来越多的企业开始意识到高端品牌网站建设对于企业发展的重要性。高端品牌网站建设不仅是企业形象展示的窗口,更是与消费者进行有效沟通和互动的桥梁。下面从设计、内容和用户体验三个方面,探讨高端品牌网站建设的重要…

计算机毕业设计Django+Vue.js考研推荐系统 考研分数线预测 中公考研爬虫 混合神经网络推荐算法 考研可视化 机器学习 深度学习 大数据毕业设计

Python数据分析与可视化期末项目报告 项目名称: 考研推荐系统数据分析与可视化 学 号: 姓 名: …

hadoop/hive/DBeaver启动流程

hadoop 启动 cd到指定目录下 cd /opt/module/hadoop-3.3.0/sbin/启动文件 ./start-all.shjps一下,查看显示的内容 应该显示以下内容 NameNode SecondaryNameNode DataNode ResourceManager NodeManager如果缺少namenode,那么执行 rm -rf /tmp/hadoo…

MicroPython+ESP32 C3开发上云

传感器PinI/O状态D412输出1开0关D513输出1开0关 概述 MicroPython是python3编程语言的精简实现,能够在资源非常有限的硬件上运行,如MCU微控制器Micropython的网络功能和计算功能很强大,有非常多的库可以使用,它为嵌入式开发带来了…

react传参有哪些常用方法?--Props,Context API和Redux全局管理

在 React 中,父子组件之间的传参主要通过以下几种方式实现: 1) Props 传递:父子传参 2)Context API: 跨多层组件传递数据 3) Redux: 全局状…

计算机网络 —— 运输层(运输层概述)

计算机网络 —— 运输层(运输层概述) 运输层运输层端口号复用分用复用(Multiplexing)分用(Demultiplexing) 常用端口号页面响应流程 我们今天进入到运输层的学习: 运输层 我们之前学习的物理层…

pytorch基础

文章目录 一、环境准备1.1安装Anaconda1.2创建虚拟环境1.3准备CUDA1.4安装pytorch1.3安装Pycharm 二、全连接神经网络原理2.1整体结构2.2神经单元2.3激活函数2.3.1非线性性2.3.2Sigmoid函数2.3.3Tanh函数2.3.4ReLU函数2.3.5Leaky ReLU函数 2.4前向传播2.5损失函数与反向传播2.5…

5G智能运维趋势

随着5G技术的普及,网络运维面临着前所未有的复杂性和数据量挑战。智能运维通过人工智能、大数据分析、自动化工具等技术,为5G网络提供了高效的管理和优化手段。在网络性能优化、故障预测与管理、资源动态调度、安全管理和网络切片管理等方面,…

Python 全栈系列250 数据流实践

说明 之前好几个企业都提过飞机在飞的时候换发动机的例子,来比喻变革是多么无奈和危险。还有的说法更直接:不变等死,变就是找死,总得选一样。 后来我自己的体会也差不多是这样,总有一些窘境让你抉择:是忽忽…

[Shell编程学习路线]——if条件语句(单,双,多分支结构)详细语法介绍

🏡作者主页:点击! 🛠️Shell编程专栏:点击! ⏰️创作时间:2024年6月17日7点50分 🀄️文章质量:95分 文章目录 ————前言———— 💯趣站&#x1f4af…

Python 显示笔记本电脑的电池状态和百分比

方法一: import psutil import psutil battery psutil.sensors_battery() if battery is None:print("No battery is found.")exit() print (battery) percentagebattery.percent print(f"Battery Percentage: {percentage}%")Battery的信息…