Text Generation
Transformers
Safetensors
English
qwen2
chat
abliterated
uncensored
conversational
text-generation-inference
Instructions to use ibrahimkettaneh/QwQ-32B-Preview-abliterated-4.5bpw-h8-exl2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ibrahimkettaneh/QwQ-32B-Preview-abliterated-4.5bpw-h8-exl2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ibrahimkettaneh/QwQ-32B-Preview-abliterated-4.5bpw-h8-exl2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("ibrahimkettaneh/QwQ-32B-Preview-abliterated-4.5bpw-h8-exl2") model = AutoModelForMultimodalLM.from_pretrained("ibrahimkettaneh/QwQ-32B-Preview-abliterated-4.5bpw-h8-exl2") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ibrahimkettaneh/QwQ-32B-Preview-abliterated-4.5bpw-h8-exl2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ibrahimkettaneh/QwQ-32B-Preview-abliterated-4.5bpw-h8-exl2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ibrahimkettaneh/QwQ-32B-Preview-abliterated-4.5bpw-h8-exl2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ibrahimkettaneh/QwQ-32B-Preview-abliterated-4.5bpw-h8-exl2
- SGLang
How to use ibrahimkettaneh/QwQ-32B-Preview-abliterated-4.5bpw-h8-exl2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ibrahimkettaneh/QwQ-32B-Preview-abliterated-4.5bpw-h8-exl2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ibrahimkettaneh/QwQ-32B-Preview-abliterated-4.5bpw-h8-exl2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ibrahimkettaneh/QwQ-32B-Preview-abliterated-4.5bpw-h8-exl2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ibrahimkettaneh/QwQ-32B-Preview-abliterated-4.5bpw-h8-exl2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ibrahimkettaneh/QwQ-32B-Preview-abliterated-4.5bpw-h8-exl2 with Docker Model Runner:
docker model run hf.co/ibrahimkettaneh/QwQ-32B-Preview-abliterated-4.5bpw-h8-exl2
Update README.md
Browse files
README.md
CHANGED
|
@@ -19,13 +19,102 @@ library_name: transformers
|
|
| 19 |
|
| 20 |
# Credits goes to all those who have contributed to the community, in this case, specifically: [huihui-ai](https://huggingface.co/huihui-ai)/[QwQ-32B-Preview-abliterated](https://huggingface.co/huihui-ai/QwQ-32B-Preview-abliterated)
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
This is an uncensored version of [Qwen/QwQ-32B-Preview](https://huggingface.co/Qwen/QwQ-32B-Preview) created with abliteration (see [remove-refusals-with-transformers](https://github.com/Sumandora/remove-refusals-with-transformers) to know more about it).
|
|
|
|
| 24 |
This is a crude, proof-of-concept implementation to remove refusals from an LLM model without using TransformerLens.
|
| 25 |
|
| 26 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
-
You can use [huihui_ai/qwq-abliterated](https://ollama.com/huihui_ai/qwq-abliterated) directly,
|
| 29 |
```
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
```
|
|
|
|
| 19 |
|
| 20 |
# Credits goes to all those who have contributed to the community, in this case, specifically: [huihui-ai](https://huggingface.co/huihui-ai)/[QwQ-32B-Preview-abliterated](https://huggingface.co/huihui-ai/QwQ-32B-Preview-abliterated)
|
| 21 |
|
| 22 |
+
# Benchmark
|
| 23 |
+
|
| 24 |
+

|
| 25 |
+
|
| 26 |
+
Source: [🐺🐦⬛ LLM Comparison/Test: 25 SOTA LLMs (including QwQ) through 59 MMLU-Pro CS benchmark runs](https://huggingface.co/blog/wolfram/llm-comparison-test-2024-12-04)
|
| 27 |
+
|
| 28 |
+
Credits go to for their helpful and informative benchmark: [Wolfram Ravenwolf](https://huggingface.co/wolfram)
|
| 29 |
+
|
| 30 |
+
# Context
|
| 31 |
|
| 32 |
This is an uncensored version of [Qwen/QwQ-32B-Preview](https://huggingface.co/Qwen/QwQ-32B-Preview) created with abliteration (see [remove-refusals-with-transformers](https://github.com/Sumandora/remove-refusals-with-transformers) to know more about it).
|
| 33 |
+
|
| 34 |
This is a crude, proof-of-concept implementation to remove refusals from an LLM model without using TransformerLens.
|
| 35 |
|
| 36 |
+
# QwQ-32B-Preview
|
| 37 |
+
|
| 38 |
+
## Introduction
|
| 39 |
+
|
| 40 |
+
**QwQ-32B-Preview** is an experimental research model developed by the Qwen Team, focused on advancing AI reasoning capabilities. As a preview release, it demonstrates promising analytical abilities while having several important limitations:
|
| 41 |
+
|
| 42 |
+
1. **Language Mixing and Code-Switching**: The model may mix languages or switch between them unexpectedly, affecting response clarity.
|
| 43 |
+
2. **Recursive Reasoning Loops**: The model may enter circular reasoning patterns, leading to lengthy responses without a conclusive answer.
|
| 44 |
+
3. **Safety and Ethical Considerations**: The model requires enhanced safety measures to ensure reliable and secure performance, and users should exercise caution when deploying it.
|
| 45 |
+
4. **Performance and Benchmark Limitations**: The model excels in math and coding but has room for improvement in other areas, such as common sense reasoning and nuanced language understanding.
|
| 46 |
+
|
| 47 |
+
**Specification**:
|
| 48 |
+
- Type: Causal Language Models
|
| 49 |
+
- Training Stage: Pretraining & Post-training
|
| 50 |
+
- Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
|
| 51 |
+
- Number of Parameters: 32.5B
|
| 52 |
+
- Number of Paramaters (Non-Embedding): 31.0B
|
| 53 |
+
- Number of Layers: 64
|
| 54 |
+
- Number of Attention Heads (GQA): 40 for Q and 8 for KV
|
| 55 |
+
- Context Length: Full 32,768 tokens
|
| 56 |
+
|
| 57 |
+
For more details, please refer to our [blog](https://qwenlm.github.io/blog/qwq-32b-preview/). You can also check Qwen2.5 [GitHub](https://github.com/QwenLM/Qwen2.5), and [Documentation](https://qwen.readthedocs.io/en/latest/).
|
| 58 |
+
|
| 59 |
+
## Requirements
|
| 60 |
+
|
| 61 |
+
The code of Qwen2.5 has been in the latest Hugging face `transformers` and we advise you to use the latest version of `transformers`.
|
| 62 |
+
|
| 63 |
+
With `transformers<4.37.0`, you will encounter the following error:
|
| 64 |
+
```
|
| 65 |
+
KeyError: 'qwen2'
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## Quickstart
|
| 69 |
+
|
| 70 |
+
Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
|
| 71 |
+
|
| 72 |
+
```python
|
| 73 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 74 |
+
model_name = "Qwen/QwQ-32B-Preview"
|
| 75 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 76 |
+
model_name,
|
| 77 |
+
torch_dtype="auto",
|
| 78 |
+
device_map="auto"
|
| 79 |
+
)
|
| 80 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 81 |
+
prompt = "How many r in strawberry."
|
| 82 |
+
messages = [
|
| 83 |
+
{"role": "system", "content": "You are a helpful and harmless assistant. You are Qwen developed by Alibaba. You should think step-by-step."},
|
| 84 |
+
{"role": "user", "content": prompt}
|
| 85 |
+
]
|
| 86 |
+
text = tokenizer.apply_chat_template(
|
| 87 |
+
messages,
|
| 88 |
+
tokenize=False,
|
| 89 |
+
add_generation_prompt=True
|
| 90 |
+
)
|
| 91 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 92 |
+
generated_ids = model.generate(
|
| 93 |
+
**model_inputs,
|
| 94 |
+
max_new_tokens=512
|
| 95 |
+
)
|
| 96 |
+
generated_ids = [
|
| 97 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
| 98 |
+
]
|
| 99 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
## Citation
|
| 103 |
+
|
| 104 |
+
If you find our work helpful, feel free to give us a cite.
|
| 105 |
|
|
|
|
| 106 |
```
|
| 107 |
+
@misc{qwq-32b-preview,
|
| 108 |
+
title = {QwQ: Reflect Deeply on the Boundaries of the Unknown},
|
| 109 |
+
url = {https://qwenlm.github.io/blog/qwq-32b-preview/},
|
| 110 |
+
author = {Qwen Team},
|
| 111 |
+
month = {November},
|
| 112 |
+
year = {2024}
|
| 113 |
+
}
|
| 114 |
+
@article{qwen2,
|
| 115 |
+
title={Qwen2 Technical Report},
|
| 116 |
+
author={An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},
|
| 117 |
+
journal={arXiv preprint arXiv:2407.10671},
|
| 118 |
+
year={2024}
|
| 119 |
+
}
|
| 120 |
```
|