openbmb / cpm-bee-2b

huggingface.co
Total runs: 139
24-hour runs: 0
7-day runs: 32
30-day runs: 73
Model's Last Updated: February 21 2024
text-generation

Introduction of cpm-bee-2b

Model Details of cpm-bee-2b

CPM-Bee

CPM-Bee is a fully open-source, commercially-usable Chinese-English bilingual base model with a capacity of ten billion parameters. It is the second milestone achieved through the training process of CPM-live . Utilizing the Transformer auto-regressive architecture, CPM-Bee has been pre-trained on an extensive corpus of trillion-scale tokens, thereby possessing remarkable foundational capabilities.

Model description
  • Open-source and Commercial Usable :OpenBMB adheres to the spirit of open-source, aiming to make large-scale models accessible to everyone. CPM-Bee, as a foudation model, is fully open-source and available for commercial use, contributing to the advancement of the field of large-scale models.

  • Excellent Performance in Chinese and English : : CPM-Bee's base model has undergone rigorous selection and balancing of pre-training data, resulting in outstanding performance in both Chinese and English. For detailed information regarding evaluation tasks and results, please refer to the assessment documentation.

  • Vast and High-quality Corpus : CPM-Bee, as a base model, has been trained on an extensive corpus of over trillion tokens, making it one of the models with the highest volume of training data within the open-source community. Furthermore, we have implemented stringent selection, cleaning, and post-processing procedures on the pre-training corpus to ensure its quality.

  • Support for OpenBMB System : The OpenBMB system provides a comprehensive ecosystem of tools and scripts for high-performance pre-training, adaptation, compression, deployment, and tool development. CPM-Bee, as a base model, is accompanied by all the necessary tool scripts, enabling developers to efficiently utilize and explore advanced functionalities.

  • Conversational and Tool Usage Capabilities : Building upon OpenBMB's exploration in instruction-based fine-tuning and tool learning, we have performed fine-tuning on top of the CPM-Bee base model, resulting in an instance model with powerful conversational and tool usage capabilities. The API and beta testing for this model will be made available in the near future.

Intended uses & limitations

You can use the raw model for many NLP tasks like text generation or fine-tune it to a downstream task.

How to use
>>> from transformers import AutoModelForCausalLM, AutoTokenizer
>>> tokenizer = AutoTokenizer.from_pretrained("openbmb/cpm-bee-2b", trust_remote_code=True)
>>> model = AutoModelForCausalLM.from_pretrained("openbmb/cpm-bee-2b", trust_remote_code=True).cuda()  # 
>>> result = model.generate({"input": "今天天气不错,", "<ans>": ""}, tokenizer)
>>> print(result)

If you wanna use multi GPUs to inference, you can use accelerate as follow:

from transformers import AutoModelForCausalLM, AutoTokenizer
from accelerate import dispatch_model
from accelerate.utils import get_balanced_memory, infer_auto_device_map

tokenizer = AutoTokenizer.from_pretrained("openbmb/cpm-bee-2b", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("openbmb/cpm-bee-2b", trust_remote_code=True).cuda()

max_memory = get_balanced_memory(
    model, 
    no_split_module_classes=["CpmBeeTransformerBlock"]
)
device_map = infer_auto_device_map(model, max_memory=max_memory, no_split_module_classes=["CpmBeeTransformerBlock"]) 
# make sure the data on the same device when projecting hidden states to logits.
device_map["cpmbee.encoder.output_layernorm"] = device_map["cpmbee.input_embedding"] = 0

model = dispatch_model(model, device_map=device_map)

res = model.generate(
    [
        {"input": "今天天气是真的", "<ans>": ""},
        {"input": "NGC 6231是一个位于天蝎座的疏散星团,天球座标为赤经16时54分,赤纬-41度48分,视觉观测大小约45角分,亮度约2.6视星等,距地球5900光年。NGC 6231年龄约为三百二十万年,是一个非常年轻的星团,星团内的最亮星是5等的天蝎座 ζ1星。用双筒望远镜或小型望远镜就能看到个别的行星。NGC 6231在1654年被意大利天文学家乔瓦尼·巴蒂斯特·霍迪尔纳(Giovanni Battista Hodierna)以Luminosae的名字首次纪录在星表中,但是未见记载于夏尔·梅西耶的天体列表和威廉·赫歇尔的深空天体目录。这个天体在1678年被爱德蒙·哈雷(I.7)、1745年被夏西亚科斯(Jean-Phillippe Loys de Cheseaux)(9)、1751年被尼可拉·路易·拉卡伊(II.13)分别再次独立发现。", "question": "NGC 6231的经纬度是多少?", "<ans>": ""}
    ],
    tokenizer,
    max_new_tokens=100
)
print(res)

We suggest to use bmtrain to finetune CPM-Bee. Also, you can use accelerate and deepspeed to finetune CPM-Bee. Here we will give a brief example of a training loop:

from transformers import AutoTokenizer, AutoModelForCausalLM
from accelerate import Accelerator
from torch.utils.data import Dataset, DataLoader

accelerator = Accelerator()

trainset = Dataset()  # Make sure trainset.__getitem__() can get data with correct format like {"input": "...", "<ans>": ""}
# for details, you can read https://github.com/OpenBMB/CPM-Bee/tree/main/tutorials/basic_task_finetune
train_loader = DataLoader(trainset, batch_size=1)

tokenizer = AutoTokenizer.from_pretrained("openbmb/cpm-bee-2b", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("openbmb/cpm-bee-2b", trust_remote_code=True).cuda()

optimizer = torch.optim.Adam(model.parameters())

model, optimizer, train_loader = accelerator.prepare(
    model, optimizer, train_loader
)

for iter, data in enumerate(train_loader):
    optimizer.zero_grad()

    # change the data to a trainable format
    input_encoded = tokenizer.prepare_for_finetune(data, max_length=512).to(model.device)

    outputs = model(**input_encoded)
    loss = outputs.loss
    accelerator.backward(loss)
    optimizer.step()

You should design your own parallel and mix_precision training strategy on the basis of it.

Runs of openbmb cpm-bee-2b on huggingface.co

139
Total runs
0
24-hour runs
23
3-day runs
32
7-day runs
73
30-day runs

More Information About cpm-bee-2b huggingface.co Model

cpm-bee-2b huggingface.co

cpm-bee-2b huggingface.co is an AI model on huggingface.co that provides cpm-bee-2b's model effect (), which can be used instantly with this openbmb cpm-bee-2b model. huggingface.co supports a free trial of the cpm-bee-2b model, and also provides paid use of the cpm-bee-2b. Support call cpm-bee-2b model through api, including Node.js, Python, http.

cpm-bee-2b huggingface.co Url

https://huggingface.co/openbmb/cpm-bee-2b

openbmb cpm-bee-2b online free

cpm-bee-2b huggingface.co is an online trial and call api platform, which integrates cpm-bee-2b's modeling effects, including api services, and provides a free online trial of cpm-bee-2b, you can try cpm-bee-2b online for free by clicking the link below.

openbmb cpm-bee-2b online free url in huggingface.co:

https://huggingface.co/openbmb/cpm-bee-2b

cpm-bee-2b install

cpm-bee-2b is an open source model from GitHub that offers a free installation service, and any user can find cpm-bee-2b on GitHub to install. At the same time, huggingface.co provides the effect of cpm-bee-2b install, users can directly use cpm-bee-2b installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

cpm-bee-2b install url in huggingface.co:

https://huggingface.co/openbmb/cpm-bee-2b

Url of cpm-bee-2b

cpm-bee-2b huggingface.co Url

Provider of cpm-bee-2b huggingface.co

openbmb
ORGANIZATIONS

Other API from openbmb

huggingface.co

Total runs: 200.2K
Run Growth: 91.4K
Growth Rate: 45.63%
Updated:October 05 2025
huggingface.co

Total runs: 134.8K
Run Growth: -3.0K
Growth Rate: -2.19%
Updated:March 10 2026
huggingface.co

Total runs: 117.8K
Run Growth: 4.9K
Growth Rate: 4.17%
Updated:September 15 2025
huggingface.co

Total runs: 112.2K
Run Growth: 89.6K
Growth Rate: 79.87%
Updated:May 10 2026
huggingface.co

Total runs: 106.9K
Run Growth: -45.2K
Growth Rate: -42.32%
Updated:June 13 2025
huggingface.co

Total runs: 25.5K
Run Growth: 411
Growth Rate: 1.61%
Updated:October 24 2025
huggingface.co

Total runs: 20.0K
Run Growth: 1.8K
Growth Rate: 8.78%
Updated:October 24 2025
huggingface.co

Total runs: 19.9K
Run Growth: 406
Growth Rate: 2.04%
Updated:January 15 2025
huggingface.co

Total runs: 13.0K
Run Growth: 11.6K
Growth Rate: 88.94%
Updated:June 02 2023
huggingface.co

Total runs: 11.5K
Run Growth: 10.4K
Growth Rate: 90.57%
Updated:May 07 2026
huggingface.co

Total runs: 7.7K
Run Growth: -4.1K
Growth Rate: -52.99%
Updated:February 27 2025
huggingface.co

Total runs: 6.5K
Run Growth: 523
Growth Rate: 8.06%
Updated:January 14 2026
huggingface.co

Total runs: 5.4K
Run Growth: 5.4K
Growth Rate: 99.14%
Updated:June 10 2025
huggingface.co

Total runs: 5.2K
Run Growth: 3.7K
Growth Rate: 70.38%
Updated:October 20 2025
huggingface.co

Total runs: 4.8K
Run Growth: 2.7K
Growth Rate: 56.92%
Updated:November 04 2024
huggingface.co

Total runs: 1.4K
Run Growth: 79
Growth Rate: 5.80%
Updated:January 15 2025
huggingface.co

Total runs: 1.3K
Run Growth: 1.2K
Growth Rate: 94.75%
Updated:August 12 2023
huggingface.co

Total runs: 1.0K
Run Growth: 153
Growth Rate: 14.93%
Updated:September 19 2025
huggingface.co

Total runs: 891
Run Growth: 76
Growth Rate: 8.53%
Updated:June 27 2023
huggingface.co

Total runs: 847
Run Growth: 48
Growth Rate: 5.67%
Updated:August 24 2023
huggingface.co

Total runs: 436
Run Growth: 372
Growth Rate: 85.32%
Updated:February 12 2026
huggingface.co

Total runs: 416
Run Growth: -75
Growth Rate: -18.03%
Updated:October 14 2023
huggingface.co

Total runs: 307
Run Growth: -34
Growth Rate: -10.33%
Updated:May 14 2024
huggingface.co

Total runs: 200
Run Growth: 183
Growth Rate: 91.50%
Updated:October 14 2025
huggingface.co

Total runs: 193
Run Growth: 100
Growth Rate: 51.81%
Updated:February 21 2024
huggingface.co

Total runs: 190
Run Growth: -1.3K
Growth Rate: -699.47%
Updated:April 08 2024
huggingface.co

Total runs: 164
Run Growth: 73
Growth Rate: 44.51%
Updated:February 21 2024
huggingface.co

Total runs: 148
Run Growth: 19
Growth Rate: 12.84%
Updated:April 16 2024
huggingface.co

Total runs: 139
Run Growth: 120
Growth Rate: 86.33%
Updated:June 11 2025