Instructions to use mymusise/CPM-Generate-distill with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mymusise/CPM-Generate-distill with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mymusise/CPM-Generate-distill")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mymusise/CPM-Generate-distill") model = AutoModelForCausalLM.from_pretrained("mymusise/CPM-Generate-distill") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use mymusise/CPM-Generate-distill with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mymusise/CPM-Generate-distill" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mymusise/CPM-Generate-distill", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mymusise/CPM-Generate-distill
- SGLang
How to use mymusise/CPM-Generate-distill 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 "mymusise/CPM-Generate-distill" \ --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": "mymusise/CPM-Generate-distill", "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 "mymusise/CPM-Generate-distill" \ --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": "mymusise/CPM-Generate-distill", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use mymusise/CPM-Generate-distill with Docker Model Runner:
docker model run hf.co/mymusise/CPM-Generate-distill
CPM-Generate-distill
CPM(Chinese Pre-Trained Language Models), which has 2.6B parameters, made by the research team of Beijing Zhiyuan Institute of artificial intelligence and Tsinghua University @TsinghuaAI.
repo: CPM-Generate The One Thing You Need to Know is this model is not uploaded by official, the conver script is here
And the CPM-Generate-distill is the distill model of CPM.
How to use
How to use this model directly from the 🤗/transformers library:
from transformers import TextGenerationPipeline, AutoTokenizer, AutoModelWithLMHead
tokenizer = AutoTokenizer.from_pretrained("mymusise/CPM-Generate-distill")
model = AutoModelWithLMHead.from_pretrained("mymusise/CPM-Generate-distill")
text_generater = TextGenerationPipeline(model, tokenizer)
print(text_generator('清华大学是', max_length=50, do_sample=True, top_p=0.9))
- Downloads last month
- 11
