Configuration Parsing Warning:Config file config.json cannot be fetched (too big)

Configuration Parsing Warning:Config file tokenizer_config.json cannot be fetched (too big)

Qwen 3.5 9B - 4-bit NF4

A 4-bit quantized version of Qwen3.5-9B, using BitsAndBytes NF4 quantization.

This repository provides a reduced-memory version of the original model, making it possible to run inference on hardware with more limited GPU memory.

Model Details

Property Value
Base model Qwen/Qwen3.5-9B
Model size 9B parameters
Quantization 4-bit
Quantization type NF4
Compute dtype FP16
Quantization library BitsAndBytes
Framework Hugging Face Transformers

Quantization Configuration

The model was quantized using the following configuration:

import torch
from transformers import BitsAndBytesConfig

quantization_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.float16,
    bnb_4bit_use_double_quant=True
)

Hardware Compatibility

The model was successfully loaded and tested on:

  • GPU: NVIDIA Tesla T4
  • GPU memory: 16 GB VRAM
  • Runtime: Google Colab

Actual memory consumption and generation speed may vary depending on the input length, context size, software versions, and runtime configuration.

Usage

Requirements

pip install -U transformers accelerate bitsandbytes torch

Load the model

import torch
from transformers import (
    AutoModelForCausalLM,
    AutoTokenizer
)

model_id = "biltudas1/Qwen-9B-4bit"

tokenizer = AutoTokenizer.from_pretrained(
    model_id,
    trust_remote_code=True
)

model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map="auto",
    torch_dtype=torch.float16,
    trust_remote_code=True
)

model.eval()

Generate text

messages = [
    {
        "role": "user",
        "content": "Explain how an HTTP request works."
    }
]

inputs = tokenizer.apply_chat_template(
    messages,
    tokenize=True,
    add_generation_prompt=True,
    return_tensors="pt",
    return_dict=True
).to(model.device)

with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_new_tokens=512,
        temperature=0.7,
        do_sample=True
    )

response = tokenizer.decode(
    outputs[0][inputs["input_ids"].shape[-1]:],
    skip_special_tokens=True
)

print(response)

Limitations

  • 4-bit quantization can affect model output quality compared with the original model.
  • Actual performance depends on available GPU memory and hardware.
  • Longer contexts require additional memory.
  • Optional optimized attention and inference kernels may improve performance.

Acknowledgements

All credit for the original model architecture, training, and weights goes to the Qwen team.

This repository contains a quantized derivative of the original model, not a model trained from scratch.

License

Please refer to the original model's license and terms of use before using or redistributing this quantized version.

Downloads last month
26
Safetensors
Model size
9B params
Tensor type
F16
ยท
U8
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for biltudas1/Qwen-9B-4bit

Finetuned
Qwen/Qwen3.5-9B
Finetuned
(1,561)
this model