Describe the bug
deepspeed.init_inference(model, dtype=torch.int8) raises ValueError: Data type torch.int8 is not supported by <device> accelerator unconditionally, on every accelerator DeepSpeed ships
(checked cpu, cuda, hpu, mlu, xpu — none list torch.int8 in supported_dtypes()).
This is a regression: two unrelated cleanup PRs (#6528, "add bfloat16 to inference support
dtypes", 2024-09-27; and #5505, "remove unused _validate_args function", 2025-01-07) combined to
silently tighten InferenceEngine.__init__'s dtype gate (deepspeed/inference/engine.py:74) from
its original fp16-only check to a blanket supported_dtypes() check that was never meant to
describe DeepSpeed's own int8 weight-quantization dtype. docs/_tutorials/inference-tutorial.md
("Datatypes and Quantized Models", rewritten as recently as #8535) still documents int8 as
supported.
Found while investigating #1454 — the compute_attention()/input_mask crash reported there is
already fixed upstream, but the underlying "run int8 quantized inference" workflow that issue was
trying to use is broken by this separate, still-live gap.
To Reproduce
import torch, deepspeed
deepspeed.init_inference(torch.nn.Linear(4, 4), dtype=torch.int8)
No GPU needed — the gate itself is device-agnostic and raises identically on CPU.
Expected behavior
init_inference should accept dtype=torch.int8 as it did before #6528, since DeepSpeed's own
int8 weight-quantization path (DeepSpeedSelfAttention/DeepSpeedMLP in
deepspeed/ops/transformer/inference/ds_attention.py) still special-cases torch.int8
construction today — that code is presently unreachable dead code because the engine can no
longer be constructed with this dtype at all.
System info:
- Reproduces identically on every accelerator backend (
cpu, cuda, hpu, mlu, xpu) since
the dtype check is evaluated before any accelerator-specific code runs.
- Python 3.12, torch 2.14 (CPU repro); not version-specific — same gate on current
master.
Additional context
A one-line fix (exempt torch.int8 from the supported_dtypes() gate, matching the code's
pre-#6528 scope) plus a regression test is ready; opening a PR alongside this issue.
Describe the bug
deepspeed.init_inference(model, dtype=torch.int8)raisesValueError: Data type torch.int8 is not supported by <device> acceleratorunconditionally, on every accelerator DeepSpeed ships(checked
cpu,cuda,hpu,mlu,xpu— none listtorch.int8insupported_dtypes()).This is a regression: two unrelated cleanup PRs (#6528, "add bfloat16 to inference support
dtypes", 2024-09-27; and #5505, "remove unused _validate_args function", 2025-01-07) combined to
silently tighten
InferenceEngine.__init__'s dtype gate (deepspeed/inference/engine.py:74) fromits original fp16-only check to a blanket
supported_dtypes()check that was never meant todescribe DeepSpeed's own int8 weight-quantization dtype.
docs/_tutorials/inference-tutorial.md("Datatypes and Quantized Models", rewritten as recently as #8535) still documents int8 as
supported.
Found while investigating #1454 — the
compute_attention()/input_maskcrash reported there isalready fixed upstream, but the underlying "run int8 quantized inference" workflow that issue was
trying to use is broken by this separate, still-live gap.
To Reproduce
No GPU needed — the gate itself is device-agnostic and raises identically on CPU.
Expected behavior
init_inferenceshould acceptdtype=torch.int8as it did before #6528, since DeepSpeed's ownint8 weight-quantization path (
DeepSpeedSelfAttention/DeepSpeedMLPindeepspeed/ops/transformer/inference/ds_attention.py) still special-casestorch.int8construction today — that code is presently unreachable dead code because the engine can no
longer be constructed with this dtype at all.
System info:
cpu,cuda,hpu,mlu,xpu) sincethe dtype check is evaluated before any accelerator-specific code runs.
master.Additional context
A one-line fix (exempt
torch.int8from thesupported_dtypes()gate, matching the code'spre-#6528 scope) plus a regression test is ready; opening a PR alongside this issue.