tatsu-lab/alpaca
Viewer • Updated • 52k • 101k • 959
How to use p208p2002/bloomz-zh-instruct-560M with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="p208p2002/bloomz-zh-instruct-560M") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("p208p2002/bloomz-zh-instruct-560M")
model = AutoModelForCausalLM.from_pretrained("p208p2002/bloomz-zh-instruct-560M")How to use p208p2002/bloomz-zh-instruct-560M with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "p208p2002/bloomz-zh-instruct-560M"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "p208p2002/bloomz-zh-instruct-560M",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/p208p2002/bloomz-zh-instruct-560M
How to use p208p2002/bloomz-zh-instruct-560M with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "p208p2002/bloomz-zh-instruct-560M" \
--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": "p208p2002/bloomz-zh-instruct-560M",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "p208p2002/bloomz-zh-instruct-560M" \
--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": "p208p2002/bloomz-zh-instruct-560M",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use p208p2002/bloomz-zh-instruct-560M with Docker Model Runner:
docker model run hf.co/p208p2002/bloomz-zh-instruct-560M
具備繁體中文指令遵循能力的bloomz
請搭配Alpaca模板使用
PROMPT_DICT = {
"prompt_input": (
"Below is an instruction that describes a task, paired with an input that provides further context. "
"Write a response that appropriately completes the request.\n\n"
"### Instruction:\n{instruction}\n\n### Input:\n{input}\n\n### Response:"
),
"prompt_no_input": (
"Below is an instruction that describes a task. "
"Write a response that appropriately completes the request.\n\n"
"### Instruction:\n{instruction}\n\n### Response:"
),
}