Skip to content

majiayu000/spellbook / skills/gemma4-local-deploy

gemma4-local-deploy

Verified

在本机 Mac 或 Apple Silicon 上部署 Gemma 4 12B。本地安装/升级 llama.cpp,下载 GGUF 量化模型,用 llama-server 暴露 OpenAI-compatible API,或用 Ollama 暴露本地模型服务;按用户需求在默认 Q4_K_M、64K/128K 长上下文、QAT Q4_0 @ 256K、左右对比演示之间选择,配置 tmux 后台运行,验证健康检查、问答接口、资源占用和常见故障。当用户说部署 Gemma 4、Gemma 4 12B、本地大模型、长上下文、QAT、量化、llama-server、Ollama、GGUF、Mac 本地模型服务时使用。

FileKindSize
SKILL.mdskill md5.5 KB
agents/openai.yamlconfig370 B
references/llama-cpp.mdmarkdown4.6 KB
references/ollama.mdmarkdown2.1 KB
references/verification.mdmarkdown2.5 KB

references/ollama.md

View on GitHub
# Ollama 部署路线

只在用户明确要求 Ollama、需要 Ollama 生态,或询问 `ollama pull gemma4:12b` 时读取本文件。Ollama registry 状态可能变化,执行当时必须重新验证,不能复用旧结论。

## 安装与启动

```bash
brew install ollama
ollama --version
lsof -nP -iTCP:11434 -sTCP:LISTEN || true
tmux new-session -d -s ollama-gemma4 'OLLAMA_FLASH_ATTENTION=1 OLLAMA_KV_CACHE_TYPE=q8_0 ollama serve'
curl -fsS http://127.0.0.1:11434/api/version
```

先尝试官方 tag:

```bash
ollama pull gemma4:12b
ollama run gemma4:12b "用一句中文回答:现在可以问你问题吗?"
```

如果明确返回 `pull model manifest: file does not exist`,再回退到 GGUF 导入:

```bash
mkdir -p "$HOME/Models/gemma4-12b"
huggingface-cli download ggml-org/gemma-4-12B-it-GGUF \
  gemma-4-12B-it-Q4_K_M.gguf \
  --local-dir "$HOME/Models/gemma4-12b"
```

创建 `$HOME/Models/gemma4-12b/Modelfile`:

```text
FROM /Users/<current-user>/Models/gemma4-12b/gemma-4-12B-it-Q4_K_M.gguf
```

用当前用户的真实绝对路径替换占位内容。不要把未展开的 `$HOME` 写进需要静态路径的 Modelfile。

Homebrew `ollama` 构建如果报告缺少 `llama-server` / `llama-quantize` sidecar,才创建专用工作目录并链接已安装的 `llama.cpp` 二进制:

```bash
mkdir -p "$HOME/ollama-gemma4/build/lib/ollama"
ln -sf /opt/homebrew/bin/llama-server "$HOME/ollama-gemma4/build/lib/ollama/llama-server"
ln -sf /opt/homebrew/bin/llama-quantize "$HOME/ollama-gemma4/build/lib/ollama/llama-quantize"
tmux kill-session -t ollama-gemma4 2>/dev/null || true
tmux new-session -d -s ollama-gemma4 "cd '$HOME/ollama-gemma4' && OLLAMA_FLASH_ATTENTION=1 OLLAMA_KV_CACHE_TYPE=q8_0 ollama serve"
```

导入并验证:

```bash
ollama create gemma4-12b-gguf-local -f "$HOME/Models/gemma4-12b/Modelfile"
ollama list
ollama run gemma4-12b-gguf-local "用一句中文回答:Ollama 能跑 Gemma 4 12B 吗?"
```

最终必须区分实际成功路线:

- 官方 registry:`ollama pull gemma4:12b`
- 手工 GGUF:`ollama create gemma4-12b-gguf-local`
- 是否使用了 sidecar 链接 workaround
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall