fl

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoUpdates = errors.New("no updates provided for aggregation")
	ErrOverflow  = errors.New("sample count overflow during aggregation")
)

Functions

This section is empty.

Types

type Aggregator

type Aggregator interface {
	Aggregate(updates []Update) (Model, error)
}

func NewFedAvgAggregator

func NewFedAvgAggregator() Aggregator

type FedAvgAggregator

type FedAvgAggregator struct{}

func (*FedAvgAggregator) Aggregate

func (f *FedAvgAggregator) Aggregate(updates []Update) (Model, error)

type Model

type Model struct {
	Data     map[string]any `json:"data"`
	Metadata map[string]any `json:"metadata,omitempty"`
}

type PersistentStorage

type PersistentStorage struct {
	// contains filtered or unexported fields
}

func NewPersistentStorage

func NewPersistentStorage(roundsDir, modelsDir string) (*PersistentStorage, error)

func (*PersistentStorage) ListModels

func (ps *PersistentStorage) ListModels() ([]int, error)

func (*PersistentStorage) ListRounds

func (ps *PersistentStorage) ListRounds() ([]string, error)

func (*PersistentStorage) LoadModel

func (ps *PersistentStorage) LoadModel(version int) (*Model, error)

func (*PersistentStorage) LoadRound

func (ps *PersistentStorage) LoadRound(roundID string) (*RoundState, error)

func (*PersistentStorage) SaveModel

func (ps *PersistentStorage) SaveModel(version int, model Model) error

func (*PersistentStorage) SaveRound

func (ps *PersistentStorage) SaveRound(roundID string, state *RoundState) error

type RoundState

type RoundState struct {
	RoundID   string
	ModelRef  string
	KOfN      int
	TimeoutS  int
	StartTime time.Time
	Updates   []Update
	Completed bool
}

type Task

type Task struct {
	RoundID     string         `json:"round_id"`
	ModelRef    string         `json:"model_ref"`
	Config      map[string]any `json:"config"`
	Hyperparams map[string]any `json:"hyperparams,omitempty"`
}

type Update

type Update struct {
	RoundID      string         `json:"round_id"`
	PropletID    string         `json:"proplet_id"`
	BaseModelURI string         `json:"base_model_uri"`
	NumSamples   int            `json:"num_samples"`
	Metrics      map[string]any `json:"metrics"`
	Update       map[string]any `json:"update"`
	ReceivedAt   time.Time      `json:"received_at"`
}

type WasmAggregator

type WasmAggregator struct {
	// contains filtered or unexported fields
}

func NewWasmAggregator

func NewWasmAggregator(wasmPath, runtime string) (*WasmAggregator, error)

func (*WasmAggregator) Aggregate

func (w *WasmAggregator) Aggregate(updates []Update) (Model, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL