|
--- |
|
license: apache-2.0 |
|
license_link: https://huggingface.co./Qwen/QwQ-32B-Preview/blob/main/LICENSE |
|
language: |
|
- en |
|
base_model: |
|
- Qwen/QwQ-32B-Preview |
|
pipeline_tag: text-generation |
|
tags: |
|
- gptqmodel |
|
- modelcloud |
|
- chat |
|
- qwen2 |
|
- qwq |
|
- instruct |
|
- gptq |
|
- gguf |
|
--- |
|
|
|
![image/png](https://cdn-uploads.huggingface.co/production/uploads/641c13e7999935676ec7bc03/F7pXCPgPKmXdW_jWFQQ6L.png) |
|
|
|
## Example with transformers: |
|
```python |
|
import torch |
|
from transformers import AutoTokenizer, AutoModelForCausalLM |
|
|
|
model_id = "ModelCloud/QwQ-32B-Preview-gguf-vortex-v1" |
|
filename = "QwQ-32B-Preview-Q4_K_M.gguf" |
|
|
|
tokenizer = AutoTokenizer.from_pretrained(model_id, gguf_file=filename) |
|
model = AutoModelForCausalLM.from_pretrained(model_id, gguf_file=filename, device_map="cuda", torch_dtype=torch.float16) |
|
|
|
messages = [ |
|
{"role": "system", "content": "You are a helpful and harmless assistant. You are Qwen developed by Alibaba. You should think step-by-step."}, |
|
{"role": "user", "content": "How can I design a data structure in C++ to store the top 5 largest integer numbers?"}, |
|
] |
|
input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt") |
|
|
|
outputs = model.generate(input_ids=input_tensor.to(model.device), max_new_tokens=512) |
|
result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=True) |
|
|
|
print(result) |
|
``` |