Update README.md
Browse files
README.md
CHANGED
|
@@ -99,15 +99,10 @@ For more details, please refer to our blog post [Qwen3-Next](https://qwenlm.gith
|
|
| 99 |
|
| 100 |
## Quickstart
|
| 101 |
|
| 102 |
-
The code for Qwen3-Next has been merged into the main branch of Hugging Face `transformers
|
| 103 |
-
We strongly recommend using the latest `transformers` main branch.
|
| 104 |
|
| 105 |
```shell
|
| 106 |
-
# install from the latest main
|
| 107 |
pip install git+https://github.com/huggingface/transformers.git@main
|
| 108 |
-
|
| 109 |
-
# install the specific commit that includes the qwen3_next support
|
| 110 |
-
# pip install git+https://github.com/huggingface/transformers.git@b9282355bea846b54ed850a066901496b19da654
|
| 111 |
```
|
| 112 |
|
| 113 |
With earlier versions, you will encounter the following error:
|
|
@@ -125,14 +120,14 @@ model_name = "Qwen/Qwen3-Next-80B-A3B-Instruct"
|
|
| 125 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 126 |
model = AutoModelForCausalLM.from_pretrained(
|
| 127 |
model_name,
|
| 128 |
-
|
| 129 |
-
device_map="auto"
|
| 130 |
)
|
| 131 |
|
| 132 |
# prepare the model input
|
| 133 |
prompt = "Give me a short introduction to large language model."
|
| 134 |
messages = [
|
| 135 |
-
{"role": "user", "content": prompt}
|
| 136 |
]
|
| 137 |
text = tokenizer.apply_chat_template(
|
| 138 |
messages,
|
|
@@ -144,7 +139,7 @@ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
|
| 144 |
# conduct text completion
|
| 145 |
generated_ids = model.generate(
|
| 146 |
**model_inputs,
|
| 147 |
-
max_new_tokens=16384
|
| 148 |
)
|
| 149 |
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
|
| 150 |
|
|
@@ -161,8 +156,8 @@ print("content:", content)
|
|
| 161 |
> It is recommended to adopt a dedicated inference framework, e.g., SGLang and vLLM, for inference tasks.
|
| 162 |
|
| 163 |
> [!Tip]
|
| 164 |
-
>
|
| 165 |
-
> See
|
| 166 |
|
| 167 |
|
| 168 |
## Deployment
|
|
|
|
| 99 |
|
| 100 |
## Quickstart
|
| 101 |
|
| 102 |
+
The code for Qwen3-Next has been merged into the main branch of Hugging Face `transformers`.
|
|
|
|
| 103 |
|
| 104 |
```shell
|
|
|
|
| 105 |
pip install git+https://github.com/huggingface/transformers.git@main
|
|
|
|
|
|
|
|
|
|
| 106 |
```
|
| 107 |
|
| 108 |
With earlier versions, you will encounter the following error:
|
|
|
|
| 120 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 121 |
model = AutoModelForCausalLM.from_pretrained(
|
| 122 |
model_name,
|
| 123 |
+
dtype="auto",
|
| 124 |
+
device_map="auto",
|
| 125 |
)
|
| 126 |
|
| 127 |
# prepare the model input
|
| 128 |
prompt = "Give me a short introduction to large language model."
|
| 129 |
messages = [
|
| 130 |
+
{"role": "user", "content": prompt},
|
| 131 |
]
|
| 132 |
text = tokenizer.apply_chat_template(
|
| 133 |
messages,
|
|
|
|
| 139 |
# conduct text completion
|
| 140 |
generated_ids = model.generate(
|
| 141 |
**model_inputs,
|
| 142 |
+
max_new_tokens=16384,
|
| 143 |
)
|
| 144 |
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
|
| 145 |
|
|
|
|
| 156 |
> It is recommended to adopt a dedicated inference framework, e.g., SGLang and vLLM, for inference tasks.
|
| 157 |
|
| 158 |
> [!Tip]
|
| 159 |
+
> Depending on the inference settings, you may observe better efficiency with [`flash-linear-attention`](https://github.com/fla-org/flash-linear-attention#installation) and [`causal-conv1d`](https://github.com/Dao-AILab/causal-conv1d).
|
| 160 |
+
> See the above links for detailed instructions and requirements.
|
| 161 |
|
| 162 |
|
| 163 |
## Deployment
|