Skip to content

Error message missing format string specifier #435

@GregoryComer

Description

@GregoryComer

Exception messages appear to be intended to be format strings but are not. This leads to variable specifiers in the raised error message.

File ~/.local/lib/python3.10/site-packages/torchao/quantization/utils.py:126, in guard_dtype_size(tensor_arg, arg_name, dtype, size)
    124 def guard_dtype_size(tensor_arg, arg_name, dtype=None, size=None):
    125     if dtype is not None and tensor_arg.dtype != dtype:
--> 126         raise ValueError("Expected Tensor argument {arg_name} to have dtype {dtype}, but got {tensor_arg.dtype} instead.")
    127     if size is not None and tensor_arg.size() != size:
    128         raise ValueError("Expected Tensor argument {arg_name} to have size {size}, but got {tensor_arg.size()} instead.")

ValueError: Expected Tensor argument {arg_name} to have dtype {dtype}, but got {tensor_arg.dtype} instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions