Text Generation
Transformers
Safetensors
English
Chinese
baichuan
custom_code
text-generation-inference
4-bit precision
Instructions to use csdc-atl/buffer-baichuan2-13B-rag-4bits with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use csdc-atl/buffer-baichuan2-13B-rag-4bits with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="csdc-atl/buffer-baichuan2-13B-rag-4bits", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("csdc-atl/buffer-baichuan2-13B-rag-4bits", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use csdc-atl/buffer-baichuan2-13B-rag-4bits with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "csdc-atl/buffer-baichuan2-13B-rag-4bits" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "csdc-atl/buffer-baichuan2-13B-rag-4bits", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/csdc-atl/buffer-baichuan2-13B-rag-4bits
- SGLang
How to use csdc-atl/buffer-baichuan2-13B-rag-4bits 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 "csdc-atl/buffer-baichuan2-13B-rag-4bits" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "csdc-atl/buffer-baichuan2-13B-rag-4bits", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "csdc-atl/buffer-baichuan2-13B-rag-4bits" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "csdc-atl/buffer-baichuan2-13B-rag-4bits", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use csdc-atl/buffer-baichuan2-13B-rag-4bits with Docker Model Runner:
docker model run hf.co/csdc-atl/buffer-baichuan2-13B-rag-4bits
Xiaoting He commited on
Commit ·
3c8bbd7
1
Parent(s): 0b8561b
4bits
Browse files- config.json +1 -1
- quantize_config.json +1 -1
- tokenization_baichuan.py +5 -6
config.json
CHANGED
|
@@ -35,6 +35,6 @@
|
|
| 35 |
"sym": true,
|
| 36 |
"true_sequential": true,
|
| 37 |
"model_name_or_path": null,
|
| 38 |
-
"model_file_base_name":
|
| 39 |
}
|
| 40 |
}
|
|
|
|
| 35 |
"sym": true,
|
| 36 |
"true_sequential": true,
|
| 37 |
"model_name_or_path": null,
|
| 38 |
+
"model_file_base_name": "model"
|
| 39 |
}
|
| 40 |
}
|
quantize_config.json
CHANGED
|
@@ -7,5 +7,5 @@
|
|
| 7 |
"sym": true,
|
| 8 |
"true_sequential": true,
|
| 9 |
"model_name_or_path": null,
|
| 10 |
-
"model_file_base_name":
|
| 11 |
}
|
|
|
|
| 7 |
"sym": true,
|
| 8 |
"true_sequential": true,
|
| 9 |
"model_name_or_path": null,
|
| 10 |
+
"model_file_base_name": "model"
|
| 11 |
}
|
tokenization_baichuan.py
CHANGED
|
@@ -68,6 +68,11 @@ class BaichuanTokenizer(PreTrainedTokenizer):
|
|
| 68 |
if isinstance(pad_token, str)
|
| 69 |
else pad_token
|
| 70 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
super().__init__(
|
| 72 |
bos_token=bos_token,
|
| 73 |
eos_token=eos_token,
|
|
@@ -79,12 +84,6 @@ class BaichuanTokenizer(PreTrainedTokenizer):
|
|
| 79 |
clean_up_tokenization_spaces=clean_up_tokenization_spaces,
|
| 80 |
**kwargs,
|
| 81 |
)
|
| 82 |
-
self.vocab_file = vocab_file
|
| 83 |
-
self.add_bos_token = add_bos_token
|
| 84 |
-
self.add_eos_token = add_eos_token
|
| 85 |
-
self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
|
| 86 |
-
self.sp_model.Load(vocab_file)
|
| 87 |
-
|
| 88 |
def __getstate__(self):
|
| 89 |
state = self.__dict__.copy()
|
| 90 |
state["sp_model"] = None
|
|
|
|
| 68 |
if isinstance(pad_token, str)
|
| 69 |
else pad_token
|
| 70 |
)
|
| 71 |
+
self.vocab_file = vocab_file
|
| 72 |
+
self.add_bos_token = add_bos_token
|
| 73 |
+
self.add_eos_token = add_eos_token
|
| 74 |
+
self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
|
| 75 |
+
self.sp_model.Load(vocab_file)
|
| 76 |
super().__init__(
|
| 77 |
bos_token=bos_token,
|
| 78 |
eos_token=eos_token,
|
|
|
|
| 84 |
clean_up_tokenization_spaces=clean_up_tokenization_spaces,
|
| 85 |
**kwargs,
|
| 86 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
def __getstate__(self):
|
| 88 |
state = self.__dict__.copy()
|
| 89 |
state["sp_model"] = None
|