在Ubuntu Linux安装brew 使用brew安装llama.cpp 运行文心Ernie大模型

经常用Mac的都知道brew,是Mac下的包管理软件。其实这个包管理软件也可以安装在Linux系统,进而可以用brew管理和安装linux软件包。

安装brew

直接安装

直接用下面命令安装即可,注意需要用管理员权限

复制代码
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

配置环境变量

安装完成,提示配置环境变量:

复制代码
    echo >> /root/.bashrc
    echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /root/.bashrc
    eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

因为是直接在root账户下安装的,所以环境变量也都设置的root账户下。

同时它还提醒安装gcc,照办:

复制代码
brew install gcc

配置一下清华加速镜像

复制代码
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"

安装完成,测试一下,安装llama.cpp

安装llama.cpp

先用brew search查看一下 llama相关的软件包

复制代码
brew search llama
==> Formulae
gollama                       llama.cpp                     ollama                        lla                           llm

直接brew安装llama.cpp

复制代码
brew install llama.cpp

配置llama.cpp加速镜像

如果速度慢,就加上Huggingface的加速镜像

复制代码
export HF_ENDPOINT=https://hf-mirror.com

用llama.cpp启动文心ERNIE模型

就用这个文心ERNIE明星模型ERNIE-4.5-21B-A3B-Thinking ,当然是GGUF格式的:ERNIE-4.5-21B-A3B-Thinking-Q4_K_M-GGUF

复制代码
llama-cli --hf-repo enacimie/ERNIE-4.5-21B-A3B-Thinking-Q4_K_M-GGUF --hf-file ernie-4.5-21b-a3b-thinking-q4_k_m.gguf -p "The meaning to life and the universe is"

如果下载模型速度慢,就加上Huggingface的加速镜像

复制代码
export HF_ENDPOINT=https://hf-mirror.com

启动了,但是因为只用了异构计算架构的cpu,么有用到dcu,所以速度非常慢,有多慢呢,简直比13年前的cpu慢

复制代码
<|im_start|>user
The meaning to life and the universe is 
<|im_start|>assistant

We are going to explore the meaning of life and the universe in the context of human existence. 

The Meaning of Life:

Philosophical Perspectives:
- Existentialism: Emphasizes individual freedom and responsibility. The meaning of life is what each person chooses to create. 
- Eudaimonism: Focuses on flourishing (eudaimonia) through virtues and realizing one's potential. 
- Religious/Spiritual Views: Many religions propose that life's meaning comes from serving a higher power or fulfilling a divine plan. 

The Meaning of the Universe: 

Cosmological View: 
- The universe is vast and indifferent to human concerns. 
- Big Bang Theory: The universe began 13.8 billion years ago and has been expanding ever since. 
- Steady State Theory: The universe is eternally constant, but this has been largely discredited. 
- Multiverse Theory: Our universe is one of many, with each having different physical laws. 

Connecting Life and

总结

这次主要是实践在Linux系统安装brew,并通过brew来安装llama.cpp,进而启动文心大模型。

总体实践成功过!

相关推荐
Blossom.1185 分钟前
基于时序大模型+强化学习的虚拟电厂储能调度系统:从负荷预测到收益最大化的实战闭环
运维·人工智能·python·决策树·机器学习·自动化·音视频
百胜软件@百胜软件1 小时前
重塑零售未来:百胜智能中台+胜券AI,赋能品牌零售撬动3100亿增量市场
大数据·人工智能·零售
Shawn_Shawn7 小时前
人工智能入门概念介绍
人工智能
极限实验室7 小时前
程序员爆哭!我们让 COCO AI 接管 GitLab 审查后,团队直接起飞:连 CTO 都说“这玩意儿比人靠谱多了
人工智能·gitlab
Maynor9968 小时前
Z-Image: 100% Free AI Image Generator
人工智能
爬点儿啥8 小时前
[Ai Agent] 10 MCP基础:快速编写你自己的MCP服务器(Server)
人工智能·ai·langchain·agent·transport·mcp
张人玉8 小时前
百度 AI 图像识别 WinForms 应用代码分析笔记
人工智能·笔记·百度
测试人社区-小明9 小时前
智能弹性伸缩算法在测试环境中的实践与验证
人工智能·测试工具·算法·机器学习·金融·机器人·量子计算
Spring AI学习9 小时前
Spring AI深度解析(9/50):可观测性与监控体系实战
java·人工智能·spring
罗西的思考9 小时前
【Agent】MemOS 源码笔记---(5)---记忆分类
人工智能·深度学习·算法