federer
Version:
Experiments in asynchronous federated learning and decentralized learning
95 lines • 3.99 kB
TypeScript
import { ClientTrainingOptions, FedAsyncStalenessOptions, InstrumentationOptions } from "../../common";
import { OptimizerOptions } from "./optimizer";
import { CoordinatorClientDelayOptions } from "./delays";
import { CoordinatorLoggingOptions } from "./logging";
/**
* Options given to the coordinator.
*
* Note that some of the {@link ClientStartOptions} and
* {@link ServerStartOptions} are duplicated here, but not all of them. This is
* because the interface to configure the coordinator is slightly different from
* the interfaces to configure the nodes. This interface is designed to only
* hold the options that we might experiment with, and not those that are
* internal implementation details.
*
* It is the role of the coordinator to create {@link ClientStartOptions} and
* {@link ServerStartOptions} based on these options.
*/
export interface CoordinatorOptions {
/** Options for configuring the server. */
serverOptions: CoordinatorServerOptions;
model: {
/** Options for configuring the optimizer used by the clients. */
optimizer: OptimizerOptions;
};
/** Configuration of client delays. Defaults to no delays. */
clientDelays?: CoordinatorClientDelayOptions;
/** Options for configuring the client training process. */
trainOptions: ClientTrainingOptions;
/**
* Optional logging options that will be applied to all nodes, including the
* coordinator.
*
* - If this is not set, all nodes will use the defaults.
* - If a {@link CommonLoggerOptions} object is given, all nodes will use
* those options.
* - If a {@link IndividualLoggerOptions} object is given, different options
* will be applied to each different type of node.
*
* @see {@link LoggerOptions} for default values.
*/
logging?: CoordinatorLoggingOptions;
/** TensorFlow verbosity on coordinator and clients. Defaults to 0. */
tensorflowVerbosity?: 0 | 1 | 2;
/**
* Options for enabling instrumentation of various metrics. All options
* default to false.
*/
instrument?: Partial<InstrumentationOptions>;
/** A few optional options that activate debugging logs. */
debug?: {
/** Whether to print a table of data distribution. Defaults to false. */
printDataDistribution?: boolean;
};
}
export declare type CoordinatorServerOptions = CoordinatorFedAvgOptions | CoordinatorLiFedAvgOptions | CoordinatorFedAsyncOptions | CoordinatorBatchedFedAsyncOptions | CoordinatorFedSemiSyncOptions | CoordinatorFedCRDTOptions;
interface CoordinatorServerOptionsBase {
}
interface CoordinatorSyncServerOptionsBase extends CoordinatorServerOptionsBase {
fractionOfClientsPerRound: number;
}
export interface CoordinatorFedAvgOptions extends CoordinatorSyncServerOptionsBase {
server: "FedAvg";
}
export interface CoordinatorLiFedAvgOptions extends CoordinatorSyncServerOptionsBase {
server: "LiFedAvg";
}
interface CoordinatorAsyncServerOptionsBase extends CoordinatorServerOptionsBase {
alpha: number;
staleness: FedAsyncStalenessOptions;
}
export interface CoordinatorFedAsyncOptions extends CoordinatorAsyncServerOptionsBase {
server: "FedAsync";
epochDelay: number;
}
interface CoordinatorSemiSyncServerOptionsBase extends CoordinatorServerOptionsBase {
numberClientsPerRound: number;
roundEndFraction: number;
}
export interface CoordinatorBatchedFedAsyncOptions extends CoordinatorSemiSyncServerOptionsBase {
server: "BatchedFedAsync";
alpha: number;
}
export interface CoordinatorFedSemiSyncOptions extends CoordinatorSemiSyncServerOptionsBase {
server: "FedSemiSync";
a: number;
alpha: number;
}
export interface CoordinatorFedCRDTOptions extends CoordinatorSemiSyncServerOptionsBase {
server: "FedCRDT";
a: number;
alpha: number;
}
export declare function checkCoordinatorOptions(options: CoordinatorOptions): void;
export {};
//# sourceMappingURL=coordinator.d.ts.map