Skip to content

Commit 2968c2c

Browse files
committed
lint
1 parent 5383e97 commit 2968c2c

File tree

12 files changed

+19
-20
lines changed

12 files changed

+19
-20
lines changed

_unittests/ut_helpers/test_cache_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_replace_by(self):
6969
)
7070

7171
DYN = torch.export.Dim.DYNAMIC
72-
nargs, nkwargs, nds = convert_dynamic_axes_into_dynamic_shapes(
72+
_nargs, _nkwargs, nds = convert_dynamic_axes_into_dynamic_shapes(
7373
None, args=tuple(), kwargs=kwargs, dynamic_axes=dynamic_shapes
7474
)
7575
self.assertEqual(dynamic_shapes, nds)

_unittests/ut_torch_export_patches/test_patch_serialization_transformers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def forward(self, cache):
164164
def test_base_model_output_unflatten_flatten(self):
165165
bo = BaseModelOutput(last_hidden_state=torch.rand((4, 4, 4)))
166166
with torch_export_patches(patch_transformers=True):
167-
flat, _spec = torch.utils._pytree.tree_flatten(bo)
167+
_flat, _spec = torch.utils._pytree.tree_flatten(bo)
168168
unflat = flatten_unflatten_for_dynamic_shapes(bo, use_dict=True)
169169
self.assertIsInstance(unflat, list)
170170
self.assertEqual("#1[T1r3]", self.string_type(unflat))

_unittests/ut_torch_models/test_tiny_llms_bypassed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def debug():
3232
print("***", data["dynamic_shapes"])
3333
import torch.export._draft_export
3434

35-
ep, report = torch.export._draft_export.draft_export(
35+
_ep, report = torch.export._draft_export.draft_export(
3636
model,
3737
(),
3838
kwargs=inputs,

_unittests/ut_xrun_doc/test_documentation_examples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def run_test(self, fold: str, name: str, verbose=0) -> int:
4747
cmds = [sys.executable, "-u", os.path.join(fold, name)]
4848
p = subprocess.Popen(cmds, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
4949
res = p.communicate()
50-
out, err = res
50+
_out, err = res
5151
st = err.decode("ascii", errors="ignore")
5252
if st and "Traceback" in st:
5353
if '"dot" not found in path.' in st:

_unittests/ut_xrun_doc/test_documentation_recipes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def run_test(self, fold: str, name: str, verbose=0) -> int:
4646
cmds = [sys.executable, "-u", os.path.join(fold, name)]
4747
p = subprocess.Popen(cmds, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
4848
res = p.communicate()
49-
out, err = res
49+
_out, err = res
5050
st = err.decode("ascii", errors="ignore")
5151
if st and "Traceback" in st:
5252
if '"dot" not found in path.' in st:

_unittests/ut_xrun_doc/test_documentation_technical.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def run_test(self, fold: str, name: str, verbose=0) -> int:
4141
cmds = [sys.executable, "-u", os.path.join(fold, name)]
4242
p = subprocess.Popen(cmds, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
4343
res = p.communicate()
44-
out, err = res
44+
_out, err = res
4545
st = err.decode("ascii", errors="ignore")
4646
if st and "Traceback" in st:
4747
if '"dot" not found in path.' in st:

onnx_diagnostic/helpers/onnx_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ def shadowing_names(
11861186
shadow |= set(i.name for i in g.input) & shadow_context
11871187
shadow |= set(i.name for i in g.initializer) & shadow_context
11881188
shadow |= set(i.name for i in g.sparse_initializer) & shadow_context
1189-
s, ps, c = shadowing_names(
1189+
s, _ps, c = shadowing_names(
11901190
g.node, verbose=verbose, existing=existing, shadow_context=existing
11911191
)
11921192
shadow |= s

onnx_diagnostic/helpers/torch_helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ def __init__(self, embedding_dim: int = 16, context_size: int = 256):
543543
)
544544

545545
def forward(self, x):
546-
B, T, C = x.shape
546+
_B, T, C = x.shape
547547

548548
query = self.query(x)
549549
key = self.key(x)
@@ -866,7 +866,7 @@ def torch_tensor_size(value: Any) -> Any:
866866
if value.__class__.__name__ == "MambaCache":
867867
return torch_tensor_size(value.conv_states) + torch_tensor_size(value.ssm_states)
868868
if value.__class__ in torch.utils._pytree.SUPPORTED_NODES:
869-
args, spec = torch.utils._pytree.tree_flatten(value)
869+
args, _spec = torch.utils._pytree.tree_flatten(value)
870870
return sum(torch_tensor_size(a) for a in args)
871871

872872
# We should have a code using serialization, deserialization assuming a model

onnx_diagnostic/reference/ops/op_scan.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ def _run(
2626
):
2727
(
2828
num_loop_state_vars,
29-
num_scan_outputs,
30-
output_directions,
31-
max_dir_out,
32-
output_axes,
33-
max_axe_out,
29+
_num_scan_outputs,
30+
_output_directions,
31+
_max_dir_out,
32+
_output_axes,
33+
_max_axe_out,
3434
state_names_in,
3535
state_names_out,
3636
scan_names_in,

onnx_diagnostic/reference/ort_evaluator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ def _run_if(
562562
if key in self._cache:
563563
sess = self._cache[key][1]
564564
else:
565-
self._cache[key] = onx, sess = self._get_sess_if(node, name, inputs, results)
565+
self._cache[key] = _onx, sess = self._get_sess_if(node, name, inputs, results)
566566

567567
assert hasattr(sess, "run"), f"Missing method run for type {type(sess)}"
568568
feeds = {name: results[name] for name in sess.input_names}
@@ -616,7 +616,7 @@ def _run_scan(
616616
if key in self._cache:
617617
sess = self._cache[key][1]
618618
else:
619-
self._cache[key] = onx, sess = self._get_sess_scan(node, name, inputs, results)
619+
self._cache[key] = _onx, sess = self._get_sess_scan(node, name, inputs, results)
620620

621621
assert hasattr(sess, "run"), f"Missing method run for type {type(sess)}"
622622
feeds = {name: results[name] for name in sess.input_names}

0 commit comments

Comments
 (0)