ValueError: The name "Sequential" is used 4 times in the model. All the layer names should be unique?
ValueError: The name "Sequential" is used 4 times in the model. All the layer names should be unique?
让我们考虑一下,我有四个模型,分别是M1(客户端1)、M2(客户端2)、M3(客户端3)和M4(客户端4)。每个模型都有相似的结构。
Model Structure
对每个客户端模型进行训练后。我将这些模型聚合在一起并创建了一个新模型,比方说 "EnsModel"。之后,我使用这个集成模型再次为每个客户端重新训练新数据。但是,当我再次尝试集成更新后的模型时,我遇到了这个问题
"ValueError: The name "Sequential"在模型中被使用了4次,所有的layer名称应该是唯一的?"
有人能帮帮我吗?我也有一个问题。有什么方法可以为每个客户端建模修改集成模型结构?
谢谢。
尝试命名每个模型,然后将它们合并为正下方。
M1.name = 'Client1'
M2.name = 'Client2'
M3.name = 'Client3'
M4.name = 'Client4'
commonInput = Input((x, x, y))
outM1 = M1(commonInput)
outM2 = M2(commonInput)
// outM3
// outM4 also like the first two
mergedM1M2 = keras.layers.Add()([outM1,outM2])
//mergedM3M4
FinalMerged = keras.layers.Add()([mergedM1M2,mergedM3M4])
FinalModel = Model(commonInput, Finalmerged)
让我们考虑一下,我有四个模型,分别是M1(客户端1)、M2(客户端2)、M3(客户端3)和M4(客户端4)。每个模型都有相似的结构。
Model Structure
对每个客户端模型进行训练后。我将这些模型聚合在一起并创建了一个新模型,比方说 "EnsModel"。之后,我使用这个集成模型再次为每个客户端重新训练新数据。但是,当我再次尝试集成更新后的模型时,我遇到了这个问题 "ValueError: The name "Sequential"在模型中被使用了4次,所有的layer名称应该是唯一的?"
有人能帮帮我吗?我也有一个问题。有什么方法可以为每个客户端建模修改集成模型结构?
谢谢。
尝试命名每个模型,然后将它们合并为正下方。
M1.name = 'Client1'
M2.name = 'Client2'
M3.name = 'Client3'
M4.name = 'Client4'
commonInput = Input((x, x, y))
outM1 = M1(commonInput)
outM2 = M2(commonInput)
// outM3
// outM4 also like the first two
mergedM1M2 = keras.layers.Add()([outM1,outM2])
//mergedM3M4
FinalMerged = keras.layers.Add()([mergedM1M2,mergedM3M4])
FinalModel = Model(commonInput, Finalmerged)