"git@developer.sourcefind.cn:OpenDAS/ollama.git" did not exist on "950d33aa3045581906c2db11f33d2a4c2bca3033"
Unverified Commit 6dfaec34 authored by YiYi Xu's avatar YiYi Xu Committed by GitHub
Browse files

make style for https://github.com/huggingface/diffusers/pull/10368 (#10370)



* fix bug for torch.uint1-7 not support in torch<2.6

* up

---------
Co-authored-by: default avatarbaymax591 <cbai@mail.nwpu.edu.cn>
parent c1e7fd5b
...@@ -23,7 +23,7 @@ from typing import TYPE_CHECKING, Any, Dict, List, Union ...@@ -23,7 +23,7 @@ from typing import TYPE_CHECKING, Any, Dict, List, Union
from packaging import version from packaging import version
from ...utils import get_module_from_name, is_torch_available, is_torchao_available, logging from ...utils import get_module_from_name, is_torch_available, is_torch_version, is_torchao_available, logging
from ..base import DiffusersQuantizer from ..base import DiffusersQuantizer
...@@ -35,21 +35,28 @@ if is_torch_available(): ...@@ -35,21 +35,28 @@ if is_torch_available():
import torch import torch
import torch.nn as nn import torch.nn as nn
SUPPORTED_TORCH_DTYPES_FOR_QUANTIZATION = ( if is_torch_version(">=", "2.5"):
# At the moment, only int8 is supported for integer quantization dtypes. SUPPORTED_TORCH_DTYPES_FOR_QUANTIZATION = (
# In Torch 2.6, int1-int7 will be introduced, so this can be visited in the future # At the moment, only int8 is supported for integer quantization dtypes.
# to support more quantization methods, such as intx_weight_only. # In Torch 2.6, int1-int7 will be introduced, so this can be visited in the future
torch.int8, # to support more quantization methods, such as intx_weight_only.
torch.float8_e4m3fn, torch.int8,
torch.float8_e5m2, torch.float8_e4m3fn,
torch.uint1, torch.float8_e5m2,
torch.uint2, torch.uint1,
torch.uint3, torch.uint2,
torch.uint4, torch.uint3,
torch.uint5, torch.uint4,
torch.uint6, torch.uint5,
torch.uint7, torch.uint6,
) torch.uint7,
)
else:
SUPPORTED_TORCH_DTYPES_FOR_QUANTIZATION = (
torch.int8,
torch.float8_e4m3fn,
torch.float8_e5m2,
)
if is_torchao_available(): if is_torchao_available():
from torchao.quantization import quantize_ from torchao.quantization import quantize_
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment