示例#1
0
with utils_impl.record_new_flags():
    # Training hyperparameters
    flags.DEFINE_integer('clients_per_round', 2,
                         'How many clients to sample per round.')
    flags.DEFINE_integer('client_epochs_per_round', 1,
                         'Number of epochs in the client to take per round.')
    flags.DEFINE_integer('client_batch_size', 20,
                         'Batch size used on the client.')
    flags.DEFINE_boolean(
        'only_digits', True, 'Whether to use the digit-only '
        'EMNIST dataset (10 characters) or the extended EMNIST '
        'dataset (62 characters).')

    # Optimizer configuration (this defines one or more flags per optimizer).
    utils_impl.define_optimizer_flags('server')
    utils_impl.define_optimizer_flags('client')

    # Compression hyperparameters.
    flags.DEFINE_boolean('use_compression', True,
                         'Whether to use compression code path.')
    flags.DEFINE_integer(
        'broadcast_quantization_bits', 8,
        'Number of quantization bits for server to client '
        'compression.')
    flags.DEFINE_integer(
        'aggregation_quantization_bits', 8,
        'Number of quantization bits for client to server '
        'compression.')
    flags.DEFINE_boolean(
        'use_sparsity_in_aggregation', True,
def setUpModule():
    # Create flags here to ensure duplicate flags are not created.
    utils_impl.define_optimizer_flags(TEST_SERVER_FLAG_PREFIX)
    utils_impl.define_optimizer_flags(TEST_CLIENT_FLAG_PREFIX)