Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e212a84
add int4tensor support for safetensors
liangel-02 Sep 24, 2025
7c82d4d
Update on "add int4tensor support for safetensors"
liangel-02 Sep 24, 2025
bbeaf52
Update on "add int4tensor support for safetensors"
liangel-02 Sep 24, 2025
0200ad1
Update on "add int4tensor support for safetensors"
liangel-02 Sep 24, 2025
60c5de9
Update on "add int4tensor support for safetensors"
liangel-02 Sep 24, 2025
6e31683
Update on "add int4tensor support for safetensors"
liangel-02 Sep 24, 2025
86d7fcf
Update on "add int4tensor support for safetensors"
liangel-02 Sep 24, 2025
512f9ed
Update base for Update on "add int4tensor support for safetensors"
liangel-02 Sep 25, 2025
f7b8068
Update on "add int4tensor support for safetensors"
liangel-02 Sep 25, 2025
9395b3f
add int4preshuffledtensor to safetensors
liangel-02 Sep 25, 2025
585afe2
Update on "add int4preshuffledtensor to safetensors"
liangel-02 Sep 25, 2025
87d2e18
add int4tilepackedto4dtensor subclass to safetensors
liangel-02 Sep 25, 2025
6007af3
Update on "add int4tilepackedto4dtensor subclass to safetensors"
liangel-02 Sep 25, 2025
fd3d5eb
Update on "add int4tilepackedto4dtensor subclass to safetensors"
liangel-02 Sep 25, 2025
8820dee
Update base for Update on "add int4tilepackedto4dtensor subclass to s…
liangel-02 Sep 25, 2025
442ceae
Merge branch 'main' into gh/liangel/3/head
liangel-02 Sep 25, 2025
4a34a9f
Update base for Update on "add int4tilepackedto4dtensor subclass to s…
liangel-02 Sep 25, 2025
b805b7b
Update on "add int4tilepackedto4dtensor subclass to safetensors"
liangel-02 Sep 25, 2025
eb2c6c6
Update base for Update on "add int4tilepackedto4dtensor subclass to s…
liangel-02 Sep 26, 2025
7d1c5f5
Update on "add int4tilepackedto4dtensor subclass to safetensors"
liangel-02 Sep 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/prototype/safetensors/test_safetensors_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class TestSafeTensors(TestCase):
(Float8DynamicActivationFloat8WeightConfig(granularity=PerRow()), False),
(Int4WeightOnlyConfig(), False),
(Int4WeightOnlyConfig(), True),
(Int4WeightOnlyConfig(int4_packing_format="tile_packed_to_4d"), False),
],
)
def test_safetensors(self, config, act_pre_scale=False):
Expand Down
13 changes: 11 additions & 2 deletions torchao/prototype/safetensors/safetensors_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,30 @@
import torch

import torchao
from torchao.quantization import Float8Tensor, Int4Tensor
from torchao.quantization import (
Float8Tensor,
Int4Tensor,
Int4TilePackedTo4dTensor,
)
from torchao.quantization.quantize_.common import KernelPreference
from torchao.quantization.quantize_.workflows import QuantizeTensorToFloat8Kwargs

ALLOWED_CLASSES = {
"Float8Tensor": Float8Tensor,
"Int4Tensor": Int4Tensor,
"Int4TilePackedTo4dTensor": Int4TilePackedTo4dTensor,
"Float8MMConfig": torchao.float8.inference.Float8MMConfig,
"QuantizeTensorToFloat8Kwargs": QuantizeTensorToFloat8Kwargs,
"PerRow": torchao.quantization.PerRow,
"PerTensor": torchao.quantization.PerTensor,
"KernelPreference": KernelPreference,
}

ALLOWED_TENSORS_SUBCLASSES = ["Float8Tensor", "Int4Tensor"]
ALLOWED_TENSORS_SUBCLASSES = [
"Float8Tensor",
"Int4Tensor",
"Int4TilePackedTo4dTensor",
]

__all__ = [
"TensorSubclassAttributeJSONEncoder",
Expand Down
Loading