Instructions to use tencent/Hy-MT2-30B-A3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/Hy-MT2-30B-A3B with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="tencent/Hy-MT2-30B-A3B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tencent/Hy-MT2-30B-A3B") model = AutoModelForCausalLM.from_pretrained("tencent/Hy-MT2-30B-A3B") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
## 模型推理方式
|
| 2 |
|
|
|
|
|
|
|
| 3 |
transformers>=5.6.0
|
| 4 |
|
| 5 |
```python
|
|
@@ -35,6 +37,40 @@ response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_spe
|
|
| 35 |
print(response)
|
| 36 |
```
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
## 翻译指令推荐模板
|
| 39 |
|
| 40 |
| 类型 | 模板 | 说明 |
|
|
|
|
| 1 |
## 模型推理方式
|
| 2 |
|
| 3 |
+
### transformers
|
| 4 |
+
|
| 5 |
transformers>=5.6.0
|
| 6 |
|
| 7 |
```python
|
|
|
|
| 37 |
print(response)
|
| 38 |
```
|
| 39 |
|
| 40 |
+
### vllm
|
| 41 |
+
|
| 42 |
+
Build vLLM from source:
|
| 43 |
+
```bash
|
| 44 |
+
uv venv --python 3.12 --seed --managed-python
|
| 45 |
+
source .venv/bin/activate
|
| 46 |
+
git clone https://github.com/vllm-project/vllm.git
|
| 47 |
+
cd vllm
|
| 48 |
+
uv pip install --editable . --torch-backend=auto
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
Start the vLLM server:
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
vllm serve tencent/Hy-MT2-30B-A3B --tensor-parallel-size 1
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
### sglang
|
| 58 |
+
|
| 59 |
+
Build SGLang from source:
|
| 60 |
+
```bash
|
| 61 |
+
git clone https://github.com/sgl-project/sglang
|
| 62 |
+
cd sglang
|
| 63 |
+
pip3 install pip --upgrade
|
| 64 |
+
pip3 install "transformers>=5.6.0"
|
| 65 |
+
pip3 install -e "python"
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
Launch SGLang server:
|
| 69 |
+
|
| 70 |
+
```bash
|
| 71 |
+
python3 -m sglang.launch_server --model tencent/Hy-MT2-30B-A3B --tp 1
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
## 翻译指令推荐模板
|
| 75 |
|
| 76 |
| 类型 | 模板 | 说明 |
|