Skip to content

Merge into working PR.#34

Merged
twitchax merged 3 commits into
copilot/add-mode-and-scale-supportfrom
main
Jan 21, 2026
Merged

Merge into working PR.#34
twitchax merged 3 commits into
copilot/add-mode-and-scale-supportfrom
main

Conversation

@twitchax
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings January 21, 2026 08:38
@twitchax twitchax merged commit 114a856 into copilot/add-mode-and-scale-support Jan 21, 2026
4 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades the Burn ML framework from version 0.19 to 0.20, which involves significant API changes in the training and inference infrastructure. The changes properly adapt to Burn's new training API architecture while also including a retrained model with updated decision thresholds.

Changes:

  • Updated Burn dependency from 0.19 to 0.20 with major API refactoring for training infrastructure
  • Refactored KordBatcher to remove device storage and use the device parameter passed to batch() method
  • Migrated from TrainStep/ValidStep to TrainStep/InferenceStep with associated types, and from LearnerBuilder to SupervisedTraining API
  • Added new train-model task to Makefile.toml for convenient model training with configurable epochs
  • Updated model thresholds based on retraining with the new framework
  • Minor documentation updates to clarify cargo-make requirements for remote agents

Reviewed changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
kord/Cargo.toml Updates Burn dependency from 0.19 to 0.20
Cargo.lock Massive dependency tree update reflecting Burn 0.20's restructuring (burn-common → burn-std, cubecl reorganization)
kord/src/ml/train/helpers.rs Implements new TrainStep/InferenceStep traits with associated types instead of generic parameters
kord/src/ml/train/execute.rs Migrates to SupervisedTraining API, removes LearnerBuilder pattern, adds explicit device transfer after training
kord/src/ml/train/data.rs Simplifies KordBatcher by removing device field, using device parameter from batch() method
kord/src/ml/infer/execute.rs Adds allow(unused_variables) for conditionally-used error variable
kord/model/thresholds.json Updates decision thresholds from retrained model
Makefile.toml Adds train-model task with EPOCHS environment variable support
AGENTS.md Documents cargo-make requirement for remote agents
.github/workflows/copilot-setup-steps.yml Reformats YAML indentation but truncates final build step
.github/copilot-instructions.md Documents cargo-make requirement for remote agents

packages: cargo-make cargo-leptos wasm-pack wkg cargo-nextest cargo-llvm-cov leptosfmt

- name: Prefetch deps
run: cargo fetch
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow file appears incomplete. The original version had a "Smoke build (core)" step at the end (line 48-49) that ran "cargo make build", but it was removed in this change. This looks like an accidental truncation rather than an intentional removal. The step should be restored to ensure the workflow validates that the codebase builds correctly.

Suggested change
run: cargo fetch
run: cargo fetch
- name: Smoke build (core)
run: cargo make build

Copilot uses AI. Check for mistakes.
let chords = if pitches.is_empty() {
vec![]
} else {
#[allow(unused_variables)]
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The #[allow(unused_variables)] annotation is misleading here. The closure parameter e is actually used on line 129 when the cli feature is enabled. This attribute suggests the variable is never used, but it is conditionally used. Consider using #[cfg_attr(not(feature = "cli"), allow(unused_variables))] to more accurately reflect that the variable is only unused when the CLI feature is disabled.

Suggested change
#[allow(unused_variables)]
#[cfg_attr(not(feature = "cli"), allow(unused_variables))]

Copilot uses AI. Check for mistakes.
let model_trained = learner.fit(dataloader_train, dataloader_valid).model;
let model_trained = training.launch(Learner::new(model, adam_config.init(), lr_scheduler)).model;

// Move model to device to ensure all weights are on the correct device after training.
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addition of to_device(&device) after training (line 111) suggests that the model might end up on a different device after the training process in Burn 0.20. This is a potentially important change. Please verify that this is necessary and document why it's needed, as it could indicate a behavior change in Burn 0.20 where the model device is not guaranteed to be preserved during training. If this is a workaround for a bug or unexpected behavior, consider adding a comment explaining the rationale.

Suggested change
// Move model to device to ensure all weights are on the correct device after training.
// Defensive: ensure the trained model is on `device` before running inference/evaluation.
// In Burn 0.20, the exact device placement of the model returned from `SupervisedTraining::launch`
// is not explicitly documented, especially when using an `AutodiffBackend` with an `InnerBackend`
// for validation. Calling `to_device(&device)` here guarantees that all parameters end up on the
// same device we used for model construction and for subsequent prediction (`collect_prediction_stats`).
// If Burn already preserves the original device, this call is effectively a no-op, but it protects us
// against subtle device mismatches if that behavior changes.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants