Instructions to use junnyu/roformer_chinese_sim_char_small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use junnyu/roformer_chinese_sim_char_small with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="junnyu/roformer_chinese_sim_char_small")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("junnyu/roformer_chinese_sim_char_small") model = AutoModelForCausalLM.from_pretrained("junnyu/roformer_chinese_sim_char_small", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use junnyu/roformer_chinese_sim_char_small with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "junnyu/roformer_chinese_sim_char_small" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "junnyu/roformer_chinese_sim_char_small", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/junnyu/roformer_chinese_sim_char_small
- SGLang
How to use junnyu/roformer_chinese_sim_char_small 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 "junnyu/roformer_chinese_sim_char_small" \ --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": "junnyu/roformer_chinese_sim_char_small", "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 "junnyu/roformer_chinese_sim_char_small" \ --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": "junnyu/roformer_chinese_sim_char_small", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use junnyu/roformer_chinese_sim_char_small with Docker Model Runner:
docker model run hf.co/junnyu/roformer_chinese_sim_char_small
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: zh
|
| 3 |
+
tags:
|
| 4 |
+
- roformer
|
| 5 |
+
- pytorch
|
| 6 |
+
- tf2.0
|
| 7 |
+
widget:
|
| 8 |
+
- text: "今天[MASK]很好,我想去公园玩!"
|
| 9 |
+
---
|
| 10 |
+
## 介绍
|
| 11 |
+
### tf版本
|
| 12 |
+
https://github.com/ZhuiyiTechnology/roformer
|
| 13 |
+
|
| 14 |
+
### pytorch版本+tf2.0版本
|
| 15 |
+
https://github.com/JunnYu/RoFormer_pytorch
|