ChatGLM2-6B
Use this repo-specific operating skill when a task names ChatGLM2-6B, the
THUDM/chatglm2-6b model, its legacy CLI/Gradio/Streamlit demos, its FastAPI
or OpenAI-compatible API samples, C-Eval evaluation, or the ptuning/
training/checkpoint workflow. This skill distills the public repository into
self-contained routes; model weights and benchmark datasets are external and
are never bundled.
Start here
- Identify the model source: Hub id, pinned revision, or a complete local
model directory. Keep tokenizer and model revisions aligned.
- Choose the route below and read its linked references before writing a
command. Most official scripts assume CUDA and load several-billion-
parameter weights; do not use them as cheap import checks.
- Install the repo's runtime dependencies with the documented requirements,
plus service or fine-tuning extras only for the selected workflow. Pin
legacy Gradio/Streamlit versions when using the source demos; see
references/model-and-environment.md.
- Run the safe root preflight:
python scripts/check_installation.py --backend auto.
- Read
references/troubleshooting.md for
cross-cutting model-cache, backend, version, license, and safety issues.
Route by task
- Local chat, streaming, CLI, Gradio, Streamlit, quantization, CPU/MPS,
or multi-GPU placement: read
sub-skills/chat-and-demos/SKILL.md.
- FastAPI
/ or OpenAI-compatible /v1/chat/completions, curl clients,
SSE, or service deployment: read
sub-skills/api-serving/SKILL.md.
- C-Eval JSONL layout, answer extraction, or benchmark scoring: read
sub-skills/evaluation/SKILL.md.
- P-Tuning v2, ADGEN/chat data,
torchrun, prefix checkpoints, prediction,
or optional DeepSpeed: read
sub-skills/ptuning/SKILL.md.
When a task spans routes, start with the route that owns the artifact and
follow its explicit cross-link. For example, validate chat data in ptuning,
then use chat-and-demos to inspect a prefix checkpoint, and finally use
api-serving to expose the loaded model.
Installation and verification
This repository is script-oriented rather than a Python distribution; it has
no pyproject.toml/setup.py package to install. From a checkout, install the
runtime file with a Python version supported by the selected dependency wheels:
python -m pip install -r references/runtime-requirements.txt
The bundled requirements file includes the base runtime plus service,
evaluation, and P-Tuning extras used by this skill. If you want a smaller
environment, install only the lines required by the selected route. The source
demos use legacy Gradio APIs; verify the version before launch and read the
environment reference rather than accepting an unbounded latest version. For
full-parameter fine-tuning, DeepSpeed is optional and must match the installed
PyTorch/CUDA stack.
The bundled scripts/check_installation.py checks dependency metadata, a
requested backend, and an optional local model path without downloading or
loading weights. It is a preflight, not proof that a multi-billion-parameter
model fits. Read references/repo-provenance.md
before refreshing the skill against a changed checkout; the provenance file
records the source commit, dirty state, model-loading contract, and evidence
paths.
Boundaries and safety
- Never claim a successful CPU import proves CUDA, MPS, quantization, or
multi-GPU behavior.
- Do not download weights or external datasets from bundled diagnostic scripts.
Acquire them through approved sources and validate local paths first.
- Treat the sample services' wildcard CORS and unauthenticated listeners as
development defaults. Add authentication, origin controls, rate limits,
and timeouts before non-local exposure.
- Respect the model-weight license and the safety restrictions summarized in
references/license-and-safety.md.
1---2name: chatglm2-6b3description: "Guides ChatGLM2-6B Transformers inference, local demos,4 FastAPI/OpenAI-compatible serving, C-Eval evaluation, and P-Tuning v25 fine-tuning."6disable-model-invocation: true7metadata:8 source: https://skillmd.com/skills/vectorspacelab/chatglm2-6b9 disco-role: operating10license: NOASSERTION11---1213# ChatGLM2-6B1415Use this repo-specific operating skill when a task names ChatGLM2-6B, the16`THUDM/chatglm2-6b` model, its legacy CLI/Gradio/Streamlit demos, its FastAPI17or OpenAI-compatible API samples, C-Eval evaluation, or the `ptuning/`18training/checkpoint workflow. This skill distills the public repository into19self-contained routes; model weights and benchmark datasets are external and20are never bundled.2122## Start here23241. Identify the model source: Hub id, pinned revision, or a complete local25 model directory. Keep tokenizer and model revisions aligned.262. Choose the route below and read its linked references before writing a27 command. Most official scripts assume CUDA and load several-billion-28 parameter weights; do not use them as cheap import checks.293. Install the repo's runtime dependencies with the documented requirements,30 plus service or fine-tuning extras only for the selected workflow. Pin31 legacy Gradio/Streamlit versions when using the source demos; see32 [`references/model-and-environment.md`](references/model-and-environment.md).334. Run the safe root preflight:34 `python scripts/check_installation.py --backend auto`.355. Read [`references/troubleshooting.md`](references/troubleshooting.md) for36 cross-cutting model-cache, backend, version, license, and safety issues.3738## Route by task3940- **Local chat, streaming, CLI, Gradio, Streamlit, quantization, CPU/MPS,41 or multi-GPU placement:** read42 [`sub-skills/chat-and-demos/SKILL.md`](sub-skills/chat-and-demos/SKILL.md).43- **FastAPI `/` or OpenAI-compatible `/v1/chat/completions`, curl clients,44 SSE, or service deployment:** read45 [`sub-skills/api-serving/SKILL.md`](sub-skills/api-serving/SKILL.md).46- **C-Eval JSONL layout, answer extraction, or benchmark scoring:** read47 [`sub-skills/evaluation/SKILL.md`](sub-skills/evaluation/SKILL.md).48- **P-Tuning v2, ADGEN/chat data, `torchrun`, prefix checkpoints, prediction,49 or optional DeepSpeed:** read50 [`sub-skills/ptuning/SKILL.md`](sub-skills/ptuning/SKILL.md).5152When a task spans routes, start with the route that owns the artifact and53follow its explicit cross-link. For example, validate chat data in `ptuning`,54then use `chat-and-demos` to inspect a prefix checkpoint, and finally use55`api-serving` to expose the loaded model.5657## Installation and verification5859This repository is script-oriented rather than a Python distribution; it has60no `pyproject.toml`/`setup.py` package to install. From a checkout, install the61runtime file with a Python version supported by the selected dependency wheels:6263```bash64python -m pip install -r references/runtime-requirements.txt65```6667The bundled requirements file includes the base runtime plus service,68evaluation, and P-Tuning extras used by this skill. If you want a smaller69environment, install only the lines required by the selected route. The source70demos use legacy Gradio APIs; verify the version before launch and read the71environment reference rather than accepting an unbounded latest version. For72full-parameter fine-tuning, DeepSpeed is optional and must match the installed73PyTorch/CUDA stack.7475The bundled `scripts/check_installation.py` checks dependency metadata, a76requested backend, and an optional local model path without downloading or77loading weights. It is a preflight, not proof that a multi-billion-parameter78model fits. Read [`references/repo-provenance.md`](references/repo-provenance.md)79before refreshing the skill against a changed checkout; the provenance file80records the source commit, dirty state, model-loading contract, and evidence81paths.8283## Boundaries and safety8485- Never claim a successful CPU import proves CUDA, MPS, quantization, or86 multi-GPU behavior.87- Do not download weights or external datasets from bundled diagnostic scripts.88 Acquire them through approved sources and validate local paths first.89- Treat the sample services' wildcard CORS and unauthenticated listeners as90 development defaults. Add authentication, origin controls, rate limits,91 and timeouts before non-local exposure.92- Respect the model-weight license and the safety restrictions summarized in93 [`references/license-and-safety.md`](references/license-and-safety.md).