Instructions to use tencent/Hy-MT2-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/Hy-MT2-7B 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-7B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tencent/Hy-MT2-7B") model = AutoModelForCausalLM.from_pretrained("tencent/Hy-MT2-7B") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -91,7 +91,7 @@ transformers>=5.6.0
|
|
| 91 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 92 |
import torch
|
| 93 |
|
| 94 |
-
model_path = "tencent/Hy-MT2-
|
| 95 |
|
| 96 |
# Load tokenizer
|
| 97 |
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
|
@@ -134,7 +134,7 @@ uv pip install --editable . --torch-backend=auto
|
|
| 134 |
Start the vLLM server:
|
| 135 |
|
| 136 |
```bash
|
| 137 |
-
vllm serve tencent/Hy-MT2-
|
| 138 |
```
|
| 139 |
|
| 140 |
### sglang
|
|
@@ -151,7 +151,7 @@ pip3 install -e "python"
|
|
| 151 |
Launch SGLang server:
|
| 152 |
|
| 153 |
```bash
|
| 154 |
-
python3 -m sglang.launch_server --model tencent/Hy-MT2-
|
| 155 |
```
|
| 156 |
|
| 157 |
### llama_cpp
|
|
@@ -207,18 +207,6 @@ For 1.8B and 7B, we recommend using the following parameters for inference. Note
|
|
| 207 |
}
|
| 208 |
```
|
| 209 |
|
| 210 |
-
For 30B-A3B, we recommend using the following parameters for inference. Note that our models do not have a default system_prompt.
|
| 211 |
-
|
| 212 |
-
```json
|
| 213 |
-
|
| 214 |
-
{
|
| 215 |
-
"temperature": 0.7,
|
| 216 |
-
"top_p": 1.0,
|
| 217 |
-
"top_k": -1,
|
| 218 |
-
"repetition_penalty": 1.0,
|
| 219 |
-
"max_tokens": 4096
|
| 220 |
-
}
|
| 221 |
-
```
|
| 222 |
|
| 223 |
## Model Training
|
| 224 |
Hy-MT2 provides a complete model training pipeline, supporting both full-parameter fine-tuning and LoRA fine-tuning, as well as multiple DeepSpeed ZeRO configurations and LLaMA-Factory integration.
|
|
|
|
| 91 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 92 |
import torch
|
| 93 |
|
| 94 |
+
model_path = "tencent/Hy-MT2-7B"
|
| 95 |
|
| 96 |
# Load tokenizer
|
| 97 |
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
|
|
|
| 134 |
Start the vLLM server:
|
| 135 |
|
| 136 |
```bash
|
| 137 |
+
vllm serve tencent/Hy-MT2-7B --tensor-parallel-size 1
|
| 138 |
```
|
| 139 |
|
| 140 |
### sglang
|
|
|
|
| 151 |
Launch SGLang server:
|
| 152 |
|
| 153 |
```bash
|
| 154 |
+
python3 -m sglang.launch_server --model tencent/Hy-MT2-7B --tp 1
|
| 155 |
```
|
| 156 |
|
| 157 |
### llama_cpp
|
|
|
|
| 207 |
}
|
| 208 |
```
|
| 209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
|
| 211 |
## Model Training
|
| 212 |
Hy-MT2 provides a complete model training pipeline, supporting both full-parameter fine-tuning and LoRA fine-tuning, as well as multiple DeepSpeed ZeRO configurations and LLaMA-Factory integration.
|