Instructions to use MagicHub/Chinese-llama2-CLAM-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MagicHub/Chinese-llama2-CLAM-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MagicHub/Chinese-llama2-CLAM-7b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MagicHub/Chinese-llama2-CLAM-7b") model = AutoModelForCausalLM.from_pretrained("MagicHub/Chinese-llama2-CLAM-7b") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use MagicHub/Chinese-llama2-CLAM-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MagicHub/Chinese-llama2-CLAM-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MagicHub/Chinese-llama2-CLAM-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/MagicHub/Chinese-llama2-CLAM-7b
- SGLang
How to use MagicHub/Chinese-llama2-CLAM-7b 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 "MagicHub/Chinese-llama2-CLAM-7b" \ --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": "MagicHub/Chinese-llama2-CLAM-7b", "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 "MagicHub/Chinese-llama2-CLAM-7b" \ --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": "MagicHub/Chinese-llama2-CLAM-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use MagicHub/Chinese-llama2-CLAM-7b with Docker Model Runner:
docker model run hf.co/MagicHub/Chinese-llama2-CLAM-7b
Update README.md
Browse files
README.md
CHANGED
|
@@ -32,7 +32,9 @@ python server.py --model llama-${model_name} --listen --listen-host 0.0.0.0 --li
|
|
| 32 |
```
|
| 33 |
如果服务正常启动,就可以通过该端口访问服务了 `${server_ip}:${port}`
|
| 34 |
|
| 35 |
-
####
|
|
|
|
|
|
|
| 36 |
|
| 37 |
```
|
| 38 |
import os,sys,argparse
|
|
|
|
| 32 |
```
|
| 33 |
如果服务正常启动,就可以通过该端口访问服务了 `${server_ip}:${port}`
|
| 34 |
|
| 35 |
+
#### Python script
|
| 36 |
+
|
| 37 |
+
See https://github.com/magichub-opensource/CLAM-Conversational-Language-AI-from-MagicData/blob/master/inference.py
|
| 38 |
|
| 39 |
```
|
| 40 |
import os,sys,argparse
|