Running pyflakes across the repository surfaces three undefined names on main (378dd15). They are unrelated to each other and differ in severity, so I have listed them separately. Happy to send a PR for any or all of them if that is useful.
Reproduce with:
pip install pyflakes
pyflakes $(git ls-files '*.py')
1. T is undefined in the audio keyword-spotting example — reachable
tinyml-modeloptimization/torchmodelopt/examples/audio_keyword_spotting/main.py:243
def compute_torchMFCC(self, audio_tensor):
__MFCC = T.MFCC( # type: ignore
T is never imported in the file. The method is called at line 203, so this raises NameError: name 'T' is not defined whenever that path executes. The # type: ignore suggests a type checker flagged it previously.
Looks like a missing import torchaudio.transforms as T, but I did not want to guess the intended module.
2. __all__ lists a name that does not exist
tinyml-modelzoo/tinyml_modelzoo/models/classification.py:985
TEST_NEW_MODEL_2K is not defined anywhere in the file. Python raises AttributeError for a from ... import * when __all__ names a missing symbol, so this breaks star-imports of the module. The name suggests leftover scaffolding.
3. value is undefined in image_base.py — latent, currently unreachable
tinyml-modelmaker/tinyml_modelmaker/ai_modules/vision/training/tinyml_tinyverse/image_base.py:242-245
@classmethod
def init_params(cls, *args, **kwargs):
params = dict(training=dict())
params = utils.ConfigDict(params, *args, **kwargs)
return params
# @staticmethod
# def _argv_value(value):
# if value is None:
# return "None"
if isinstance(value, (list, tuple)):
return repr(list(value))
return str(value)
A _argv_value static method was partially commented out: the decorator, def line and first branch are commented, but the rest of the body is not. Python therefore parses the remaining lines as trailing statements of init_params, after its return, so they are unreachable and cannot raise at runtime today.
Not currently a bug, but the dead fragment is misleading, and it would start executing if init_params were ever edited above it. _argv_value has no callers, so deleting the fragment outright looks correct.
For completeness: a separate missing import numpy as np in three references/*/test_onnx.py scripts produces the same class of error on the nn_for_feature_extraction path. That one is already included in PR #8.
Running
pyflakesacross the repository surfaces three undefined names onmain(378dd15). They are unrelated to each other and differ in severity, so I have listed them separately. Happy to send a PR for any or all of them if that is useful.Reproduce with:
pip install pyflakes pyflakes $(git ls-files '*.py')1.
Tis undefined in the audio keyword-spotting example — reachabletinyml-modeloptimization/torchmodelopt/examples/audio_keyword_spotting/main.py:243Tis never imported in the file. The method is called at line 203, so this raisesNameError: name 'T' is not definedwhenever that path executes. The# type: ignoresuggests a type checker flagged it previously.Looks like a missing
import torchaudio.transforms as T, but I did not want to guess the intended module.2.
__all__lists a name that does not existtinyml-modelzoo/tinyml_modelzoo/models/classification.py:985'TEST_NEW_MODEL_2K',TEST_NEW_MODEL_2Kis not defined anywhere in the file. Python raisesAttributeErrorfor afrom ... import *when__all__names a missing symbol, so this breaks star-imports of the module. The name suggests leftover scaffolding.3.
valueis undefined inimage_base.py— latent, currently unreachabletinyml-modelmaker/tinyml_modelmaker/ai_modules/vision/training/tinyml_tinyverse/image_base.py:242-245A
_argv_valuestatic method was partially commented out: the decorator,defline and first branch are commented, but the rest of the body is not. Python therefore parses the remaining lines as trailing statements ofinit_params, after itsreturn, so they are unreachable and cannot raise at runtime today.Not currently a bug, but the dead fragment is misleading, and it would start executing if
init_paramswere ever edited above it._argv_valuehas no callers, so deleting the fragment outright looks correct.For completeness: a separate missing
import numpy as npin threereferences/*/test_onnx.pyscripts produces the same class of error on thenn_for_feature_extractionpath. That one is already included in PR #8.