You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge in TINYML-ALGO/tinyml-agent-skills from 2026/pranav_a to main
* commit 'be83fc6267a898cc6eeab38ffe0c0a344528ab97':
minor fixes
removed assets, included autoMP quant
Before returning the fetched recommendations to the user, go through the dataset analysis in `$WORK_DIR/.tmp_dataset_stats.json` completely. Based on these statistics ensure the recommended presets/transforms are suited for the dataset.
297
297
For example:
298
-
If for a classification task, the `min_sample_or_seq_length` is 70, then having a frame size of 128 or 256 would be too high and would cause that sample file to be skipped, thus causing data loss. That would be unacceptable.
299
-
Similarly, having feature extraction presets which use a window of 128 or 256 would also be a wrong choice, for the same reason.
300
-
In this case, you must therefore suggest presets or transforms having frame/window size <=70.
298
+
If for a classification task, the `min_sample_or_seq_length` is 70, then having a frame_size > 70 in the preset or data transform would be too high and would cause that sample file to be skipped, thus causing data loss. **This would be unacceptable.**
299
+
You must therefore suggest presets or transforms having frame/window size <=`min_sample_or_seq_length`. #NAME min_sample_or_seq_length could be causing confusion for agent
301
300
302
-
Also, understand what each recommended transform does - go through `references/FE_and_Data_Processing_Transforms/FE_transforms.md` and `references/Data_processing_transforms.md`. For presets, go through `assets/timeseries_data_proc_feat_ext_consts.md`.
301
+
Also, understand what each recommended transform does - go through `references/FE_and_Data_Processing_Transforms/FE_transforms.md` and `references/Data_processing_transforms.md`. For presets, consult `$TINYML_BASE_PATH/tinyml-modelmaker/tinyml_modelmaker/ai_modules/timeseries/constants.py` (source of truth for feature extraction and data processing presets).
303
302
Try understanding whether your recommendations actually will be useful for the dataset you are working with and if so, why. **Give CLEAR point-by-point reasoning to the user regarding why your recommended transforms or presets are valid and useful.**
304
303
305
304
Show user the complete, structured output of `get_data_proc_feat_ext_recommendations` - summarize the same as well while showing it to the user.
| Model Name | Param Count | Complexity | Merits | Demerits | Ideal Use Case |
352
+
353
+
For each model, include:
354
+
-**Merits:** Speed, accuracy, memory efficiency, special capabilities (e.g., "Fast inference on NPU", "Best accuracy")
355
+
-**Demerits:** Trade-offs (e.g., "Lower accuracy than larger models", "Requires quantization")
356
+
-**Ideal Use Case:** When/where to use (e.g., "Tight memory constraints", "Real-time inference requirement")
357
+
358
+
**Part D — provide your recommendation:**
359
+
360
+
Based on dataset size, ranked scores, and device constraints, give **CLEAR, POINT-BY-POINT recommendation** format:
361
+
362
+
"I recommend **[MODEL_NAME]** because:
363
+
- Point 1: [reason specific to this dataset size]
364
+
- Point 2: [reason specific to this device]
365
+
- Point 3: [reason specific to performance needs]
366
+
367
+
**Alternatives:**
368
+
-[ALT_MODEL] if you prioritize [property]
369
+
-[ALT_MODEL2] if you need [property]"
370
+
371
+
Inform user: "You can accept this recommendation or select any model from the table above."
344
372
345
373
Store user's choice as `MODEL_NAME`.
346
374
347
375
---
348
376
349
377
## Step 8: Generate training section
350
-
351
-
> **MANDATORY: Parts C and D (quantization and NAS) are NOT optional. You MUST ask the user about both — every single time — before generating the training section YAML. Do not skip or defer these questions. The user cannot make informed decisions without being asked.**
352
-
378
+
**DO NOT SKIP ANY OF THE BELOW PARTS. ENSURE STEP 8 IS FULLY DONE, EVERY PART, EVERY SINGLE TIME**
353
379
### Part A — get recommendations
354
380
355
381
```bash
@@ -370,6 +396,7 @@ Ask:
370
396
- Custom learning rate?
371
397
372
398
Inform the user that all are optional, user can press `Enter` to use system defaults (taken from the corresponding modules' `params.py`).
399
+
373
400
**HIGHLY IMPORTANT**
374
401
For number of GPUs, if user does not specify or does not know, run the following simple python script:
Use the result from the above script to set `NUM_GPUS`.
381
408
382
-
### Part C — **MANDATORY**: ask user about quantization
409
+
### Part C — ask user about quantization
383
410
384
-
**Do not skip this.**Present all three modes clearly, state the recommendation from `quantization.recommended_mode`, and ask the user to choose:
411
+
Present all three modes clearly, state the recommendation, and ask the user to choose:
385
412
386
413
```
387
414
Quantization reduces model size and enables hardware acceleration.
@@ -393,83 +420,31 @@ Modes:
393
420
394
421
The recommendation for YOUR device ($TARGET_DEVICE): mode <quantization.recommended_mode>
395
422
Reason: <quantization.reason>
396
-
```
397
-
398
-
Ask in sequence — get a confirmed answer for each before moving on:
399
-
1. "Which quantization mode do you want? (0 / 1 / 2)" → store as `QUANTIZATION_MODE`
400
-
2. If `QUANTIZATION_MODE > 0`: "QAT (better accuracy, longer training) or PTQ (faster, less accurate)?" → store as `QUANTIZATION_METHOD`
401
-
3. If `QUANTIZATION_MODE > 0`: "Bit width for weights? (8 / 4 / 2 — default 8)" → store as `WEIGHT_BITS`
402
-
4. If `QUANTIZATION_MODE > 0`: "Bit width for activations? (8 / 4 / 2 — default 8)" → store as `ACTIVATION_BITS`
403
-
404
-
> Quantization mode will also determine the compilation preset in Step 10 — setting it correctly here matters for end-to-end correctness.
405
-
406
-
### Part D — **MANDATORY**: ask user about NAS
407
-
408
-
**Do not skip this.**
409
-
410
-
**NAS (Neural Architecture Search)** automatically finds an optimal model architecture for your task and device constraints. It replaces the fixed model from ModelZoo with a search process that discovers the best architecture from your data.
411
-
412
-
When to use NAS:
413
-
✓ You don't know what the right model for your use-case looks like
414
-
✓ You do not want the previously recommended model from TinyML-ModelZoo
415
-
✓ You have GPU access (NAS is impractical without a GPU)
416
423
417
-
When NOT to use NAS:
418
-
✗ No GPU available (each search epoch takes several minutes on CPU)
419
-
✗ Tight time constraints
420
-
✗ Standard models already work well
421
-
422
-
Model size presets (controls search space):
423
-
s — Small, 3 layers. Fast search (~10-20 min). Good starting point.
424
-
m — Medium, 10 layers. Moderate search time. Recommended default.
425
-
l — Large, 12 layers. Longer search.
426
-
xl — Extra-large, 20 layers. Use when l is insufficient.
427
-
xxl — Largest search space. Slowest.
428
-
429
-
Optimization modes:
430
-
Memory — minimize parameter count (flash/RAM footprint on MCU)
431
-
Compute — minimize MACs/FLOPs (inference latency)
432
-
433
-
Present the above to the user, then ask the following **in this exact format**:
434
-
1. "Do you want to use NAS? [This will result in rejection of chosen model from ModelZoo]"
435
-
2. If yes: "Which model size preset?" (default: 'm')
436
-
3. If yes: "Optimization mode — Memory or Compute?" (steer based on device constraints)
437
-
4. If yes: "How many NAS search epochs?" (default: 10; more = better but slower)
424
+
When you select mode 1 or 2, Automatic Mixed Precision (AMP) is enabled by default:
425
+
<autoquant_explanation>
426
+
```
438
427
439
-
Store user responses in `NAS_ENABLED`, `NAS_MODEL_SIZE`, `NAS_OPT_MODE`, `NAS_EPOCHS`.
428
+
Ask:
429
+
- "Which quantization mode do you want? (0 / 1 / 2)" → store as `QUANTIZATION_MODE`
440
430
441
-
### Part E — generate YAML
431
+
That's it. No need to ask about PTQ/QAT or bit widths — AMP handles per-layer precision automatically.
Show user the generated YAML so they can confirm the training config before proceeding.
472
445
446
+
**Note:** If user explicitly wants to disable AMP and use uniform quantization instead, they can set `quantization_method` and bit widths manually, but this is not recommended and rarely needed.
447
+
473
448
---
474
449
475
450
## Step 9: Generate testing section
@@ -576,7 +551,7 @@ Then proceed to implement the changes (either the ones you recommended or the on
576
551
DO THIS UNTIL TRAINING HAPPENS CLEANLY WITHOUT ISSUE.
577
552
578
553
**COMMON ISSUES TO LOOK OUT FOR:**
579
-
1. Feature Extraction preset failed due to size issues. Dataset's class samples may have too few entries for presets. If no presets can fit it, then think of using raw feature extraction transforms. You can find all transforms in `/home/tushxr16/tinyml-tensorlab-skills/assets/timeseries_data_proc_feat_ext_consts.md`. See if any of them or any combination of them could be of use for your usecase and accordingly select them.
554
+
1. Feature Extraction preset failed due to size issues. Dataset's class samples may have too few entries for presets. If no presets can fit it, then think of using raw feature extraction transforms. Consult `$TINYML_BASE_PATH/tinyml-modelmaker/tinyml_modelmaker/ai_modules/timeseries/constants.py` for all available transforms and presets. See if any of them or any combination of them could be of use for your usecase and accordingly select them.
580
555
581
556
2. Due to the above issue, many times files having less number of samples (less than what the presets may expect) may be skipped. As a result the metrics you get may be skewed and show very high values. Do not get confused and report this to the user as the final metrics. Stop the training, go back to the config, and refer point 1 to fix the issue. Once fixed, then train again.
582
557
@@ -609,7 +584,7 @@ Device: $TARGET_DEVICE
609
584
610
585
**User MUST verify this fits on their device before deployment.**
611
586
612
-
Get device specs from `assets/deployment_sdk_reference.md` or:
587
+
Get device specs from `references/deployment_sdk_reference.md` or:
0 commit comments