In the train-renderer thread try_recv is called in the loop without
a sleep condition causing the CPU to spin at full speed mostly
calling try_recv.
This changes it so that recv_timeout waits for the remainder of the
tick and then proceed to render if necessary.
This showed up as ~20% CPU time spent during profiling with perf.
* quantization: add Calibration::Ternary for BitNet b1.58 weight quantization
Extends the Calibration enum with a Ternary variant that maps
{-1, 0, +1} weights to a symmetric [-γ, +γ] range where γ is
mean(|W|) (BitNet b1.58 §3.1) or a caller-supplied threshold.
Intended for use with QuantValue::Q2S + QuantStore::PackedU32,
which packs 16 ternary weights per u32 — 16× smaller than f32,
4× smaller than int8.
let layer = Linear::new(cfg, &device)
.quantize(&QuantScheme::default()
.with_value(QuantValue::Q2S)
.with_store(QuantStore::PackedU32(0)),
&Calibration::Ternary { threshold: None });
Adds three tests (per-tensor auto, per-tensor explicit, per-block auto)
to the existing calibration test module.
* quantization: rename Calibration::Ternary to AbsMean, drop threshold field
Per laggui's review: the calibration strategy is absolute-mean (mean(|W|)),
not "ternary" — ternary refers to the quantization values, not the range
finder. Remove the optional threshold override field since it doesn't fit
the calibration-method abstraction. Fix rustfmt failures on long lines.
* Apply suggestions from code review
* calibration tests: restore block level on abs_mean per_block test
The previous suggestion drop accidentally removed .with_level(QuantLevel::block([4]))
from abs_mean_calibration_range_per_block and left the let-binding missing its
semicolon, which broke the build. Restore the block level and terminate the
statement to match min_max_calibration_range_per_block.
* feat: add TrainingProgressLogger
* feat: add a debug implementation of TrainingProgressLogger
* feat: expose new optional progress_logger
* feat: rename trait function end_eval to end_epoch and update mnist example
* feat: add EvaluationProgressLogger trait
* fix: fix evaluation_logger override
* doc: add documentation for EvaluationProgressLogger
* feat: refactor training and evaluation logger to be more general and structured
* feat: put the new methods in full.rs pipeline and evaluation pipeline
* feat: put the new methods in full.rs pipeline and evaluation pipeline
* chore: removed boolean for FullEventTrainingProcessor
* chore: remove is_test_started from EvaluationEventPorcessor and add TestStart Event
* feat: add EndEpoch event and add TrainingProgressLogger in minimal.rs
* doc: updated doc
* doc: update documentation in pardigm.rs
* fix: address pr comments
* feat: update method signature from new traits
* fix: change output directory in mnist and add total_test to EvalEven::start
* feat: add EndTest event and refactor evaluation pipeline to ugrade logging
* fix: reset default values in mnist example
* feat: add new event of TrainingProgressLogger to ddp algorithm
* fix: doc test and lint
* refactor: Change Training and Evaluation progress loggers parameters in trait methods
* refactor: Renderer now uses Progress logger traits for training
* refactor: add renderer calls in all events in full.rs
* refactor: replace all Progress structs for GlobalProgress
* refactor: implemnt OverallProgressLogger in burn-train
* refactor: implemnt OverallProgressLogger in burn-train
* refactor: remove global_progress of TrainingItem
* refactor: add progressEvent and counters in TrainingprogressLogger implementations
* refactor: add log_event to EvaluationProgressLogger
* refactor: add ProgressLogger and events to RL
* refactor: erased ProgressEvents and put strings instead
* fix: put mnist example back to normal
* fix: format
* fix: erased old test artifacts
* fix: erase useless character
* fix : erase duplicated line of code
* fix: correct documentation
* fix: change method call to be more logic
* fix: change label name for consistency
* fix: change method call
* fix: commented one line to remove rl from default features
* refactor: change stafulness from eventProcessor to Implementations
* refactor: change stafulness from eventProcessor to Implementations
* fix: formatting
* fix: address comments
* fix: fix CI
* refactor: Migrate to changes to references
* Fix rebase
* Port to lifetime views
* Turn off compilation log
* Update to upstream changes
* Cleanup
* Update rev
* update dqn-agent example
* update device stuff + couple bugs in dispatch
* update main and some utils
* deal with the whole to_device thing for off policy
* remove test code + fix warnings
* burn toml file
* feat(train): add mouse support to TUI metric navigation
* feat(train): make TUI tab-strip chevrons clickable
* refactor(train): bundle TUI text hit-state and gate redraws
* fix(train): restore TUI key handling on Windows
* feat: add TrainingProgressLogger
* feat: add a debug implementation of TrainingProgressLogger
* feat: expose new optional progress_logger
* feat: rename trait function end_eval to end_epoch and update mnist example
* feat: add EvaluationProgressLogger trait
* fix: fix evaluation_logger override
* doc: add documentation for EvaluationProgressLogger
* feat: refactor training and evaluation logger to be more general and structured
* feat: put the new methods in full.rs pipeline and evaluation pipeline
* feat: put the new methods in full.rs pipeline and evaluation pipeline
* chore: removed boolean for FullEventTrainingProcessor
* chore: remove is_test_started from EvaluationEventPorcessor and add TestStart Event
* feat: add EndEpoch event and add TrainingProgressLogger in minimal.rs
* doc: updated doc
* doc: update documentation in pardigm.rs
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* fix: address pr comments
* feat: update method signature from new traits
* fix: change output directory in mnist and add total_test to EvalEven::start
* feat: add EndTest event and refactor evaluation pipeline to ugrade logging
* fix: reset default values in mnist example
* feat: add new event of TrainingProgressLogger to ddp algorithm
* fix: doc test and lint
The TUI dashboard's Left/Right arrow handlers call next_metric and
previous_metric, which do (selected + 1) % data.len() and
data.len() - 1 unconditionally. Before the first metric is recorded,
data is empty, so the first arrow press panics with 'remainder with
a divisor of zero' (Right) or 'subtract overflow' (Left), killing
the TUI render thread.
Return early when data is empty in both methods, matching the empty
state that view() already handles by returning NumericMetricView::None.
Add a regression test that exercises both methods on the default
(empty) state.
* autodiff for rfft/irfft
* removed `ignore` on tests as requested
* feature-gated tests, added test for dim nonzero
* fixed bug when n is Some + more tests
* cargo fmt + typo fix
* Fix tests cond
AUROC was binary-only and panicked on >2 classes. It now supports
binary, multiclass and multi-label classification via a One-vs-Rest
decomposition aggregated with a Micro/Macro class reduction.
- AurocMetric now uses `ConfusionStatsInput` (like Precision/Recall/
FBetaScore), so it is implicitly adapted for both
`ClassificationOutput` and `MultiLabelClassificationOutput`.
- Add `RankingMetricConfig` (threshold-free config) + `From<
ClassificationMetricConfig>`; AUROC has no decision rule by design.
- Public constructors: `binary()`, `multiclass(ClassReduction)`,
`multilabel(ClassReduction)`. `new` is now private.
- Degenerate classes (no positive/negative pair) yield NaN and are
dropped from the Macro mean; all-degenerate -> 0.0 with a warning.
- Remove the now-dead `AurocInput` type and its `Adaptor` impl.
- Update the metric book accordingly.
BREAKING CHANGE:
- `AurocInput` removed. Use the built-in `ClassificationOutput` /
`MultiLabelClassificationOutput` adaptors, or `ConfusionStatsInput`.
- `AurocMetric::new()` (no-arg) removed -> use `AurocMetric::binary()`.
- Displayed metric name changed: "AUROC" -> "AUROC [Macro|Micro]".
Closes#4932.
BurnConfig now ships in the burn umbrella alongside the runtime_config function,
and its inner FusionConfig/AutodiffConfig sub-trees are reached via fusion() and
autodiff() getters instead of public fields.
* Add BLEU score training metric (#544)
Implements sentence-level BLEU (Bilingual Evaluation Understudy) as a
training metric, following the existing CER/WER pattern.
- Configurable max n-gram order via `with_max_n()` (default: BLEU-4)
- Pad token stripping via `with_pad_token()`
- Modified n-gram precision with brevity penalty per Papineni et al.
- 9 tests covering perfect/zero/partial match, brevity penalty,
padding, batching, bigrams, clear, and naming
* Address review: constructor API, corpus-style batch BLEU, smoothing
- Make `with_max_n` the primary constructor (matches TopKAccuracy pattern)
- Default name now `BLEU-4` instead of `BLEU`
- Accumulate n-gram counts across batch (corpus-style) instead of
averaging per-sentence scores
- Return 0 for short references without smoothing (standard BLEU)
- Add `BleuSmoothing` enum: None, AddEpsilon, Exponential (Chen & Cherry 2014)
- Document epoch-level aggregation limitation with TODO
* address review: stateful k for exponential smoothing
Per laggui's comment, SacreBLEU's smoothing method 3 uses a stateful
multiplier that doubles for every n-gram order with zero matches, not
the n-gram order itself. Update Exponential smoothing to track a
running multiplier as in Chen & Cherry (2014) / SacreBLEU.
Refs: https://aclanthology.org/W14-3346.pdfhttps://github.com/mjpost/sacrebleu/blob/master/sacrebleu/metrics/bleu.py#L282
* Migrate BLEU to backendless Tensor signature (#4717)
Drop the B: Backend generic from BleuScore and BleuInput; switch to
the new Tensor<2, Int> signature introduced by #4717. Mirrors the
shape now used by sister metrics CER/WER.
Tested with cargo test --lib bleu -p burn-train (13/13 pass).
* Cargo fmt
* Remove generics from tensor kind traits and Elem associated type
* Move backend extension, re-export no types from burn_backend and fix into_scalar missing types
* Remove into/from primitive usage in burn-optim
* Fix backtrace
* Fix float_sort_with_indices int dtype
* Fix feature gated
* Remove dead code
* Add tensor primitive note
* Another note
* High level kind
* Working but still pub traits
* Fix into_scalar doc example
* Fix argsort out dtype
* Restrict ops traits to pub(crate)
* Add other backends for burn-vision