Update README.md
Browse files
README.md
CHANGED
|
@@ -1,199 +1,135 @@
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
-
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
|
| 9 |
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
-
##
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
- **Developed by:** [More Information Needed]
|
| 21 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
-
- **Model type:** [More Information Needed]
|
| 24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
-
- **License:** [More Information Needed]
|
| 26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
|
| 28 |
-
##
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
- **Repository:** [More Information Needed]
|
| 33 |
-
- **Paper [optional]:** [More Information Needed]
|
| 34 |
-
- **Demo [optional]:** [More Information Needed]
|
| 35 |
|
| 36 |
-
##
|
| 37 |
|
| 38 |
-
|
| 39 |
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
-
|
| 49 |
|
| 50 |
-
|
| 51 |
|
| 52 |
-
|
|
|
|
|
|
|
| 53 |
|
| 54 |
-
|
| 55 |
|
| 56 |
-
|
|
|
|
| 57 |
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
-
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
|
|
|
| 63 |
|
| 64 |
-
|
| 65 |
|
| 66 |
-
|
|
|
|
| 67 |
|
| 68 |
-
|
|
|
|
|
|
|
| 69 |
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
-
|
| 75 |
|
| 76 |
-
|
| 77 |
|
| 78 |
-
##
|
| 79 |
|
| 80 |
-
|
| 81 |
|
| 82 |
-
|
| 83 |
|
| 84 |
-
|
| 85 |
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
#### Preprocessing [optional]
|
| 89 |
-
|
| 90 |
-
[More Information Needed]
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
#### Training Hyperparameters
|
| 94 |
-
|
| 95 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 96 |
-
|
| 97 |
-
#### Speeds, Sizes, Times [optional]
|
| 98 |
-
|
| 99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 100 |
-
|
| 101 |
-
[More Information Needed]
|
| 102 |
-
|
| 103 |
-
## Evaluation
|
| 104 |
-
|
| 105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 106 |
-
|
| 107 |
-
### Testing Data, Factors & Metrics
|
| 108 |
-
|
| 109 |
-
#### Testing Data
|
| 110 |
-
|
| 111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 112 |
-
|
| 113 |
-
[More Information Needed]
|
| 114 |
-
|
| 115 |
-
#### Factors
|
| 116 |
-
|
| 117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
-
|
| 119 |
-
[More Information Needed]
|
| 120 |
-
|
| 121 |
-
#### Metrics
|
| 122 |
-
|
| 123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
-
|
| 125 |
-
[More Information Needed]
|
| 126 |
-
|
| 127 |
-
### Results
|
| 128 |
-
|
| 129 |
-
[More Information Needed]
|
| 130 |
-
|
| 131 |
-
#### Summary
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
## Model Examination [optional]
|
| 136 |
-
|
| 137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
-
|
| 139 |
-
[More Information Needed]
|
| 140 |
-
|
| 141 |
-
## Environmental Impact
|
| 142 |
-
|
| 143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
-
|
| 145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
-
|
| 147 |
-
- **Hardware Type:** [More Information Needed]
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
-
|
| 153 |
-
## Technical Specifications [optional]
|
| 154 |
-
|
| 155 |
-
### Model Architecture and Objective
|
| 156 |
-
|
| 157 |
-
[More Information Needed]
|
| 158 |
-
|
| 159 |
-
### Compute Infrastructure
|
| 160 |
-
|
| 161 |
-
[More Information Needed]
|
| 162 |
-
|
| 163 |
-
#### Hardware
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
-
|
| 167 |
-
#### Software
|
| 168 |
-
|
| 169 |
-
[More Information Needed]
|
| 170 |
-
|
| 171 |
-
## Citation [optional]
|
| 172 |
-
|
| 173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
-
|
| 175 |
-
**BibTeX:**
|
| 176 |
-
|
| 177 |
-
[More Information Needed]
|
| 178 |
-
|
| 179 |
-
**APA:**
|
| 180 |
-
|
| 181 |
-
[More Information Needed]
|
| 182 |
-
|
| 183 |
-
## Glossary [optional]
|
| 184 |
-
|
| 185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
-
|
| 187 |
-
[More Information Needed]
|
| 188 |
-
|
| 189 |
-
## More Information [optional]
|
| 190 |
-
|
| 191 |
-
[More Information Needed]
|
| 192 |
-
|
| 193 |
-
## Model Card Authors [optional]
|
| 194 |
-
|
| 195 |
-
[More Information Needed]
|
| 196 |
|
| 197 |
-
|
| 198 |
|
| 199 |
-
|
|
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
license_link: https://huggingface.co/Qwen/Qwen3.5-2B/blob/main/LICENSE
|
| 5 |
---
|
| 6 |
|
| 7 |
+
# Qwen3.5 Text-Only
|
| 8 |
+
|
| 9 |
+
If all you need is text, these are the Qwen3.5 models for you.
|
| 10 |
+
|
| 11 |
+
Trimmed checkpoints of the Qwen3.5 model family with vision encoder weights removed — smaller files, lower VRAM, drop-in text-only replacement.
|
| 12 |
|
| 13 |
+
> **⚠️ Disclaimer:** These models were tested exclusively with HuggingFace Transformers (≥5.2.0). vLLM, SGLang, llama.cpp, Ollama, and other inference engines are **not supported** yet — partly because Transformers 5 support is still cooking in those projects, and partly because we just threw these checkpoints on the Hub while messing around in the lab. If you get any of these running on other engines, we'd love to hear about it — open a discussion or drop a community post. We didn't set out to build a production-ready model zoo; we just left the oven door open. Use accordingly.
|
| 14 |
|
| 15 |
+
For official details on the Qwen3.5 model family — architecture, benchmarks, training data, and intended use — see the [original Qwen3.5 model card](https://huggingface.co/Qwen/Qwen3.5-9B).
|
| 16 |
|
| 17 |
|
| 18 |
+
## How It Works
|
| 19 |
|
| 20 |
+
The Qwen3.5 architecture consists of a vision encoder and a language model sharing a single checkpoint. During text-only inference the vision encoder is never called, but its weights are still loaded into memory. By loading the checkpoint with `Qwen3_5ForCausalLM` instead of `Qwen3_5ForConditionalGeneration`, HuggingFace Transformers instantiates only the language model component. Re-saving that model produces a checkpoint with no vision weights, which can subsequently be loaded with the standard `AutoModelForCausalLM` interface.
|
| 21 |
|
| 22 |
+
**Why bother?**
|
| 23 |
|
| 24 |
+
- **Lower VRAM** — vision encoder weights are freed, reducing peak memory usage by 5–17% depending on model size
|
| 25 |
+
- **Smaller checkpoints** — faster downloads and storage savings
|
| 26 |
+
- **Simpler loading** — standard `AutoModelForCausalLM`, no multimodal dependencies
|
| 27 |
+
- **Drop-in replacement** — identical tokenizer, same chat template, same text generation behavior as the original Qwen3.5 models
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
## Available Models
|
| 31 |
|
| 32 |
+
| Model | HuggingFace Hub |
|
| 33 |
+
| --- | --- |
|
| 34 |
+
| Qwen3.5-0.8B-text-only | [`principled-intelligence/Qwen3.5-0.8B-text-only`](https://huggingface.co/principled-intelligence/Qwen3.5-0.8B-text-only) |
|
| 35 |
+
| Qwen3.5-2B-text-only | [`principled-intelligence/Qwen3.5-2B-text-only`](https://huggingface.co/principled-intelligence/Qwen3.5-2B-text-only) |
|
| 36 |
+
| Qwen3.5-4B-text-only | [`principled-intelligence/Qwen3.5-4B-text-only`](https://huggingface.co/principled-intelligence/Qwen3.5-4B-text-only) |
|
| 37 |
+
| Qwen3.5-9B-text-only | [`principled-intelligence/Qwen3.5-9B-text-only`](https://huggingface.co/principled-intelligence/Qwen3.5-9B-text-only) |
|
| 38 |
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
## Size Reduction
|
| 41 |
|
| 42 |
+
We compared each text-only checkpoint against its original Qwen3.5 counterpart across three metrics: file size on disk, peak VRAM usage when loaded in `float16` with `device_map="auto"`, and total parameter count. Savings scale with the relative size of the vision encoder — smaller models see the biggest percentage drop.
|
| 43 |
|
| 44 |
+
**Qwen3.5-0.8B vs. Qwen3.5-0.8B-text-only**
|
| 45 |
+
| Metric | Qwen3.5 | Text-Only | Reduction |
|
| 46 |
+
| --- | ---: | ---: | ---: |
|
| 47 |
+
| File size (GB) | 1.75 | 1.50 | ~14% |
|
| 48 |
+
| VRAM (GB) | 1.59 | 1.40 | ~12% |
|
| 49 |
+
| Parameters (B) | 0.85 | 0.75 | ~12% |
|
| 50 |
|
| 51 |
+
**Qwen3.5-2B vs. Qwen3.5-2B-text-only**
|
| 52 |
+
| Metric | Qwen3.5 | Text-Only | Reduction |
|
| 53 |
+
| --- | ---: | ---: | ---: |
|
| 54 |
+
| File size (GB) | 4.55 | 3.76 | ~17% |
|
| 55 |
+
| VRAM (GB) | 4.12 | 3.51 | ~15% |
|
| 56 |
+
| Parameters (B) | 2.21 | 1.88 | ~15% |
|
| 57 |
|
| 58 |
+
**Qwen3.5-4B vs. Qwen3.5-4B-text-only**
|
| 59 |
+
| Metric | Qwen3.5 | Text-Only | Reduction |
|
| 60 |
+
| --- | ---: | ---: | ---: |
|
| 61 |
+
| File size (GB) | 9.32 | 8.41 | ~10% |
|
| 62 |
+
| VRAM (GB) | 8.45 | 7.83 | ~7% |
|
| 63 |
+
| Parameters (B) | 4.54 | 4.21 | ~7% |
|
| 64 |
|
| 65 |
+
**Qwen3.5-9B vs. Qwen3.5-9B-text-only**
|
| 66 |
+
| Metric | Qwen3.5 | Text-Only | Reduction |
|
| 67 |
+
| --- | ---: | ---: | ---: |
|
| 68 |
+
| File size (GB) | 19.32 | 17.90 | ~7% |
|
| 69 |
+
| VRAM (GB) | 17.52 | 16.68 | ~5% |
|
| 70 |
+
| Parameters (B) | 9.41 | 8.95 | ~5% |
|
| 71 |
|
| 72 |
+
## Quickstart
|
| 73 |
|
| 74 |
+
The latest `transformers` is required:
|
| 75 |
|
| 76 |
+
```bash
|
| 77 |
+
uv pip install transformers>=5.2.0
|
| 78 |
+
```
|
| 79 |
|
| 80 |
+
Load and run inference exactly like any causal LM:
|
| 81 |
|
| 82 |
+
```python
|
| 83 |
+
from transformers import pipeline
|
| 84 |
|
| 85 |
+
pipe = pipeline(
|
| 86 |
+
"text-generation",
|
| 87 |
+
model="principled-intelligence/Qwen3.5-2B-text-only",
|
| 88 |
+
device_map="auto",
|
| 89 |
+
)
|
| 90 |
|
| 91 |
+
messages = [{"role": "user", "content": "What is the capital of Italy?"}]
|
| 92 |
+
print(pipe(messages, max_new_tokens=512))
|
| 93 |
+
```
|
| 94 |
|
| 95 |
+
```python
|
| 96 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 97 |
|
| 98 |
+
model_name = "principled-intelligence/Qwen3.5-2B-text-only"
|
| 99 |
|
| 100 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 101 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
|
| 102 |
|
| 103 |
+
messages = [
|
| 104 |
+
{"role": "user", "content": "What is the capital of Italy?"},
|
| 105 |
+
]
|
| 106 |
|
| 107 |
+
text = tokenizer.apply_chat_template(
|
| 108 |
+
messages,
|
| 109 |
+
tokenize=False,
|
| 110 |
+
add_generation_prompt=True,
|
| 111 |
+
)
|
| 112 |
+
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 113 |
|
| 114 |
+
output_ids = model.generate(**inputs, max_new_tokens=512)
|
| 115 |
+
response = tokenizer.decode(output_ids[0][inputs.input_ids.shape[-1]:], skip_special_tokens=True)
|
| 116 |
+
print(response)
|
| 117 |
+
```
|
| 118 |
|
| 119 |
+
You can also use `pipeline` for a simpler interface:
|
| 120 |
|
| 121 |
+
> Qwen3.5 thinks by default, generating `<think>...</think>` content before the final response. To disable thinking, pass `chat_template_kwargs={"enable_thinking": False}` in your generation call or API request.
|
| 122 |
|
| 123 |
+
## Contributing
|
| 124 |
|
| 125 |
+
Contributions are welcome! Whether it's getting these checkpoints running on vLLM, SGLang, llama.cpp, Ollama, or something else entirely — we'd love your help. Bug reports, compatibility notes, and PRs are all appreciated. Open a discussion or community post and let us know what you find.
|
| 126 |
|
| 127 |
+
## License
|
| 128 |
|
| 129 |
+
These checkpoints are released under the [Apache 2.0 License](https://huggingface.co/Qwen/Qwen3.5-2B/blob/main/LICENSE), consistent with the original Qwen3.5 models.
|
| 130 |
|
| 131 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
+
*Made with love from [Principled Intelligence](https://huggingface.co/principled-intelligence)* ❤️
|
| 134 |
|
| 135 |
+
*Learn more about what we build in Principled Intelligence on our [website](https://principled-intelligence.com).*
|