---
title: MiniCPM5-2B
canonical_url: "https://www.modelscope.ai/studios/Iceberg-Yang/MiniCPM5-2B"
md_url: "https://www.modelscope.ai/studios/Iceberg-Yang/MiniCPM5-2B.md"
repository: Iceberg-Yang/MiniCPM5-2B
chinese_name: MiniCPM5-2B
last_updated: 2026-09-09
sdk_type: gradio
sdk_version: 6.17.3
downloads: 0
stars: 9
---

# MiniCPM5-2B

> MiniCPM5-2B - An interactive demo by Iceberg-Yang on ModelScope. MiniCPM5-2B online chat demo: streaming output, thinking mode toggle, temperature/top-p adjustment, Markdown and LaTeX rendering. Model OpenBMB/MiniCPM5-2B (standard LlamaForCausalLM, 2.5B,…

Iceberg-Yang/MiniCPM5-2B is an interactive demo (Studio) on ModelScope. built with gradio 6.17.3.

- **Repository**: Iceberg-Yang/MiniCPM5-2B
- **SDK**: gradio
- **SDK version**: 6.17.3
- **Downloads**: 0
- **Stars**: 9
- **Last updated**: 2026-09-09

Source: https://www.modelscope.ai/studios/Iceberg-Yang/MiniCPM5-2B

---

# MiniCPM5-2B Demo

Online chat demo for [MiniCPM5-2B](https://modelscope.ai/models/OpenBMB/MiniCPM5-2B) with streaming output, thinking mode toggle, and adjustable sampling parameters.

This is a ModelScope port of the Hugging Face Space [openbmb/MiniCPM5-2B-Demo](https://huggingface.co/spaces/openbmb/MiniCPM5-2B-Demo).

## Model

- **Model**: [OpenBMB/MiniCPM5-2B](https://modelscope.ai/models/OpenBMB/MiniCPM5-2B) by [OpenBMB](https://github.com/OpenBMB)
- **Architecture**: Standard `LlamaForCausalLM` (2.517B params, 42 layers, GQA 2 KV heads, 128K context)
- **Precision**: bfloat16, weights 4.69 GiB
- **License**: Apache-2.0
- **Sampling**: Official defaults `temperature=1.0, top_p=0.95`

## Features

- Multi-turn conversation with streaming token-by-token output
- Thinking mode (`enable_thinking`) toggle with collapsible reasoning traces
- Real-time temperature / top-p adjustment (passed directly to `model.generate`)
- Markdown and LaTeX math rendering (delimiters `$$` and `$`)
- Stop generation mid-stream, one-click clear history
- Single-concurrency queue to avoid VRAM stacking

## Runtime

| Item | Config |
| --- | --- |
| SDK | gradio 6.17.3 (`gr.Blocks` mode) |
| base_image | ubuntu22.04-py312-torch2.10.0-modelscope1.37.0 |
| Hardware | xGPU (free tier) |
| Dependencies | transformers>=5.6, accelerate, sentencepiece, modelscope |

Model weights (~4.7 GiB) are cached at `/mnt/workspace/.cache/modelscope` and persist across restarts.

## Differences from Upstream HF Space

The inference logic and interaction behavior are preserved. Key adaptations:

1. **Model source**: `huggingface_hub` → `modelscope.snapshot_download`, cache on persistent `/mnt/workspace`
2. **GPU scheduling**: Removed HF ZeroGPU `@spaces.GPU(duration=60)`, switched to dedicated GPU with `demo.queue(default_concurrency_limit=1)`
3. **Auth**: Removed `huggingface_hub.login(HF_TOKEN)` — model is public on ModelScope
4. **Remote code**: Removed `trust_remote_code=True` — no `.py` modeling files in repo, standard `LlamaForCausalLM`
5. **Server binding**: Explicit `server_name="0.0.0.0", server_port=7860` in `launch()`
6. **Frontend rewrite**: Upstream uses gradio `Server` mode + custom `index.html`. ModelScope gateway unconditionally takes over `GET /`, so rebuilt UI with `gr.Blocks` native components
7. **Fixed upstream sampling bug**: Upstream `predict` accepts `temperature`/`top_p` but never passes them to `gen_kwargs`; this version correctly forwards them to `model.generate`

## Acknowledgments

- Model and original demo by [OpenBMB](https://github.com/OpenBMB), Apache-2.0
- Original HF Space: <https://huggingface.co/spaces/openbmb/MiniCPM5-2B-Demo>
- MiniCPM project: <https://github.com/OpenBMB/MiniCPM>
