Update README.md
This commit is contained in:
@@ -49,8 +49,8 @@ Also check out our [AWQ documentation](https://qwen.readthedocs.io/en/latest/qua
|
|||||||
Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
|
Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
from modelscope import AutoModelForCausalLM, AutoTokenizer
|
||||||
model_name = "Qwen/Qwen2.5-14B-Instruct-AWQ"
|
model_name = "qwen/Qwen2.5-14B-Instruct-AWQ"
|
||||||
model = AutoModelForCausalLM.from_pretrained(
|
model = AutoModelForCausalLM.from_pretrained(
|
||||||
model_name,
|
model_name,
|
||||||
torch_dtype="auto",
|
torch_dtype="auto",
|
||||||
@@ -76,6 +76,7 @@ generated_ids = [
|
|||||||
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
||||||
]
|
]
|
||||||
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
||||||
|
print(response)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Processing Long Texts
|
### Processing Long Texts
|
||||||
|
|||||||
Reference in New Issue
Block a user