UNPKG

federer

Version:

Experiments in asynchronous federated learning and decentralized learning

36 lines 1.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.checkCoordinatorOptions = void 0; const assert = require("assert"); const cli_1 = require("../cli"); const delays_1 = require("./delays"); function checkCoordinatorOptions(options) { checkServerOptions(options.serverOptions); delays_1.checkClientDelayOptions(options.clientDelays, cli_1.CoordinatorCLIOptions.get("number-clients")); checkTrainOptions(options.trainOptions); } exports.checkCoordinatorOptions = checkCoordinatorOptions; function checkServerOptions(options) { switch (options.server) { case "FedAsync": assert(Number.isFinite(options.epochDelay)); assert(options.epochDelay > 0); // eslint-disable-next-line no-fallthrough case "BatchedFedAsync": assert(options.alpha > 0); assert(options.alpha < 1); break; case "FedAvg": case "LiFedAvg": assert(options.fractionOfClientsPerRound > 0); assert(options.fractionOfClientsPerRound <= 1); break; } } function checkTrainOptions(options) { assert(Number.isInteger(options.batchSize)); assert(options.batchSize > 0); assert(Number.isInteger(options.epochs)); assert(options.epochs > 0); } //# sourceMappingURL=coordinator.js.map