Skip to content

Conversation

@baochunli
Copy link
Collaborator

@baochunli baochunli commented Oct 23, 2025

Description

  • Declared optional trainer/model attributes, added safe fallbacks, and routed sleep simulations through validated helpers (plato/trainers/base.py, composable.py, mlx.py, plato/config.py).
  • Hardened MLX/optional-backend logic: dynamic imports with casts, null-safe tensor ops, optimizer registries, batching helpers.
  • Sanitized aggregation strategies to rely on validated trainer/server hooks and return consistent dictionaries (FedAvg/FedBuff/FedNova/FedAsync/Hermes/GAN/HE, MPC secret recovery, samplers).
  • Reworked HuggingFace trainer to split callback plumbing, build tokenizers/configs with typed arguments, and align collators.
  • Cleaned modeling utilities (CNN encoders, ViT wrappers, HuggingFace models, resnet registry) plus general MLP builder to validate config structures.
  • Updated GAN training loop to use callable interfaces and typed logging.
  • Fixed all other type checker issues from ty 0.0.1alpha24.

The following examples have also been type checked and tested by running experiments:

  • examples/model_search
  • examples/custom_client_training
  • examples/personalized_fl
  • examples/server_aggregation
  • examples/unlearning
  • examples/ssl
  • examples/three_layer_fl

Documentation has been improved with a reference for one of the model search examples, as well as for using the type checker in Quick Start.

How has this been tested?

uvx ty check plato
uvx ty check examples/model_search (and etc. for the other examples)

Types of changes

  • Bug fix (non-breaking change which fixes an issue) Fixes #
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code has been formatted using the Ruff formatter (ruff format) and checked using the Ruff linter (ruff check --fix).
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@netlify
Copy link

netlify bot commented Oct 23, 2025

Deploy Preview for platodocs canceled.

Name Link
🔨 Latest commit 67e593a
🔍 Latest deploy log https://app.netlify.com/projects/platodocs/deploys/68fcf91fc7e78f0008ff7237

…t -> Long cast errors during weighted updates.

The numpy/torch accumulation now temporarily upcasts non-floating
payloads and avoids in-place adds that would force unsafe  casts,
keeping the logic stable across nested structures.  After aggregation,
results are coerced back to the baseline (or first-delta) dtypes via
_match_reference_structure, rounding integers and thresholding booleans
where needed to keep state-dict loading happy. When no weight-bearing
reports are present the strategy now returns None, preserving the
existing feature-update short-circuit behaviour.
… to return Optional[Dict], matching the cases where it legitimately yields None and satisfying the type checker.
…ng, personalized_fl, reinforcement_learning.
- Adjusted the SCAFFOLD callback so the extractor runs only after
safetensor_decode, skips duplicate insertions, and gracefully resets
stale control variates when the payload is not a list.

- Ensured the outbound callback adds a single delta-attaching processor
immediately before encoding, preventing nested payloads across rounds.
…gation: after a defence pass we now trim self.updates alongside the weight list, and when every report is rejected we just return an empty payload and log that the previous global weights are kept.

In the FedAvg aggregation strategy we added baseline fallbacks: when no
eligible updates remain or all have zero samples, we deep-copy the
current baseline weights (or build a zero-delta via the algorithm) so
the round finishes without errors.
…vers so the framework now defers to each algorithm’s own weight-merging logic instead of the generic FedAvg path, avoiding the strict shape checks that trashed partial sub-models.
… for binding while clearing Config.args.port when no explicit --id is provided, preserving the cross-silo role checks even when launching with -p.
@baochunli baochunli merged commit baced5d into main Oct 25, 2025
6 of 7 checks passed
@baochunli baochunli deleted the typecheck branch October 25, 2025 16:22
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