Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,104 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
base_model:
|
| 6 |
+
- Qwen/Qwen3-0.6B
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
+
library_name: transformers
|
| 9 |
+
tags:
|
| 10 |
+
- text-generation-inference
|
| 11 |
+
- moe
|
| 12 |
+
- moderately abliterated variant
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# **Qwen3-0.6B-ft-bf16**
|
| 16 |
+
|
| 17 |
+
> **Qwen3-0.6B-ft-bf16** is a fine-tuned, moderately abliterated variant based on **Qwen3-0.6B**, the latest generation of large language models in the Qwen series. This version emphasizes **improved context awareness** and **balanced behavioral flexibility**, offering reliable performance across a wide range of natural language tasks. It integrates moderate experimental freedoms while maintaining the core strengths of Qwen3, including instruction-following, multilingual understanding, and strong reasoning capabilities.
|
| 18 |
+
|
| 19 |
+
### Key Highlights:
|
| 20 |
+
|
| 21 |
+
- **Improved Context Awareness**: Enhanced ability to maintain and utilize long-range conversational context, particularly useful for multi-turn dialogues, summarization, and document-based reasoning tasks.
|
| 22 |
+
- **Moderate Abliteration**: Introduces moderate experimental freedoms to unlock more dynamic and expressive model behavior without compromising alignment or safety.
|
| 23 |
+
- **Thinking Mode Support**: Capable of switching between deep reasoning mode and lightweight conversational mode for task-optimized performance.
|
| 24 |
+
- **Multilingual Proficiency**: Supports 100+ languages and dialects for translation and instruction-following in multilingual settings.
|
| 25 |
+
- **Instruction and Agent Alignment**: Performs well in instruction-following, tool integration, and agent-based interactions with external environments.
|
| 26 |
+
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
## Quickstart with 🤗 Transformers
|
| 30 |
+
|
| 31 |
+
```bash
|
| 32 |
+
pip install transformers==4.51.3
|
| 33 |
+
pip install huggingface_hub[hf_xet]
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
```python
|
| 37 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 38 |
+
|
| 39 |
+
model_name = "prithivMLmods/Qwen3-0.6B-ft-bf16"
|
| 40 |
+
|
| 41 |
+
# Load tokenizer and model
|
| 42 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 43 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 44 |
+
model_name,
|
| 45 |
+
torch_dtype="auto",
|
| 46 |
+
device_map="auto"
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
# Define prompt and apply chat template
|
| 50 |
+
prompt = "How does a rocket reach escape velocity?"
|
| 51 |
+
messages = [{"role": "user", "content": prompt}]
|
| 52 |
+
text = tokenizer.apply_chat_template(
|
| 53 |
+
messages,
|
| 54 |
+
tokenize=False,
|
| 55 |
+
add_generation_prompt=True,
|
| 56 |
+
enable_thinking=True
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
# Tokenize input
|
| 60 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 61 |
+
|
| 62 |
+
# Generate response
|
| 63 |
+
generated_ids = model.generate(
|
| 64 |
+
**model_inputs,
|
| 65 |
+
max_new_tokens=32768
|
| 66 |
+
)
|
| 67 |
+
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
|
| 68 |
+
|
| 69 |
+
# Optional: Separate thinking content
|
| 70 |
+
try:
|
| 71 |
+
index = len(output_ids) - output_ids[::-1].index(151668) # token ID for </think>
|
| 72 |
+
except ValueError:
|
| 73 |
+
index = 0
|
| 74 |
+
|
| 75 |
+
thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
|
| 76 |
+
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
|
| 77 |
+
|
| 78 |
+
print("thinking content:", thinking_content)
|
| 79 |
+
print("content:", content)
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
---
|
| 83 |
+
|
| 84 |
+
## Recommended Settings
|
| 85 |
+
|
| 86 |
+
- **Sampling (thinking mode)**:
|
| 87 |
+
- `temperature=0.6`, `top_p=0.95`, `top_k=20`, `min_p=0.0`
|
| 88 |
+
- **Sampling (non-thinking mode)**:
|
| 89 |
+
- `temperature=0.7`, `top_p=0.8`, `top_k=20`, `min_p=0.0`
|
| 90 |
+
- **Max tokens**:
|
| 91 |
+
- General: `32768`
|
| 92 |
+
- Complex problems: `38912`
|
| 93 |
+
|
| 94 |
+
---
|
| 95 |
+
|
| 96 |
+
## Prompting Tips
|
| 97 |
+
|
| 98 |
+
- **Math**:
|
| 99 |
+
Include: *"Please reason step by step, and put your final answer within \boxed{}."*
|
| 100 |
+
- **MCQs**:
|
| 101 |
+
Format response as JSON:
|
| 102 |
+
`{"answer": "B"}`
|
| 103 |
+
- **Multi-Turn Chats**:
|
| 104 |
+
Store only the final response in conversation history; omit internal reasoning.
|