Instructions to use Langboat/bloom-389m-zh with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Langboat/bloom-389m-zh with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Langboat/bloom-389m-zh")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Langboat/bloom-389m-zh") model = AutoModelForCausalLM.from_pretrained("Langboat/bloom-389m-zh") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Langboat/bloom-389m-zh with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Langboat/bloom-389m-zh" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Langboat/bloom-389m-zh", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Langboat/bloom-389m-zh
- SGLang
How to use Langboat/bloom-389m-zh 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 "Langboat/bloom-389m-zh" \ --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": "Langboat/bloom-389m-zh", "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 "Langboat/bloom-389m-zh" \ --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": "Langboat/bloom-389m-zh", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Langboat/bloom-389m-zh with Docker Model Runner:
docker model run hf.co/Langboat/bloom-389m-zh
词表裁剪的问题
你好,想请教个词表裁剪的问题。我们在做词表裁剪后,初始化tokenizer时,会出现
fast_tokenizer = TokenizerFast.from_file(fast_tokenizer_file)
Exception: data did not match any variant of untagged enum ModelWrapper at line 2957 column 3
的异常。
只有当我们把merges置空,才能正常初始化。请问遇见过类似的错误吗?你们的词表裁剪是怎么做的?感谢~
got it~~~~~~~
不但需要确保merges的两个token都在 vocab中,它们的合成词也需要在
for meg in old_merges:
tokens = meg.strip().split()
new_token = "".join((tokens[0], tokens[1]))
if all(token in continuous_vocab for token in tokens) and new_token in continuous_vocab:
new_tokenizer_data['model']['merges'].append(meg)