whisper.cpp
NEON & MPS 🆚 CoreML
下载模型(large-v3)
models/download-ggml-model.sh large-v3
NEON & MPS
编译
make clean
make -j
main 帮助 ./main --help usage: ./main [options] file0.wav file1.wav ...
NEON & MPS 🆚 CoreML
下载模型(large-v3)
models/download-ggml-model.sh large-v3
NEON & MPS
编译
make clean
make -j
main 帮助 ./main --help usage: ./main [options] file0.wav file1.wav ...
快速开始
克隆代码
git clone https://github.com/QwenLM/Qwen.git
cd Qwen
创建虚拟环境
python -m venv env
source env/bin/activate
安装依赖
pip install -r requirements.txt
创建大模型链接
mkdir Qwen
ln -s /Users/junjian/HuggingFace/Qwen/Qwen-14B-Chat Qwen/Qwen-14B-Chat
ln -s /Users/junjian/HuggingFace/Qwen/Qwen-1_8B Qwen/Qwen-1_8B
ln -s /Users/junjian/HuggingFace/Qwen/Qwen-1_8B-Chat Qwen/Qwen-1_8B-Chat
ln -s /Users/junjian/HuggingFace/Qwen/Qwen-7B-Chat Qwen/Qwen-7B-Chat
聊天
python cli_demo.py
python web_demo.py
FastChat
克隆代码
git clone https://github.com/lm-sys/FastChat
cd FastChat
创建虚拟环境 python -m venv env source env
部署
ollama run llama2
通过 API 访问
curl http://localhost:11434/api/generate -d '{
"model": "llama2",
"prompt": "Why is the sky blue?",
"stream": false
}'
ollama 帮助 ollama --help Large language model runner Usage: ollama [flags] ollama [command] Available Commands: serve Start ollama create Create a model from a Modelfile show Show information for a model run Run a model pull Pull a model from a registry push Push a model to a registry list List models cp Copy a model rm Remove a model help Help about any comman
在 macOS 安装 GitHub CLI
brew install gh
brew upgrade gh
gh auth login
? What account do you want to log into? GitHub.com
? What is your preferred protocol for Git operations on this host? HTTPS
? Authenticate Git with your GitHub credentials? Yes
? How would you like to authenticate GitHub CLI? Login with a web browser
! First copy your one-time code: EA2E-F864
Press Enter to open github.com in your browser...
✓ Authentication complete.
gh auth status
github.com
✓ Logged in to github.com account wang-junjian (keyring)
- Active account: true
- Git operations protocol: https
- Token: gho_************************************
- Token scopes: 'gist', 'read:org', 'repo', 'workflow'
llama.cpp
构建
❶ 克隆 [llama.cpp][llama.cpp] 仓库
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
❷ make
make -j
❸ 安装依赖
pip install -r requirements.txt
获得 Facebook LLaMA2 模型
可以从 TheBloke 下载已转换和量化的模型。
下载 GGUF 模型
huggingface-cli pip install huggingface_hub REPO_ID=TheBloke/Llama-2-7B-chat-GGUF FILENAME=llama-2-7b-chat.Q4_K_M.

SeamlessM4T 概述

安装 [Seamless Communication][seamless_communication]
克隆仓库 git clone https://github.
安装
brew update
brew install nginx
启动服务
brew services start nginx
Docroot is: /opt/homebrew/var/www
The default port has been set in /opt/homebrew/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /opt/homebrew/etc/nginx/servers/.
To start nginx now and restart at login:
brew services start nginx
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/nginx/bin/nginx -g daemon\ off\;
/opt/homebrew/etc/nginx/nginx.conf 修改端口号/opt/homebrew/var/www/index.html 修改默认页面停止服务
brew services stop nginx
重启服务 brew services restar
问题描述
我的 MacBook Pro M2 Max 能够连接上 WiFi,但是无法上网,我进行了以下尝试:
解决方案
最后,我在抖音上看到了一个解决方案,我尝试了一下,果然解决了问题。
打开访达,按下Command + Shift + G,输入/Library/Preferences/SystemConfiguration/,除com.apple.Boot.plist文件外,删除其他所有文件,然后重启电脑。

ChatGLM2-6B 是开源中英双语对话模型 ChatGLM-6B 的第二代版本,在保留了初代模型对话流畅、部署门槛较低等众多优秀特性的基础之上,ChatGLM2-6B 引入了如下新特性:
今天用 Docker 构建镜像,突然就挂了。重启 Docker,发现 Docker 无法启动了。
出现的错误
🐳 Building platen-switch:arm64
[+] Building 0.0s (2/2) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 69B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
ERROR: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to read dockerfile: failed to create temp dir: mkdir /var/lib/docker/tmp/buildkit-mount1477620899: no space left on device
分析问题 运行诊断工具 com.docker.
.DS_Store 文件
.DS_Store 是 Desktop Services Store 的缩写。
.DS_Store 是 macOS 操作系统中隐藏的文件,它存储有关文件夹的元数据,例如文件夹中的文件位置、文件夹的显示选项和自定义图标等信息。这些元数据是用来帮助操作系统更快地显示文件夹中的内容,并记住用户的偏好设置。这些文件只是本地的,不会在网络文件共享时传输,因此不会影响其他操作系统用户。
__MACOSX 目录
当你在 Mac 电脑上创建一个压缩文件时,系统会自动在压缩文件中添加一个名为 __MACOSX 的目录。该目录包含了 Mac 操作系统专有的一些文件,如 .DS_Store 等。这些文件不会对压缩文件的解压缩造成影响,但它们可能会在其他操作系统上解压缩时出现问题,例如在 Windows 上解压缩时可能会显示 __MACOSX 目录或 .DS_Store 文件。为了避免这种情况,你可以在创建压缩文件时选择不包含 Mac 专有文件,或者在解压缩时手动删除 __MACOSX 目录和 .DS_Store 文件。
删除 __MACOSX 目录和 .DS_Store 文件 方法一 find . -name '__MACOSX' -exec rm -rf {} ; -o -name '.
查看镜像信息
操作系统版本
cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
PRETTY_NAME="Ubuntu Jammy Jellyfish (development branch)"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04 (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
共享软件包缓存的好处是,一旦用户已经下载了软件包的特定版本,它将不会再次下载并存储在单独的缓存中。这节省了磁盘使用量并加快了安装速度,因为它不需要再次下载软件包。
Conda 查看 Conda 当前环境的信息 conda info active environment : base active env location : /opt/miniconda shell level : 1 user config file : /Users/junjian/.condarc populated config files : conda version : 23.3.1 conda-build version : not installed python version : 3.10.9.final.0 virtual packages : __archspec=1=arm64 __osx=13.2.1=0 __unix=0=0 base environment : /opt/miniconda (writable) conda av data dir : /opt/miniconda/etc/conda conda av metadata url : None channel URLs : https://repo.anaconda.
开发文档
查看音频文件信息
file
data/podcast_clip.mp3: Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v1, 64 kbps, 44.1 kHz, Stereo
ffprobe ffprobe -hide_banner data/podcast_clip.mp3 Input #0, mp3, from 'data/podcast_clip.mp3': Metadata: major_brand : M4A minor_version : 512 compatible_brands: M4A isomiso2 date : 2023-02-06 14:59 title : "Clip created on ListenNotes.com" encoder : Lavf58.76.100 Duration: 00:03:00.04, start: 0.025057, bitrate: 128 kb/s Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s Metadata: encoder : Lavc58.
ChatGLM-6B 是一个开源的、支持中英双语的对话语言模型,基于 General Language Model (GLM) 架构,具有 62 亿参数。
下载
克隆
https://github.com/THUDM/ChatGLM-6B.git
cd ChatGLM-6B
下载模型
git clone https://huggingface.co/THUDM/chatglm-6b THUDM/chatglm-6b
LLaMA-13B 在大多数基准上的表现优于 GPT-3(175B),LLaMA-65B 与最好的型号 Chinchilla-70B 和 PaLM-540B 具有竞争力。
克隆
git clone https://github.com/facebookresearch/llama
cd llama
下载模型
修改 download.sh,配置下载模型的 地址(PRESIGNED_URL) 和 下载目录(TARGET_FOLDER)。
vim download.sh
PRESIGNED_URL="https://agi.gpt4.org/llama/LLaMA/*" # replace with presigned url from email
TARGET_FOLDER="./" # where all files should end up
bash download.sh
构建
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
make
拷贝 LLaMA 模型到当前目录 ls .
准备音频文件
macOS 上打开 QuickTimePlayer
m4a 转换 wav
ffmpeg -i test.m4a -ar 16000 -ac 1 -c:a pcm_s16le test.wav
创建虚拟环境
conda create --name whisper python
conda activate whisper
安装
pip install --upgrade --no-deps --force-reinstall git+https://github.com/openai/whisper.git
wget https://raw.githubusercontent.com/openai/whisper/main/requirements.txt
pip install -r requirements.txt
测试 模型默认保存在 ~/.cache/whisper ls ~/.cache/whisper base.pt large-v2.
Apple 芯片上进行硬件加速的框架
VideoToolbox 是一个低级框架,可提供对硬件编码器和解码器的直接访问。它提供视频压缩和解压缩服务,以及存储在 CoreVideo 像素缓冲区中的光栅图像格式之间的转换。这些服务以会话对象(压缩、解压缩和像素传输)的形式提供。
VideoToolbox还包括一些命令行工具,例如vttool、vtenc、vtdecode等,可以在终端中使用。这些工具可以用来检查视频的属性、转码视频、将视频转换为图像序列等任务。
AudioToolbox 是一个音频处理框架,支持音频处理的硬件加速,它提供了一系列用于音频编码、解码、转换和处理的API接口。
安装 FFmpeg
创建目录
mkdir /opt/ffmpeg && cd /opt/ffmpeg
方法一:使用 curl
curl https://evermeet.cx/ffmpeg/ffmpeg-6.0.7z | tar -xz
curl https://evermeet.cx/ffmpeg/ffprobe-6.0.7z | tar -xz
curl https://evermeet.cx/ffmpeg/ffplay-6.0.7z | tar -xz

一个统一的开源服务管理框架,用于启动、停止和管理守护进程、应用程序、进程和脚本。由 Apple 的 Dave Zarzycki 编写和设计,它随 Mac OS X Tiger 引入并获得许可Apache 许可证。
Daemon vs Agent
launchd 区分代理和守护进程。主要区别在于,代理代表登录用户运行,而守护进程代表根用户或您使用 UserName 键指定的任何用户运行。只有代理可以访问 macOS GUI。
Job
根据它的存储位置,它将被视为守护进程或代理。
对操作系统操作至关重要的作业定义存储在 /System/Library 下。您永远不需要在这些目录中创建守护进程或代理。与每个用户相关的第三方定义存储在 /Library 下。特定用户的作业定义存储在相应用户的 Library 目录下。
安装 OpenVINO(手动编译)
brew install cmake
brew install automake
brew install --build-from-source libtool
brew install --build-from-source libunistring
brew install --build-from-source libidn2
brew install --build-from-source wget
brew install --build-from-source libusb
sudo conda install scons -y
# 克隆时把依赖的子模块进行克隆(先克隆OpenVINO,再进行子模块克隆失败)
git clone --depth 1 --recurse-submodules https://github.com/openvinotoolkit/openvino.git
cd openvino
python3 -m pip install -r src/bindings/python/wheel/requirements-dev.txt
# 安装OpenCV(可选)
sudo conda install -c conda-forge opencv
mkdir build && cd build
# 配置(-DOPENVINO_EXTRA_MODULES=../openvino_contrib/modules/arm_plugin 好像不需要)
cmake -DCMAKE_BUILD_TYPE=Release ..
# 编译
cmake --build . --config Release --parallel $(sysctl -n hw.ncpu)
**没有生成 wheel**
# 安装
sudo mkdir /opt/openvino
sudo cmake -DCMAKE_INSTALL_PREFIX=/opt/openvino -P cmake_install.cmake
# 查看可用设备
./bin/arm64/Release/hello_query_device
[ INFO ] Build ................................. 2023.0.0-1-b300df1be6c
[ INFO ]
[ INFO ] Available devices:
[ INFO ] CPU
[ INFO ] SUPPORTED_PROPERTIES:
[ INFO ] Immutable: SUPPORTED_METRICS : SUPPORTED_METRICS SUPPORTED_CONFIG_KEYS RANGE_FOR_ASYNC_INFER_REQUESTS RANGE_FOR_STREAMS
[ INFO ] Immutable: SUPPORTED_CONFIG_KEYS : LP_TRANSFORMS_MODE DUMP_GRAPH PERF_COUNT CPU_THROUGHPUT_STREAMS CPU_BIND_THREAD CPU_THREADS_NUM CPU_THREADS_PER_STREAM BIG_CORE_STREAMS SMALL_CORE_STREAMS THREADS_PER_STREAM_BIG THREADS_PER_STREAM_SMALL SMALL_CORE_OFFSET ENABLE_HYPER_THREAD NUM_STREAMS INFERENCE_NUM_THREADS AFFINITY
[ INFO ] Mutable: PERF_COUNT : YES
[ INFO ] Immutable: AVAILABLE_DEVICES : NEON
[ INFO ] Immutable: FULL_DEVICE_NAME : arm_compute::NEON
[ INFO ] Immutable: OPTIMIZATION_CAPABILITIES : FP16 FP32
[ INFO ] Immutable: RANGE_FOR_ASYNC_INFER_REQUESTS : 1 12 1
[ INFO ] Mutable: PERFORMANCE_HINT : ""
[ INFO ] Immutable: RANGE_FOR_STREAMS : 1 12
[ INFO ] Mutable: CPU_THROUGHPUT_STREAMS : 1
[ INFO ] Mutable: CPU_BIND_THREAD : NO
[ INFO ] Mutable: CPU_THREADS_NUM : 0
[ INFO ] Mutable: CPU_THREADS_PER_STREAM : 12
[ INFO ] Mutable: BIG_CORE_STREAMS : 0
[ INFO ] Mutable: SMALL_CORE_STREAMS : 0
[ INFO ] Mutable: THREADS_PER_STREAM_BIG : 0
[ INFO ] Mutable: THREADS_PER_STREAM_SMALL : 0
[ INFO ] Mutable: SMALL_CORE_OFFSET : 0
[ INFO ] Mutable: ENABLE_HYPER_THREAD : YES
[ INFO ] Mutable: NUM_STREAMS : 1
[ INFO ] Mutable: INFERENCE_NUM_THREADS : 0
[ INFO ] Mutable: AFFINITY : NONE
[ INFO ]
没有找到匹配的文章