【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.mzph.cn/pingmian/28368.shtml

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

相关文章

【算法题】搜索二维矩阵,一文彻底弄会!

目录 一、题目描述 二、解题思路 1、引言 2、思路推导过程 三、参考答案 一、题目描述 搜索二维矩阵 给你一个满足下述两条属性的 m x n 整数矩阵: 每行中的整数从左到右按非严格递增顺序排列。每行的第一个整数大于前一行的最后一个整数。 给你一个整数…

【C++】多态|原理|override|final|抽象类|多继承虚函数表|对象模型|虚表打印|(万字详解版)

目录 ​编辑 一.多态的概念 二.多态的构建 虚函数 重写 虚函数重写的例外 协变 隐藏 析构函数的重写 三.重载、重写(覆盖)、隐藏(重定义)的对比 四.C11新增的 override 和 final override final 五.抽象类 六.多态的原理 虚函数表 总结: 引用…

非常好用的7个Vue3组件库!!【送源码】

说到Vue,怎能不提Vue3呢? 它的大名鼎鼎主要归功于一项革命性的创新——Composition API。 这个新功能为逻辑复用带来了前所未有的友好性和灵活性,让开发者们在构建应用时如鱼得水。 如果你现在正在使用Vue3,或者在新的一年考虑…

浏览器上直接运行近 1000个 AI 模型!

今天推荐的开源项目叫做 tansformers.js,这是一个不需要服务器端,能让你在浏览器上使用到自然语言处理、计算机视觉等 AI 能力的开源项目。由 xenova 开源,transformers.js 已经在 GitHub 上获得了超过 9.2K 颗星星。 项目简介 transformers.…

JVM如何确定方法调用

方法调用并不等同于方法执行,方法调用阶段唯一的任务就是确定调用哪一个方法,不涉及方法内部的具体运行过程。在程序运行时,进行方法调用是最普遍、最频繁的操作,但Class文件的编译过程中不包含传统编译中的连接步骤,一…

医学人工智能项目如何申请基金?

小罗碎碎念 本期推文面向的群体 青年教师有志硕博/博后 尤其适合一直认真追小罗推文的老师/同学,你们会发现自己在看这篇推文的时候,遇到自己领域的项目时,文思如泉涌,仿佛马上就能把本子写好,哈哈。(运用…

命令词:引导行动的语言工具

人不走空 🌈个人主页:人不走空 💖系列专栏:算法专题 ⏰诗词歌赋:斯是陋室,惟吾德馨 目录 🌈个人主页:人不走空 💖系列专栏:算法专题 ⏰诗词歌…

App UI 风格打造独特体验

App UI 风格打造独特体验

通过Stream流对集合进行操作

Stream Api是JDK8提供的新特性,可以更为方便地对集合进行操作,比如我今天遇到的一个场景: 将本地的一个视频文件分成多块上传到Minio服务器,现在上传功能已经完成,需要调用minioClient对已经上传的文件重新合并成一个新…

8086汇编 add指令学习

ADD,是Intel x86平台的汇编加法指令,MEM代指操作数为内存或寄存器,REG代指操作数为寄存器,IMM代指立即数,SEG代指操作数为段寄存器。 形式和示例如下; ADD MEM8,REG8 ADD DS:[BXSI],AL ADD MEM16,R…

【ARM Coresight Debug 系列 -- ARMv8/v9 Watchpoint 软件实现地址监控详细介绍】

请阅读【嵌入式开发学习必备专栏 】 文章目录 ARMv8/v9 Watchpoint exceptionsWatchpoint 配置信息读取Execution conditionsWatchpoint data address comparisonsSize of the data accessWatchpoint 软件配置流程Watchpoint Type 使用介绍WT, Bit [20]: Watchpoint TypeLBN, B…

vue技巧(十)全局配置使用(打包后可修改配置文件)

1、背景 vue打包目前主流用的有webpack和vite两种,默认用的webpack。(二者的区别大家可以各自上网查,我没用过vite,所以不过多介绍)vue通过webpack打包后,源码会被压缩,但一些关键配置可…

【新课程】PICO VR 交互开发指南

从PICO开始,迈向XR跨平台开发 Unity XR Interaction Toolkit (简称XRI)是一套跨平台的 XR 交互开发工具包,随着版本的更新与完善,逐渐获得了开发者的青睐。各 XR 平台逐步推荐开发者采用 XRI 作为首选的交互开发工具为…

Pytest框架中fixture功能详解

文章目录 1 定义 Fixture函数 2 Fixture 的函数参数 2.1 传入其他fixture函数作为参数 2.2 传入request对象参数 示例1:访问fixture的调用者 示例2:使用fixture的参数 3 Fixture 的作用域参数scope 3.1 scopeclass场景 3.2 scopesession场景 4…

SwiftUI 6.0(iOS 18)新容器视图修改器漫谈

概览 本届 WWDC 2024 观影正如火如荼的进行中,一片鸟语花香、枝繁叶茂的苹果树上不时结出几颗令人垂涎欲滴的美味苹果让秃头码农们欲罢不能。 如您所愿,在界面布局“利器” SwiftUI 这根蔓藤也长出不少喜人的果实,其中在 iOS 18.0 中新添加的…

rabbitMQ的简单使用

rabbitMQ的介绍 RabbitMQ是一个开源的消息代理和队列服务器,主要用于在不同的应用程序之间传递消息。它基于AMQP(Advanced Message Queuing Protocol)协议,提供了一种可靠的方式来处理异步通信。RabbitMQ使用Erlang语言编写&…

springboot 整合redis问题,缓存击穿,穿透,雪崩,分布式锁

boot整合redis 压力测试出现失败 解决方案 排除lettuce 使用jedis <!-- 引入redis --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId><exclusions><exclus…

内存泄漏 内存溢出

概念 内存泄漏&#xff1a;是程序没有正确的释放已分配的内存&#xff0c;造成系统内存的浪费。内存泄漏很难发现&#xff0c;因为他不会直接导致程序崩溃&#xff0c;而是会慢慢降低程序的性能。 内存溢出&#xff1a;系统中存在无法回收的内存或使用的内存过多&#xff0c;…

【linux-imx6ull-定时器与中断】

目录 1. 前言2. Linux软件定时器2.1 内核频率选择2.2 重要的API函数2.3 Linux软件定时器的使用配置流程 4. Linux中断4.1 简单中断使用4.1.1 简要说明4.1.2 重要的API函数4.1.3 中断的简要配置流程 4.2. 中断的上半部和下半部4.2.1 tasklet实现下半部4.2.2 work实现下半部 1. 前…

MySQL数据操作与查询- 聚合函数和分组查询

一、聚合函数 聚合函数主要用来进行数据 汇总 。 1、sum 返回选取的某列的总和。 语法&#xff1a; select sum(字段名) from 表名 where 条件表达式 2、max 返回选取的某列的最大值。 语法&#xff1a; select max(字段名) from 表名 where 条件表达式 3、min 返…