Conversation
The unexpected-device branch calls .format() with no argument on a string
that has a {} placeholder, so raising it fails with IndexError: Replacement
index 0 out of range instead of reporting the offending device type.
Signed-off-by: Tai An <antai12232931@outlook.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
test/torch/algorithms/fp8_quant/test_hpu_utils.py:49formats an error message with a{}placeholder but passes no argument:str.format()with a positional{}and no arguments raises before theValueErroris ever constructed:So on an unrecognised Gaudi device the helper — used by
unit_tests/test_functions/test_config_json.pyviadevice_type_id[device_type]— fails with an unrelatedIndexErrorand no indication of which device type was unexpected, which is exactly the information the message exists to provide.Fix
Pass the value the placeholder is for:
One line. The trailing space in the literal is left as-is to keep the diff to the argument only.
Verification
I don't have Gaudi hardware, so
habana_frameworkswon't import here and the module can't be executed directly. The failure is instr.formatitself and is independent of the HPU stack — the literal from the file, reproduced verbatim:Formatting checked against the repo's pinned hook (
black==26.5.1,line-length = 120frompyproject.toml): the patched file is left unchanged (the new line is 86 chars).🤖 Generated with Claude Code