Text Generation
Transformers
Safetensors
gemma4
image-text-to-text
gptq
quantized
w8a16
int8
compressed-tensors
vllm
conversational
Instructions to use Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16") model = AutoModelForMultimodalLM.from_pretrained("Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16
- SGLang
How to use Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16 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 "Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16" \ --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": "Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16", "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 "Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16" \ --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": "Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16 with Docker Model Runner:
docker model run hf.co/Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: ReadyArt/gemma-4-31B-it-scotoma-2
|
| 3 |
+
tags:
|
| 4 |
+
- gptq
|
| 5 |
+
- quantized
|
| 6 |
+
- w8a16
|
| 7 |
+
- int8
|
| 8 |
+
- compressed-tensors
|
| 9 |
+
- vllm
|
| 10 |
+
- gemma4
|
| 11 |
+
library_name: transformers
|
| 12 |
+
pipeline_tag: text-generation
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# gemma-4-31B-it-scotoma-2-GPTQ-W8A16
|
| 16 |
+
|
| 17 |
+
This is an 8-bit weight-only (W8A16) GPTQ quantization of [ReadyArt/gemma-4-31B-it-scotoma-2](https://huggingface.co/ReadyArt/gemma-4-31B-it-scotoma-2), produced with [`llmcompressor`](https://github.com/vllm-project/llm-compressor) and intended for fast, memory-efficient inference with vLLM.
|
| 18 |
+
|
| 19 |
+
## About the base model
|
| 20 |
+
|
| 21 |
+
scotoma-2 is a 31B-parameter derivative of Google's `gemma-4-31B-it`. Per its model card, it applies a bounded refusal-direction edit (an abliteration LoRA projected through Gemma's J-Space) combined with several rounds of DPO preference training aimed at reducing repetitive stylistic tics (reflexive negation, em-dash asides, stacked adjectives) rather than removing the base model's safety behavior — the authors describe it explicitly as **"not uncensored."** See the base model's own card for full details on the method and its limitations; this repo only covers the quantization and adds nothing to the underlying behavior.
|
| 22 |
+
|
| 23 |
+
## Quantization details
|
| 24 |
+
|
| 25 |
+
| | |
|
| 26 |
+
|---|---|
|
| 27 |
+
| Method | GPTQ (`GPTQModifier`, one-shot) via `llmcompressor` |
|
| 28 |
+
| Scheme | W8A16 — 8-bit integer weights, 16-bit activations |
|
| 29 |
+
| Format | `compressed-tensors` (native vLLM support) |
|
| 30 |
+
| Calibration data | 128 samples from `HuggingFaceH4/ultrachat_200k` (train_sft split) |
|
| 31 |
+
| Calibration sequence length | 2048 tokens |
|
| 32 |
+
| Layers excluded from quantization | `lm_head`, embedding layers, vision tower layers |
|
| 33 |
+
| Quantized on | NVIDIA A100 80GB |
|
| 34 |
+
|
| 35 |
+
Weight-only quantization keeps activations at full precision, which preserves accuracy well while roughly halving VRAM footprint relative to bf16. It primarily helps memory usage and single/low-batch latency; for very high-throughput serving, full activation quantization (W8A8) can offer more gains, but that path isn't well supported on Ampere-class GPUs, making W8A16 the practical choice here.
|
| 36 |
+
|
| 37 |
+
## Usage
|
| 38 |
+
|
| 39 |
+
### vLLM (recommended)
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
vllm serve Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
vLLM will auto-detect the `compressed-tensors` quantization config from the checkpoint. On Ampere (A100/A10) GPUs this runs through the Marlin weight-only kernel automatically.
|
| 46 |
+
|
| 47 |
+
```python
|
| 48 |
+
from vllm import LLM, SamplingParams
|
| 49 |
+
|
| 50 |
+
llm = LLM(model="Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16")
|
| 51 |
+
sampling_params = SamplingParams(temperature=1.0, max_tokens=512)
|
| 52 |
+
|
| 53 |
+
output = llm.generate(["Your prompt here"], sampling_params)
|
| 54 |
+
print(output[0].outputs[0].text)
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
### Transformers
|
| 58 |
+
|
| 59 |
+
The checkpoint also loads directly via `transformers` + `compressed-tensors` for testing outside vLLM, though vLLM is recommended for production serving speed.
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 63 |
+
|
| 64 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 65 |
+
"Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16",
|
| 66 |
+
device_map="auto"
|
| 67 |
+
)
|
| 68 |
+
tokenizer = AutoTokenizer.from_pretrained("Captain1Q/gemma-4-31B-it-scotoma-2-GPTQ-W8A16")
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## Hardware requirements
|
| 72 |
+
|
| 73 |
+
Quantized weights occupy roughly half the VRAM of the bf16 original (~31B params → ~31 GB in int8 vs. ~62 GB in bf16, before KV cache and activation overhead). Tested on a single A100 80GB; should also fit on a single A100 40GB or comparable Ampere GPU depending on context length and batch size.
|
| 74 |
+
|
| 75 |
+
## Notes and limitations
|
| 76 |
+
|
| 77 |
+
- This is a **weight-only** quantization; no dataset filtering, safety alignment, or behavioral changes were made during this process. All behavior inherited from the base model (including the caveats noted in its own card) applies unchanged here.
|
| 78 |
+
- Quantization can introduce small quality regressions versus the bf16 original, particularly on long-context or reasoning-heavy tasks. If you notice degradation, consider comparing outputs against the original model before relying on this checkpoint for sensitive use cases.
|
| 79 |
+
- Licensing follows the base model's terms (Gemma license, as inherited from `google/gemma-4-31B-it` and passed through `ReadyArt/gemma-4-31B-it-scotoma-2`). Review the base model's license and usage restrictions before deploying.
|
| 80 |
+
|
| 81 |
+
## Credits
|
| 82 |
+
|
| 83 |
+
- Base model & fine-tune: [ReadyArt](https://huggingface.co/ReadyArt)
|
| 84 |
+
- Original architecture: Google, Gemma 4
|
| 85 |
+
- Quantization: this repo, via `llmcompressor` GPTQModifier (W8A16)
|