0

我正在尝试在 colaboratory 中运行下面的代码,但我看到了这个错误!

https://developers.sherpa.ai/privacy-technology/ 代码:

import numpy as np
import tensorflow as tf
import shfl

from shfl.federated_government import FederatedGovernment

### Load data to use in simulation
database = shfl.data_base.Emnist()
train_data, train_labels, test_data, test_label = database.load_data()

### Deploy data over data nodes
iid_dist = shfl.data_distribution.IidDataDistribution(database)
federated_data, test_data, test_labels = iid_dist.get_federated_data(num_nodes=20,
                                                                     percent=10)

'''### Create function that builds a model
def model_builder():
    model = tf.keras.models.Sequential()
    model.add(tf.keras.layers.Flatten(input_shape=(28,28)))
    model.add(tf.keras.layers.Dense(64, activation='relu'))
    model.add(tf.keras.layers.Dropout(0.1))
    model.add(tf.keras.layers.Dense(10, activation='softmax'))

    model.compile(optimizer="rmsprop",
                  loss="categorical_crossentropy",
                  metrics=["accuracy"])

    return shfl.model.DeepLearningModel(model)

### Choose aggregattor
aggregator = shfl.federated_aggregator.FedAvgAggregator()
fed_government = FederatedGovernment(model_builder, federated_data, aggregator)

### Run a few rounds of federated learning
fed_government.run_rounds(3, test_data, test_label)

'''

当我尝试安装 shfl 时,我看到此错误:错误:找不到满足 shfl 要求的版本(来自版本:无)错误:找不到 shfl 的匹配分发

4

0 回答 0