Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
6bda92d
Merge pull request #1 from TexasInstruments/main
musicalplatypus Feb 22, 2026
f2d071c
Merge branch 'TexasInstruments:main' into main
musicalplatypus Mar 5, 2026
4ace5d7
Merge branch 'TexasInstruments:main' into main
musicalplatypus Mar 29, 2026
91b8f7e
Fix @classmethod methods using self instead of cls
t5fkg8d44d-beep Feb 26, 2026
14a9155
Fix 5 bugs in tinyml-modelmaker: missing import, argv splice, dataset…
t5fkg8d44d-beep Feb 28, 2026
ffdb391
Fix 6 bugs: ConfigDict pickling, include paths, constants, downloads,…
t5fkg8d44d-beep Feb 28, 2026
c1fc305
Fix quit_event ordering, anomaly typo, and log file write safety
t5fkg8d44d-beep Feb 28, 2026
3058e3d
Fix 6 NAS bugs: validation iterator, device support, resource penalty…
t5fkg8d44d-beep Mar 1, 2026
43cb5d7
Fix SmoothedValue: defer .item() to print time, remove MPS mem sync
t5fkg8d44d-beep Mar 1, 2026
2831c0c
Fix leaked semaphore warning on macOS by shutting down DataLoader wor…
t5fkg8d44d-beep Feb 28, 2026
877e580
Fix leaked semaphore: shut down DataLoader workers in all test_onnx s…
t5fkg8d44d-beep Mar 1, 2026
a0916e7
Fix 41 leaked semaphore objects on macOS shutdown
t5fkg8d44d-beep Mar 1, 2026
f91372f
Fix leaked semaphore warnings: unregister from resource_tracker
t5fkg8d44d-beep Mar 2, 2026
0986a23
Optimize training performance: torch.compile, AMP, persistent workers…
t5fkg8d44d-beep Feb 27, 2026
d4bf8e7
Thread performance flags (compile_model, native_amp) through modelmak…
t5fkg8d44d-beep Feb 27, 2026
7ed6880
Replace print() with logging module across tinyml-modelmaker
t5fkg8d44d-beep Feb 26, 2026
0c1b23d
Extract duplicated path resolution from ModelRunner into shared resol…
t5fkg8d44d-beep Feb 26, 2026
a73f385
Replace magic strings with named constants
t5fkg8d44d-beep Feb 26, 2026
52b87fa
Replace assert/sys.exit/raise-string with proper exceptions across ti…
t5fkg8d44d-beep Feb 26, 2026
de1fffa
Add Protocol definitions for component interfaces (ModelRunner, Train…
t5fkg8d44d-beep Feb 18, 2026
d5b53c9
Add ARCHITECTURE.md with codebase documentation, diagram, and improve…
t5fkg8d44d-beep Feb 17, 2026
6e78862
Fix two peer-review regressions in performance PR
t5fkg8d44d-beep Jul 19, 2026
18f8866
fix: wrap shutdown_data_loaders in try/finally across all train/test …
t5fkg8d44d-beep Jul 19, 2026
cb1ebe4
fix: address 6 CodeRabbit findings in pr/bug-fixes
t5fkg8d44d-beep Jul 19, 2026
e3b0c73
fix: remove dead confusion_matrix_total init in evaluate_classification
t5fkg8d44d-beep Jul 19, 2026
719ae1f
fix: address 5 CodeRabbit findings in pr/code-quality
t5fkg8d44d-beep Jul 19, 2026
ffb5642
docs: update ARCHITECTURE.md to reflect PR stack improvements
t5fkg8d44d-beep Jul 19, 2026
a225599
Merge pr/bug-fixes into main
t5fkg8d44d-beep Jul 19, 2026
2399267
Merge pr/macos-semaphore-fixes into main
t5fkg8d44d-beep Jul 19, 2026
44cf778
Merge pr/performance-optimizations into main
t5fkg8d44d-beep Jul 19, 2026
906eaa4
Merge pr/code-quality into main
t5fkg8d44d-beep Jul 19, 2026
5a403bc
Merge pr/documentation into main
t5fkg8d44d-beep Jul 19, 2026
90ce979
fix: address 6 findings from full codebase CodeRabbit review
t5fkg8d44d-beep Jul 19, 2026
3607b15
fix: restore TinyMLQuantizationVersion import dropped in resolve_path…
t5fkg8d44d-beep Jul 20, 2026
befd0b3
Merge branch 'pr/code-quality'
t5fkg8d44d-beep Jul 20, 2026
6030cd3
fix: restore TinyMLQuantizationVersion import in the vision runner too
t5fkg8d44d-beep Jul 20, 2026
dc42b5f
fix: add missing numpy import to ONNX test scripts
t5fkg8d44d-beep Jul 20, 2026
5c5d9ef
Merge branch 'pr/code-quality'
t5fkg8d44d-beep Jul 20, 2026
473da4d
Merge branch 'pr/macos-semaphore-fixes'
t5fkg8d44d-beep Jul 20, 2026
61daebe
fix: add missing numpy import to audio_classification ONNX test
t5fkg8d44d-beep Jul 20, 2026
6fc5725
fix: macOS ARM64 MPS compatibility and code quality
t5fkg8d44d-beep Jul 22, 2026
a60da3e
fix(mps): cast inputs to float32 before device transfer in auto-quant…
t5fkg8d44d-beep Jul 22, 2026
d411355
NAS: accept a NAS model id and add the support test suite
t5fkg8d44d-beep Jul 22, 2026
4dc044d
fix(ci): install ti_mcu_nnc before tinyverse, bump to 2.1.2, add macO…
t5fkg8d44d-beep Jul 28, 2026
bd5d7f9
Merge branch 'main' into pr/fix-ci-tinyverse-install
Adithya-Thonse Jul 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions .github/workflows/test-modelmaker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,24 @@ jobs:
with:
python-version: '3.10'

- name: Install ti_mcu_nnc (Linux)
if: runner.os == 'Linux'
run: |
pip install "ti_mcu_nnc @ https://software-dl.ti.com/mctools/esd/tvm/mcu/ti_mcu_nnc-2.1.2-cp310-cp310-linux_x86_64.whl" || true

- name: Install ti_mcu_nnc (Windows)
if: runner.os == 'Windows'
run: |
pip install "ti_mcu_nnc @ https://software-dl.ti.com/mctools/esd/tvm/mcu/ti_mcu_nnc-2.1.2-cp310-cp310-win_amd64.whl" || true

- name: Install ti_mcu_nnc (macOS)
if: runner.os == 'macOS'
run: |
pip install "ti_mcu_nnc @ https://software-dl.ti.com/mctools/esd/tvm/mcu/ti_mcu_nnc-2.1.2-cp310-cp310-macosx_14_0_arm64.whl" || true

- name: Install dependencies
run: |
set -e
python -m pip install --upgrade pip setuptools wheel
pip install -e tinyml-modelzoo
pip install -e tinyml-tinyverse
Expand All @@ -46,16 +62,6 @@ jobs:
pip install defusedxml==0.7.1 "numpy==2.2.6" "PyYAML==6.0.3" "tqdm==4.67.1" "requests==2.32.5" "torch==2.7.1"
pip install pytest

- name: Install ti_mcu_nnc (Linux only)
if: runner.os == 'Linux'
run: |
pip install "ti_mcu_nnc @ https://software-dl.ti.com/mctools/esd/tvm/mcu/ti_mcu_nnc-2.1.1-cp310-cp310-linux_x86_64.whl" || true

- name: Install ti_mcu_nnc (Windows only)
if: runner.os == 'Windows'
run: |
pip install "ti_mcu_nnc @ https://software-dl.ti.com/mctools/esd/tvm/mcu/ti_mcu_nnc-2.1.1-cp310-cp310-win_amd64.whl" || true

- name: Tier 1 — Component Tests
working-directory: tinyml-modelmaker
run: python -m pytest tests/test_model_registry.py tests/test_config_validation.py -v --tb=short
Expand Down
6 changes: 3 additions & 3 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ tinyml-modelmaker ---> tinyml-tinyverse

| Method | Command |
|---|---|
| CLI | `python tinyml_modelmaker/run_tinyml_modelmaker.py config.yaml` |
| CLI | `cd tinyml-modelmaker && python tinyml_modelmaker/run_tinyml_modelmaker.py config.yaml` |
| Shell | `run_tinyml_modelmaker.sh config.yaml` |
| Python API | `import tinyml_modelmaker; tinyml_modelmaker.get_set_go(config)` |
| GUI | Edge AI Studio Model Composer (uses `tinyml-mlbackend` Docker wrapper) |
Expand Down Expand Up @@ -522,12 +522,12 @@ graph TB

| # | Category | Issue | Severity | Effort |
|---|---|---|---|---|
| 1 | Testing | No test suite | Critical | High |
| 1 | Testing | No test suite (protocol conformance tests added; unit/integration/CI gaps remain) | Medium | High |
| 2 | Architecture | Monolithic descriptions file | Critical | Medium |
| 3 | Architecture | Overloaded constructor | High | Low |
| 4 | Architecture | Tight cross-repo coupling | High | High |
| 5 | Architecture | Duplicated task-type code | Medium | Medium |
| 6 | Architecture | No ABCs/Protocols | Medium | Low |
| 6 | Architecture | No ABCs/Protocols (Protocols added for modelmaker; tinyverse/torchmodelopt remain) | Low | Low |
| 7 | Code Quality | Magic strings | Medium | Low |
| 8 | Code Quality | Commented-out code | Low | Low |
| 9 | Code Quality | Inconsistent error handling | High | Medium |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def _check_regression(path: str, is_zip: bool) -> Tuple[List[str], List[str], bo
return errors, warnings, True, ""

errors.append(
f"ZIP missing top-level 'files/' directory. "
"ZIP missing top-level 'files/' directory. "
"Regression/forecasting data must be in a 'files/' subdirectory."
)
return errors, warnings, False, "Create a 'files/' directory at ZIP top level and place all CSV files inside it."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def check_sdk_installation(
"errors": [
f"{sdk_name} not found. Searched: {searched}",
f"Download from: {info['download_url']}",
f"After installing, pass sdk_path='<install_root>' to create_ccs_project.",
"After installing, pass sdk_path='<install_root>' to create_ccs_project.",
],
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def main():
"function": func_name,
"required_params": required,
"provided_params": list(kwargs.keys()),
"hint": f"Add the missing parameter(s) to your JSON args object.",
"hint": "Add the missing parameter(s) to your JSON args object.",
}))
sys.exit(1)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _read_env_vars() -> Dict:
print(f"[setup] ERROR reading .env from {ENV_FILE}: {e}", file=__import__('sys').stderr)
else:
print(f"[setup] ERROR: .env NOT FOUND at {ENV_FILE}", file=__import__('sys').stderr)
print(f"[setup] This file must be created by /tinyml-agent-skills:setup first", file=__import__('sys').stderr)
print("[setup] This file must be created by /tinyml-agent-skills:setup first", file=__import__('sys').stderr)
return vars_dict


Expand Down
26 changes: 13 additions & 13 deletions tinyml-modelmaker/test_all_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,24 +145,24 @@ def save_failure_log(config_path, result, timestamp):
log_file = LOGS_DIR / f"{timestamp}_{config_name}_FAILED.log"

with open(log_file, 'w') as f:
f.write(f"=" * 80 + "\n")
f.write(f"FAILED CONFIG TEST\n")
f.write(f"=" * 80 + "\n\n")
f.write("=" * 80 + "\n")
f.write("FAILED CONFIG TEST\n")
f.write("=" * 80 + "\n\n")
f.write(f"Config: {config_path}\n")
f.write(f"Timestamp: {timestamp}\n")
f.write(f"Duration: {result['duration']:.2f}s\n")
f.write(f"Return Code: {result['return_code']}\n")
f.write(f"Timeout: {result['timeout_exceeded']}\n")
f.write(f"Error Detected: {result.get('error_detected', False)}\n")
f.write(f"\n" + "=" * 80 + "\n")
f.write(f"STDOUT:\n")
f.write(f"=" * 80 + "\n")
f.write("\n" + "=" * 80 + "\n")
f.write("STDOUT:\n")
f.write("=" * 80 + "\n")
f.write(result['stdout'])
f.write(f"\n\n" + "=" * 80 + "\n")
f.write(f"STDERR:\n")
f.write(f"=" * 80 + "\n")
f.write("\n\n" + "=" * 80 + "\n")
f.write("STDERR:\n")
f.write("=" * 80 + "\n")
f.write(result['stderr'])
f.write(f"\n")
f.write("\n")

return log_file

Expand Down Expand Up @@ -205,7 +205,7 @@ def main():
start_timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")

print("=" * 80)
print(f"ModelMaker Config Test Suite")
print("ModelMaker Config Test Suite")
print("=" * 80)
print(f"Timeout: {args.timeout}s")
print(f"Total Configs: {len(all_configs)}")
Expand Down Expand Up @@ -265,7 +265,7 @@ def main():

# Stop on first failure if flag is set
if args.stop_on_error and not result['success']:
print(f"\n✗ Stopping on first failure (--stop-on-error flag set).")
print("\n✗ Stopping on first failure (--stop-on-error flag set).")
break

# Summary
Expand Down Expand Up @@ -304,7 +304,7 @@ def main():
f.write(f"Passed: {passed}\n")
f.write(f"Failed: {failed}\n")
f.write(f"Total Time: {format_duration(total_duration)}\n")
f.write(f"\n" + "=" * 80 + "\n")
f.write("\n" + "=" * 80 + "\n")
f.write("DETAILED RESULTS\n")
f.write("=" * 80 + "\n\n")

Expand Down
7 changes: 0 additions & 7 deletions tinyml-modelmaker/tests/test_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,8 @@

Uses ``@runtime_checkable`` isinstance checks to verify that every component
implementation provides the methods required by its corresponding protocol.

Requires TVM (compilation backend) which is not available on all platforms.
"""

import pytest

# TVM is required transitively via tinyml_benchmark → compilation.py
tvm = pytest.importorskip("tvm", reason="TVM not available on this platform")

from tinyml_modelmaker.ai_modules.protocols import (
Compiler,
DatasetHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@ def get_default_data_dir_for_task(task_category):

CROSS_COMPILER_OPTIONS_C28 = (f"--abi=eabi -O3 --opt_for_speed=5 --c99 -v28 -ml -mt --gen_func_subsections --float_support={{FLOAT_SUPPORT}} -I{C2000_CGT_INCLUDE} -I.")
CROSS_COMPILER_OPTIONS_F29H85 = (f"-O3 -ffast-math -I{C29_CGT_INCLUDE} -I.")
CROSS_COMPILER_OPTIONS_MSPM0 = (f"-Os -mcpu=cortex-m0plus -march=thumbv6m -mtune=cortex-m0plus -mthumb -mfloat-abi=soft -I. -Wno-return-type")
CROSS_COMPILER_OPTIONS_MSPM33C = (f"-O3 -mcpu=cortex-m33 -march=thumbv6m -mfpu=fpv5-sp-d16 -DARM_CPU_INTRINSICS_EXIST -mlittle-endian -mfloat-abi=hard -I. -Wno-return-type")
CROSS_COMPILER_OPTIONS_MSPM0 = ("-Os -mcpu=cortex-m0plus -march=thumbv6m -mtune=cortex-m0plus -mthumb -mfloat-abi=soft -I. -Wno-return-type")
CROSS_COMPILER_OPTIONS_MSPM33C = ("-O3 -mcpu=cortex-m33 -march=thumbv6m -mfpu=fpv5-sp-d16 -DARM_CPU_INTRINSICS_EXIST -mlittle-endian -mfloat-abi=hard -I. -Wno-return-type")

CROSS_COMPILER_OPTIONS_F280013 = CROSS_COMPILER_OPTIONS_C28.format(FLOAT_SUPPORT='fpu32', DEVICE_NAME=TARGET_DEVICE_F280013.lower() + 'x')
CROSS_COMPILER_OPTIONS_F280015 = CROSS_COMPILER_OPTIONS_C28.format(FLOAT_SUPPORT='fpu32', DEVICE_NAME=TARGET_DEVICE_F280015.lower() + 'x')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def run(self):
self.model_compilation.clear()
exit_flag = self.model_compilation.run()
if exit_flag:
print(f'Compilation failed')
print('Compilation failed')
with open(self.params.compilation.log_file_path, 'a') as lfp:
lfp.write('FAILURE: ModelMaker - Compilation failed.')
return self.params
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ def _get_device(self):
if self.params.training.num_gpus > 0:
if torch.backends.mps.is_available():
device = 'mps'
os.environ.setdefault('PYTORCH_ENABLE_MPS_FALLBACK', '1')
else:
device = 'cuda'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ def get_default_data_dir_for_task(task_category):
elif task_category in [TASK_CATEGORY_TS_REGRESSION, TASK_CATEGORY_TS_FORECASTING]:
return DATA_DIR_FILES
else:
return DATA_DIR_CLASSES # Safe fallback
raise ValueError(
f"Unsupported task_category '{task_category}'. "
f"Expected one of: {[TASK_CATEGORY_TS_CLASSIFICATION, TASK_CATEGORY_TS_ANOMALYDETECTION, TASK_CATEGORY_TS_REGRESSION, TASK_CATEGORY_TS_FORECASTING]}"
)


# target_device
Expand Down Expand Up @@ -1438,18 +1441,18 @@ def get_default_data_dir_for_task(task_category):

CROSS_COMPILER_OPTIONS_C28 = f"--abi=eabi -O3 --opt_for_speed=5 --c99 -v28 -ml -mt --gen_func_subsections --float_support={{FLOAT_SUPPORT}} -I{C2000_CGT_INCLUDE} -I."
CROSS_COMPILER_OPTIONS_C29 = f"-O3 -ffast-math -I{C29_CGT_INCLUDE} -I."
CROSS_COMPILER_OPTIONS_MSPM0 = f"-Os -mcpu=cortex-m0plus -march=thumbv6m -mtune=cortex-m0plus -mthumb -mfloat-abi=soft -I. -Wno-return-type"
CROSS_COMPILER_OPTIONS_AM263 = f"-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-r5 -mfloat-abi=hard -mfpu=vfpv3-d16 -mlittle-endian -O3 -I. -Wno-return-type"
CROSS_COMPILER_OPTIONS_AM263P = f"-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-r5 -mfloat-abi=hard -mfpu=vfpv3-d16 -mlittle-endian -O3 -I. -Wno-return-type"
CROSS_COMPILER_OPTIONS_AM261 = f"-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-r5 -mfloat-abi=hard -mfpu=vfpv3-d16 -mlittle-endian -O3 -I. -Wno-return-type"
CROSS_COMPILER_OPTIONS_MSPM33C = f"-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mlittle-endian -O3 -I. -Wno-return-type -march=thumbv8.1-m.main+cdecp0"
CROSS_COMPILER_OPTIONS_AM13E2 = f"-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mlittle-endian -O3 -I. -Wno-return-type -march=thumbv8.1-m.main+cdecp0"
CROSS_COMPILER_OPTIONS_CC1352 = f"-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O3 -Wl,-u,_c_int00 -Wno-return-type -march=armv7e-m -mthumb"
CROSS_COMPILER_OPTIONS_CC1312 = f"-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O3 -Wl,-u,_c_int00 -Wno-return-type -march=armv7e-m -mthumb"
CROSS_COMPILER_OPTIONS_CC1354 = f"-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mlittle-endian -O3 -I. -Wno-return-type -march=armv8-m.main"
CROSS_COMPILER_OPTIONS_CC1314 = f"-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mlittle-endian -O3 -I. -Wno-return-type -march=armv8-m.main"
CROSS_COMPILER_OPTIONS_CC2755 = f"-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mlittle-endian -O3 -I. -Wno-return-type -march=thumbv8.1-m.main+cdecp0 -Wno-incompatible-pointer-types"
CROSS_COMPILER_OPTIONS_CC35X1 = f"-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mlittle-endian -O3 -I. -Wno-return-type -march=thumbv8.1-m.main+cdecp0 -Wno-incompatible-pointer-types"
CROSS_COMPILER_OPTIONS_MSPM0 = "-Os -mcpu=cortex-m0plus -march=thumbv6m -mtune=cortex-m0plus -mthumb -mfloat-abi=soft -I. -Wno-return-type"
CROSS_COMPILER_OPTIONS_AM263 = "-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-r5 -mfloat-abi=hard -mfpu=vfpv3-d16 -mlittle-endian -O3 -I. -Wno-return-type"
CROSS_COMPILER_OPTIONS_AM263P = "-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-r5 -mfloat-abi=hard -mfpu=vfpv3-d16 -mlittle-endian -O3 -I. -Wno-return-type"
CROSS_COMPILER_OPTIONS_AM261 = "-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-r5 -mfloat-abi=hard -mfpu=vfpv3-d16 -mlittle-endian -O3 -I. -Wno-return-type"
CROSS_COMPILER_OPTIONS_MSPM33C = "-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mlittle-endian -O3 -I. -Wno-return-type -march=thumbv8.1-m.main+cdecp0"
CROSS_COMPILER_OPTIONS_AM13E2 = "-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mlittle-endian -O3 -I. -Wno-return-type -march=thumbv8.1-m.main+cdecp0"
CROSS_COMPILER_OPTIONS_CC1352 = "-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O3 -Wl,-u,_c_int00 -Wno-return-type -march=armv7e-m -mthumb"
CROSS_COMPILER_OPTIONS_CC1312 = "-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O3 -Wl,-u,_c_int00 -Wno-return-type -march=armv7e-m -mthumb"
CROSS_COMPILER_OPTIONS_CC1354 = "-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mlittle-endian -O3 -I. -Wno-return-type -march=armv8-m.main"
CROSS_COMPILER_OPTIONS_CC1314 = "-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mlittle-endian -O3 -I. -Wno-return-type -march=armv8-m.main"
CROSS_COMPILER_OPTIONS_CC2755 = "-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mlittle-endian -O3 -I. -Wno-return-type -march=thumbv8.1-m.main+cdecp0 -Wno-incompatible-pointer-types"
CROSS_COMPILER_OPTIONS_CC35X1 = "-DARM_CPU_INTRINSICS_EXIST -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mlittle-endian -O3 -I. -Wno-return-type -march=thumbv8.1-m.main+cdecp0 -Wno-incompatible-pointer-types"


CROSS_COMPILER_OPTIONS_F280013 = CROSS_COMPILER_OPTIONS_C28.format(FLOAT_SUPPORT='fpu32', DEVICE_NAME=TARGET_DEVICE_F280013.lower() + 'x')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,10 @@ def _get_device(self):
if self.params.training.num_gpus > 0:
if torch.backends.mps.is_available():
device = 'mps'
# MPS doesn't implement every op; unknown ops fall back to CPU
# when this flag is set. Must be in os.environ before the first
# MPS-dispatched kernel runs.
os.environ.setdefault('PYTORCH_ENABLE_MPS_FALLBACK', '1')
else:
device = 'cuda'
return device, distributed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,8 @@ def get_default_data_dir_for_task(task_category):

CROSS_COMPILER_OPTIONS_C28 = (f"--abi=eabi -O3 --opt_for_speed=5 --c99 -v28 -ml -mt --gen_func_subsections --float_support={{FLOAT_SUPPORT}} -I{C2000_CGT_INCLUDE} -I.")
CROSS_COMPILER_OPTIONS_F29H85 = (f"-O3 -ffast-math -I{C29_CGT_INCLUDE} -I.")
CROSS_COMPILER_OPTIONS_MSPM0 = (f"-Os -mcpu=cortex-m0plus -march=thumbv6m -mtune=cortex-m0plus -mthumb -mfloat-abi=soft -I. -Wno-return-type")
CROSS_COMPILER_OPTIONS_MSPM33C = (f"-O3 -mcpu=cortex-m33 -march=thumbv6m -mfpu=fpv5-sp-d16 -DARM_CPU_INTRINSICS_EXIST -mlittle-endian -mfloat-abi=hard -I. -Wno-return-type")
CROSS_COMPILER_OPTIONS_MSPM0 = ("-Os -mcpu=cortex-m0plus -march=thumbv6m -mtune=cortex-m0plus -mthumb -mfloat-abi=soft -I. -Wno-return-type")
CROSS_COMPILER_OPTIONS_MSPM33C = ("-O3 -mcpu=cortex-m33 -march=thumbv6m -mfpu=fpv5-sp-d16 -DARM_CPU_INTRINSICS_EXIST -mlittle-endian -mfloat-abi=hard -I. -Wno-return-type")

CROSS_COMPILER_OPTIONS_F280013 = CROSS_COMPILER_OPTIONS_C28.format(FLOAT_SUPPORT='fpu32', DEVICE_NAME=TARGET_DEVICE_F280013.lower() + 'x')
CROSS_COMPILER_OPTIONS_F280015 = CROSS_COMPILER_OPTIONS_C28.format(FLOAT_SUPPORT='fpu32', DEVICE_NAME=TARGET_DEVICE_F280015.lower() + 'x')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def _get_device(self):
if self.params.training.num_gpus > 0:
if torch.backends.mps.is_available():
device = 'mps'
os.environ.setdefault('PYTORCH_ENABLE_MPS_FALLBACK', '1')
else:
device = 'cuda'

Expand Down
4 changes: 2 additions & 2 deletions tinyml-modelmaker/tinyml_modelmaker/utils/misc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ def resolve_paths(params, target_devices_all):
params.compilation.compilation_path = absolute_path(params.compilation.compile_output_path)
params.compilation.model_packaged_path = os.path.join(
params.compilation.compile_output_path,
'_'.join(os.path.split(params.common.run_name))
'_'.join(filter(None, os.path.split(params.common.run_name)))
+ f'_{params.common.target_device}.zip')
else:
params.compilation.compilation_path = absolute_path(
os.path.join(params.common.project_run_path, 'compilation'))
params.compilation.model_packaged_path = os.path.join(
params.compilation.compilation_path,
'_'.join(os.path.split(params.common.run_name))
'_'.join(filter(None, os.path.split(params.common.run_name)))
+ f'_{params.common.target_device}.zip')

return params
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,8 @@ def infer(args, epoch, valid_loader, model, criterion):
with torch.no_grad():
input = input.to(device).float() # Move input to device
target = target.to(device).long() # Move target to device

logits = model(input) # Forward pass
loss = criterion(logits, target) # Compute loss
logits = model(input) # Forward pass
loss = criterion(logits, target) # Compute loss

prec1, prec5 = accuracy(logits, target, topk=(1, 1)) # Compute accuracy
n = input.size(0)
Expand Down
Loading
Loading