百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 技术分类 > 正文

手机也能跑大模型?DeepSeek-r1 部署教程来了!

ztj100 2025-07-23 19:26 2 浏览 0 评论

现在,大家用手机的时间越来越长,对隐私安全的关注也越来越高。各大厂商也在琢磨,怎么才能让大模型直接跑在手机上。这几天写文章时,发现不少小伙伴都在问:怎么在手机上部署 DeepSeek?

既然大家都感兴趣,那今天就把我之前折腾的部署步骤整理出来,分享给大家,希望能帮到你!

在 Android 手机上运行 LLM****安装指南

1. 安装 Termux 应用

安装有两种方法,如果第一种能用,别浪费时间试第二种。

  • 打开Termux GitHub Releases页面
  • 下载termux-app_v0.119.0-beta.1+apt-android-7-github-debug_arm64-v8a.apk。
  • 安装 APK 文件。

2. 运行 Ollama 服务器前的环境配置

打开 Termux 后,你会看到一个看起来像 Linux 终端的界面。接下来,我们需要配置 Ollama 运行环境。

  • 先授予存储权限:
termux-setup-storage

运行后,让 Termux 能够访问你的 Android 存储系统。执行后,系统会弹出“设置”应用,找到 Termux 并手动授予存储权限。

  • 更新软件包

在安装任何工具之前,先更新软件包,就像在 Linux 上做的那样:

pkg upgrade

执行后,如果提示Y/N,直接输入Y并回车。

  • 安装 Git、CMake 和 Golang

这些工具是下载和构建 Ollama 所必要依赖:

pkg install git cmake golang

3. 安装并构建 Ollama

  • clone Ollama GitHub 仓库

如果你经常使用 Termux,可以先进入你想安装 Ollama 的目录;否则,直接执行以下命令:

git clone --depth 1 https://github.com/ollama/ollama.git
  • 进入 Ollama 目录

下载完成后,切换到 Ollama 目录:

cd ollama
  • 生成 Go 代码并构建 Ollama

运行以下命令,先生成 Go 代码:

go generate ./..

然后编译 Ollama(这一步耗时比较久,需要一点耐心):

go build .

等待构建完成后,我们成功在手机上安装 Ollama!

4. 运行 DeepSeek 模型或其他小型模型(1B 或 2B 参数)

选择一个合适的模型

注意:参数超过 3B(30 亿)的模型在手机上运行太慢,甚至可能无法加载进显存,所以别折腾太大的模型。

进入Ollama模型库,寻找适合手机的小型语言模型(SLM,Small Language Models)。一旦找到合适的模型,就可以开始跑 本地模型 了!

在 Ollama 模型库 页面,你会看到一个“复制”按钮(如果用手机访问,看不到的话,切换到“桌面视图”模式)。点击复制,等会儿我们部署时可以用的上。

  • 下载并运行模型

这里以DeepSeek 1.5B模型为例,当然你可以选择其他模型,步骤都是一样的。

  • 运行 DeepSeek 1.5B 模型:
./ollama run deepseek-r1:1.5b --verbose

运行你自己选择的模型(如果你是选择其他模型时请输入对应的命令):

./<刚刚从 Ollama 官网复制的命令>

等待下载完成

这个命令会开始下载模型到你的手机上,请耐心等待。下载时间取决于你的网速,如果你用的是移动数据,确保至少还有 1.5GB 流量,否则容易翻车!

开始使用 LLM

下载完成后,Termux 终端里会出现交互界面,你可以像在 PC 上那样使用 LLM。不过别对性能抱太高期待,毕竟这是在手机上运行的“小型”模型,速度肯定比不上 ChatGPT。

相关推荐

10条军规:电商API从数据泄露到高可用的全链路防护

电商API接口避坑指南:数据安全、版本兼容与成本控制的10个教训在电商行业数字化转型中,API接口已成为连接平台、商家、用户与第三方服务的核心枢纽。然而,从数据泄露到版本冲突,从成本超支到系统崩溃,A...

Python 文件处理在实际项目中的困难与应对策略

在Python项目开发,文件处理是一项基础且关键的任务。然而,在实际项目中,Python文件处理往往会面临各种各样的困难和挑战,从文件格式兼容性、编码问题,到性能瓶颈、并发访问冲突等。本文将深入...

The Future of Manufacturing with Custom CNC Parts

ThefutureofmanufacturingisincreasinglybeingshapedbytheintegrationofcustomCNC(ComputerNumericalContro...

Innovative Solutions in Custom CNC Machining

Inrecentyears,thelandscapeofcustomCNCmachininghasevolvedrapidly,drivenbyincreasingdemandsforprecisio...

C#.NET serilog 详解(c# repository)

简介Serilog是...

Custom CNC Machining for Small Batch Production

Inmodernmanufacturing,producingsmallbatchesofcustomizedpartshasbecomeanincreasinglycommondemandacros...

Custom CNC Machining for Customized Solutions

Thedemandforcustomizedsolutionsinmanufacturinghasgrownsignificantly,drivenbydiverseindustryneedsandt...

Revolutionizing Manufacturing with Custom CNC Parts

Understandinghowmanufacturingisevolving,especiallythroughtheuseofcustomCNCparts,canseemcomplex.Thisa...

Breaking Boundaries with Custom CNC Parts

BreakingboundarieswithcustomCNCpartsinvolvesexploringhowadvancedmanufacturingtechniquesaretransformi...

Custom CNC Parts for Aerospace Industry

Intherealmofaerospacemanufacturing,precisionandreliabilityareparamount.Thecomponentsthatmakeupaircra...

Cnc machining for custom parts and components

UnderstandingCNCmachiningforcustompartsandcomponentsinvolvesexploringitsprocesses,advantages,andcomm...

洞察宇宙(十八):深入理解C语言内存管理

分享乐趣,传播快乐,增长见识,留下美好。亲爱的您,这里是LearingYard学苑!今天小编为大家带来“深入理解C语言内存管理”...

The Art of Crafting Custom CNC Parts

UnderstandingtheprocessofcreatingcustomCNCpartscanoftenbeconfusingforbeginnersandevensomeexperienced...

Tailored Custom CNC Solutions for Automotive

Intheautomotiveindustry,precisionandefficiencyarecrucialforproducinghigh-qualityvehiclecomponents.Ta...

关于WEB服务器(.NET)一些经验累积(一)

以前做过技术支持,把一些遇到的问题累积保存起来,现在发出了。1.问题:未能加载文件或程序集“System.EnterpriseServices.Wrapper.dll”或它的某一个依赖项。拒绝访问。解...

取消回复欢迎 发表评论: