Text Generation
Transformers
Safetensors
Chinese
English
qwen3
mental-health
psychological-counseling
chinese
long-context
dialogue
campus-counseling
conversational
text-generation-inference
Instructions to use EdwinUstb/CPCD-Chat-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use EdwinUstb/CPCD-Chat-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="EdwinUstb/CPCD-Chat-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("EdwinUstb/CPCD-Chat-4B") model = AutoModelForCausalLM.from_pretrained("EdwinUstb/CPCD-Chat-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use EdwinUstb/CPCD-Chat-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "EdwinUstb/CPCD-Chat-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EdwinUstb/CPCD-Chat-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/EdwinUstb/CPCD-Chat-4B
- SGLang
How to use EdwinUstb/CPCD-Chat-4B 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 "EdwinUstb/CPCD-Chat-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EdwinUstb/CPCD-Chat-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "EdwinUstb/CPCD-Chat-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EdwinUstb/CPCD-Chat-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use EdwinUstb/CPCD-Chat-4B with Docker Model Runner:
docker model run hf.co/EdwinUstb/CPCD-Chat-4B
| --- | |
| frameworks: | |
| - Pytorch | |
| license: Apache License 2.0 | |
| tags: [] | |
| tasks: | |
| - text-generation | |
| #model-type: | |
| ##如 gpt、phi、llama、chatglm、baichuan 等 | |
| #- gpt | |
| #domain: | |
| ##如 nlp、cv、audio、multi-modal | |
| #- nlp | |
| #language: | |
| ##语言代码列表 https://help.aliyun.com/document_detail/215387.html?spm=a2c4g.11186623.0.0.9f8d7467kni6Aa | |
| #- cn | |
| #metrics: | |
| ##如 CIDEr、Blue、ROUGE 等 | |
| #- CIDEr | |
| #tags: | |
| ##各种自定义,包括 pretrained、fine-tuned、instruction-tuned、RL-tuned 等训练方法和其他 | |
| #- pretrained | |
| #tools: | |
| ##如 vllm、fastchat、llamacpp、AdaSeq 等 | |
| #- vllm | |
| --- | |
| ### 当前模型的贡献者未提供更加详细的模型介绍。模型文件和权重,可浏览“模型文件”页面获取。 | |
| #### 您可以通过如下git clone命令,或者ModelScope SDK来下载模型 | |
| SDK下载 | |
| ```bash | |
| #安装ModelScope | |
| pip install modelscope | |
| ``` | |
| ```python | |
| #SDK模型下载 | |
| from modelscope import snapshot_download | |
| model_dir = snapshot_download('gouchaogui/CPCD-Chat-4B') | |
| ``` | |
| Git下载 | |
| ``` | |
| #Git模型下载 | |
| git clone https://www.modelscope.cn/gouchaogui/CPCD-Chat-4B.git | |
| ``` | |
| <p style="color: lightgrey;">如果您是本模型的贡献者,我们邀请您根据<a href="https://modelscope.cn/docs/ModelScope%E6%A8%A1%E5%9E%8B%E6%8E%A5%E5%85%A5%E6%B5%81%E7%A8%8B%E6%A6%82%E8%A7%88" style="color: lightgrey; text-decoration: underline;">模型贡献文档</a>,及时完善模型卡片内容。</p> |