UNPKG

federer

Version:

Experiments in asynchronous federated learning and decentralized learning

32 lines 1.64 kB
/// <reference types="node" /> import * as http from "http"; import * as https from "https"; import * as io from "socket.io"; import { Logger } from "winston"; import { ClientToServerMessages, SemiSyncServerStartOptions, ServerToClientMessages, UploadMessage, Weights } from "../../common"; import { FLRoundState, FLServer } from "../FLServer"; interface RoundState extends FLRoundState { /** Weighted sum of the currently received model updates. */ weights: Weights; /** IDs of the nodes that we requested to start training. */ requested: Set<string>; /** IDs of the nodes that have replied to the training request. */ replied: Set<string>; } export declare abstract class SemiSyncFLServer<StartOptions extends SemiSyncServerStartOptions> extends FLServer<RoundState, StartOptions> { constructor(server: http.Server | https.Server, initialWeights: Weights, options: StartOptions, logger: Logger); /** Incorporates an upload message into the state. */ protected abstract updateRoundState(socket: io.Socket, message: UploadMessage): void; /** Returns the current global weights */ protected abstract getGlobalWeights(): Weights; protected abstract serverName: string; protected registerSocketListeners(socket: io.Socket<ClientToServerMessages, ServerToClientMessages>): void; protected getInitialRoundState(initialWeights: Weights): RoundState; private shouldStartLearning; private shouldEndRound; /** Ends the current round, and moves on to the next one. */ protected endRound(): void; private sampleClients; } export {}; //# sourceMappingURL=SemiSyncFLServer.d.ts.map