Instructions to use tchbcb/samai-9b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use tchbcb/samai-9b with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf tchbcb/samai-9b:Q4_K_M # Run inference directly in the terminal: llama cli -hf tchbcb/samai-9b:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf tchbcb/samai-9b:Q4_K_M # Run inference directly in the terminal: llama cli -hf tchbcb/samai-9b:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf tchbcb/samai-9b:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf tchbcb/samai-9b:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf tchbcb/samai-9b:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf tchbcb/samai-9b:Q4_K_M
Use Docker
docker model run hf.co/tchbcb/samai-9b:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use tchbcb/samai-9b with Ollama:
ollama run hf.co/tchbcb/samai-9b:Q4_K_M
- Unsloth Desktop
- Pi
How to use tchbcb/samai-9b with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf tchbcb/samai-9b:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "tchbcb/samai-9b:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use tchbcb/samai-9b with Docker Model Runner:
docker model run hf.co/tchbcb/samai-9b:Q4_K_M
- Lemonade
How to use tchbcb/samai-9b with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull tchbcb/samai-9b:Q4_K_M
Run and chat with the model
lemonade run user.samai-9b-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use tchbcb/samai-9b with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf tchbcb/samai-9b:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default tchbcb/samai-9b:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use tchbcb/samai-9b with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf tchbcb/samai-9b:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "tchbcb/samai-9b:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Download artifacts/m15_scripts/colab_compile.py from tchbcb/samai-9b: direct link, hf CLI and curl.
- Browser
- Download file 4.27 kB
-
https://huggingface.co/tchbcb/samai-9b/resolve/main/artifacts/m15_scripts/colab_compile.py
- Command line
-
hf download hf://tchbcb/samai-9b/artifacts/m15_scripts/colab_compile.py
-
curl -L -o colab_compile.py https://huggingface.co/tchbcb/samai-9b/resolve/main/artifacts/m15_scripts/colab_compile.py
4.27 kB
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| """colab_compile.py — Colab T4 专用 llama.cpp CUDA 编译链 (sm_75) | |
| 编译 -> 打包 llama_cpp_cuda_colab_t4.tar.gz -> 第一时间推仓 (tchbcb/samai-9b) | |
| 幂等旗标: /content/k8b/CC_* | |
| 日志: /content/k8b/colab_compile.log""" | |
| import os, subprocess, sys, time, traceback | |
| K8B = "/content/k8b" | |
| BIN = "/content/lcbin" | |
| LCSRC = "/content/lcbuild/llama.cpp" | |
| LOG = K8B + "/colab_compile.log" | |
| os.makedirs(K8B, exist_ok=True) | |
| log = open(LOG, "a", buffering=1) | |
| def P(m): | |
| log.write("[%s] %s\n" % (time.strftime("%m-%d %H:%M:%S"), m)) | |
| def sh(c, t=7200): | |
| p = subprocess.run(c, shell=True, capture_output=True, text=True, timeout=t, errors="replace") | |
| return ((p.stdout or "") + (p.stderr or ""))[-1500:] | |
| def flag(n, c="1"): | |
| open(K8B + "/" + n, "w").write(str(c)[:400]) | |
| def have(n): | |
| return os.path.exists(K8B + "/" + n) | |
| def hf_token(): | |
| return open("/root/.cache/huggingface/token").read().strip() | |
| def main(): | |
| t0 = time.time() | |
| P("==== colab compile start ====") | |
| try: | |
| # CC1: clone | |
| if not have("CC_CLONE"): | |
| if not os.path.exists(LCSRC + "/CMakeLists.txt"): | |
| r = sh("rm -rf /content/lcbuild && mkdir -p /content/lcbuild && " | |
| "git clone --depth 1 https://github.com/ggml-org/llama.cpp %s" % LCSRC, 900) | |
| if not os.path.exists(LCSRC + "/CMakeLists.txt"): | |
| raise RuntimeError("clone failed: " + r[-300:]) | |
| flag("CC_CLONE", sh("cd %s && git rev-parse --short HEAD" % LCSRC, 15)) | |
| P("clone ok") | |
| # CC2: cmake + build (sm_75, 2 核 -j2) | |
| if not have("CC_BUILD"): | |
| r = sh("cd /content/lcbuild && cmake -S %s -B %s/build -DGGML_CUDA=ON " | |
| "-DCMAKE_CUDA_ARCHITECTURES=75 -DLLAMA_CURL=OFF -DCMAKE_BUILD_TYPE=Release " | |
| "> %s/cmake.log 2>&1; echo RC=$?; tail -3 %s/cmake.log" % (LCSRC, LCSRC, LCSRC, LCSRC), 600) | |
| P("cmake: " + r[-200:]) | |
| if "RC=0" not in r: | |
| raise RuntimeError("cmake failed") | |
| r = sh("cd %s/build && cmake --build . --config Release -j2 > %s/build.log 2>&1; echo RC=$?" % (LCSRC, LCSRC), 7200) | |
| P("build: " + r[-200:]) | |
| if "RC=0" not in r: | |
| raise RuntimeError("build failed: " + sh("tail -20 %s/build.log" % LCSRC)[-600:]) | |
| flag("CC_BUILD") | |
| P("build ok (%.0fs)" % (time.time() - t0)) | |
| # CC3: 平铺 bin+so -> /content/lcbin | |
| if not have("CC_FLAT"): | |
| os.makedirs(BIN, exist_ok=True) | |
| sh("cp -a %s/build/bin/* %s/ 2>/dev/null" % (LCSRC, BIN), 300) | |
| sh("find %s/build -name '*.so*' -exec cp -a {} %s/ \\; 2>/dev/null" % (LCSRC, BIN), 300) | |
| need = ["llama-server", "llama-quantize", "llama-cli"] | |
| miss = [b for b in need if not os.path.exists(BIN + "/" + b)] | |
| if miss: | |
| raise RuntimeError("binaries missing: %s" % miss) | |
| r = sh("ls -la %s | head -20" % BIN, 15) | |
| P("flat ok:\n" + r) | |
| flag("CC_FLAT") | |
| # CC4: 打包 + 第一时间推仓 | |
| if not have("CC_PUSH"): | |
| tar = K8B + "/llama_cpp_cuda_colab_t4.tar.gz" | |
| sh("tar czf %s -C %s . > /dev/null 2>&1" % (tar, BIN), 600) | |
| if os.path.getsize(tar) < 3e7: | |
| raise RuntimeError("tar too small: %d" % os.path.getsize(tar)) | |
| from huggingface_hub import HfApi | |
| api = HfApi(token=hf_token()) | |
| api.upload_file(path_or_fileobj=tar, path_in_repo="llama_cpp_cuda_colab_t4.tar.gz", | |
| repo_id="tchbcb/samai-9b", repo_type="model", | |
| commit_message="colab T4 (sm_75) CUDA build, first-push") | |
| flag("CC_PUSH", "%.0fs" % (time.time() - t0)) | |
| P("CUDA tar pushed (%.0f MB, %.0fs)" % (os.path.getsize(tar) / 1e6, time.time() - t0)) | |
| P("==== COMPILE_ALL_DONE in %.0fs ====" % (time.time() - t0)) | |
| flag("COMPILE_ALL_DONE", "%.0fs" % (time.time() - t0)) | |
| except Exception as e: | |
| traceback.print_exc(file=log) | |
| flag("COMPILE_FAIL", repr(e)[:200]) | |
| P("==== COMPILE_FAIL: %s ====" % repr(e)[:200]) | |
| if __name__ == "__main__": | |
| main() | |