mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
@@ -179,8 +179,8 @@ def apply_sdnq_options_to_module(model, dtype: torch.dtype = None, dequantize_fp
|
||||
output_channel_size, channel_size = module.sdnq_dequantizer.original_shape
|
||||
else:
|
||||
current_use_quantized_matmul = False
|
||||
current_use_quantized_matmul = current_use_quantized_matmul and channel_size >= 32 and output_channel_size >= 32
|
||||
current_use_quantized_matmul = current_use_quantized_matmul and output_channel_size % 16 == 0 and channel_size % 16 == 0
|
||||
current_use_quantized_matmul = current_use_quantized_matmul and channel_size >= 32 and output_channel_size >= 32 # pylint: disable=possibly-used-before-assignment
|
||||
current_use_quantized_matmul = current_use_quantized_matmul and output_channel_size % 16 == 0 and channel_size % 16 == 0 # pylint: disable=possibly-used-before-assignment
|
||||
|
||||
if dtype is not None and module.sdnq_dequantizer.result_dtype != torch.float32:
|
||||
module.sdnq_dequantizer.result_dtype = dtype
|
||||
|
||||
@@ -21,13 +21,13 @@ def pack_float(x: torch.FloatTensor, weights_dtype: str) -> torch.Tensor:
|
||||
total_bits = dtype_dict[weights_dtype]["num_bits"]
|
||||
|
||||
if dtype_dict[weights_dtype]["is_unsigned"]:
|
||||
sign_mask = (1 << (total_bits-1))
|
||||
sign_mask = (1 << (total_bits-1)) # pylint: disable=superfluous-parens
|
||||
else:
|
||||
sign_mask = (1 << (total_bits-1)) + (1 << (total_bits-2))
|
||||
|
||||
mantissa_difference = 23 - mantissa_bits
|
||||
exponent_difference = 8 - exponent_bits
|
||||
mantissa_mask = (1 << mantissa_difference)
|
||||
mantissa_mask = (1 << mantissa_difference) # pylint: disable=superfluous-parens
|
||||
|
||||
x = x.to(dtype=torch.float32).view(torch.int32)
|
||||
|
||||
@@ -65,7 +65,7 @@ def unpack_float(x: torch.Tensor, shape: torch.Size, weights_dtype: str) -> torc
|
||||
total_bits = dtype_dict[weights_dtype]["num_bits"]
|
||||
|
||||
if dtype_dict[weights_dtype]["is_unsigned"]:
|
||||
sign_mask = (1 << (total_bits-1))
|
||||
sign_mask = (1 << (total_bits-1)) # pylint: disable=superfluous-parens
|
||||
else:
|
||||
sign_mask = (1 << (total_bits-1)) + (1 << (total_bits-2))
|
||||
|
||||
|
||||
@@ -275,9 +275,9 @@ def search_extensions(search_text, sort_column):
|
||||
|
||||
|
||||
def make_wrappable_html(text: str) -> str:
|
||||
text = html.escape(text)
|
||||
text = re_snake_case.sub("<wbr />_", text)
|
||||
return re_camelCase.sub(r"<wbr />\1", text)
|
||||
text = html.escape(text)
|
||||
text = re_snake_case.sub("<wbr />_", text)
|
||||
return re_camelCase.sub(r"<wbr />\1", text)
|
||||
|
||||
|
||||
def create_html(search_text, sort_column):
|
||||
|
||||
Reference in New Issue
Block a user