Text Generation
Transformers
PyTorch
Chinese
English
llama
conversational
custom_code
text-generation-inference
Instructions to use openbmb/BitCPM-CANN-1B-unquantized with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openbmb/BitCPM-CANN-1B-unquantized with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="openbmb/BitCPM-CANN-1B-unquantized", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("openbmb/BitCPM-CANN-1B-unquantized", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("openbmb/BitCPM-CANN-1B-unquantized", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use openbmb/BitCPM-CANN-1B-unquantized with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openbmb/BitCPM-CANN-1B-unquantized" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openbmb/BitCPM-CANN-1B-unquantized", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/openbmb/BitCPM-CANN-1B-unquantized
- SGLang
How to use openbmb/BitCPM-CANN-1B-unquantized with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "openbmb/BitCPM-CANN-1B-unquantized" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openbmb/BitCPM-CANN-1B-unquantized", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "openbmb/BitCPM-CANN-1B-unquantized" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openbmb/BitCPM-CANN-1B-unquantized", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use openbmb/BitCPM-CANN-1B-unquantized with Docker Model Runner:
docker model run hf.co/openbmb/BitCPM-CANN-1B-unquantized
Update example naming from BitCPM4 to BitCPM
Browse files- example/README.md +5 -5
example/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
#
|
| 2 |
|
| 3 |
-
This project provides scripts for continue pretraining (CPT) and supervised fine-tuning (SFT) of **
|
| 4 |
|
| 5 |
## File Description
|
| 6 |
|
|
@@ -47,7 +47,7 @@ The test dataset used is [C4-Pro](https://huggingface.co/datasets/gair-prox/c4-p
|
|
| 47 |
Modify the path configuration in `run.sh`:
|
| 48 |
|
| 49 |
```bash
|
| 50 |
-
MODEL_PATH="/path/to/
|
| 51 |
DATA_PATH="/path/to/c4-pro/data/your_file.parquet"
|
| 52 |
```
|
| 53 |
|
|
@@ -68,7 +68,7 @@ The test dataset used is [UltraChat 200k](https://huggingface.co/datasets/Huggin
|
|
| 68 |
Modify the path configuration in `run_sft.sh`:
|
| 69 |
|
| 70 |
```bash
|
| 71 |
-
MODEL_PATH="/path/to/
|
| 72 |
DATA_PATH="/path/to/ultrachat_200k/data/your_file.parquet"
|
| 73 |
```
|
| 74 |
|
|
@@ -100,4 +100,4 @@ Training log CSV files (corresponding to the loss curves above):
|
|
| 100 |
|
| 101 |
---
|
| 102 |
|
| 103 |
-
These scripts provide a convenient, ready-to-use toolkit for QAT-aware continued pre-training and fine-tuning of
|
|
|
|
| 1 |
+
# BitCPM Training Example
|
| 2 |
|
| 3 |
+
This project provides scripts for continue pretraining (CPT) and supervised fine-tuning (SFT) of **BitCPM-CANN-1B-unquantized**.
|
| 4 |
|
| 5 |
## File Description
|
| 6 |
|
|
|
|
| 47 |
Modify the path configuration in `run.sh`:
|
| 48 |
|
| 49 |
```bash
|
| 50 |
+
MODEL_PATH="/path/to/BitCPM-CANN-1B-unquantized/"
|
| 51 |
DATA_PATH="/path/to/c4-pro/data/your_file.parquet"
|
| 52 |
```
|
| 53 |
|
|
|
|
| 68 |
Modify the path configuration in `run_sft.sh`:
|
| 69 |
|
| 70 |
```bash
|
| 71 |
+
MODEL_PATH="/path/to/BitCPM-CANN-1B-unquantized/"
|
| 72 |
DATA_PATH="/path/to/ultrachat_200k/data/your_file.parquet"
|
| 73 |
```
|
| 74 |
|
|
|
|
| 100 |
|
| 101 |
---
|
| 102 |
|
| 103 |
+
These scripts provide a convenient, ready-to-use toolkit for QAT-aware continued pre-training and fine-tuning of BitCPM-CANN models, so you can quickly adapt the model to your own data and tasks while preserving ternary quantization constraints.
|