如何在Horovod的分布式训练中划分Cifar10数据集?

时间:2020-07-20 15:59:23

标签: keras tensorflow2.0 horovod

我尝试将cifar10数据集与Horovod一起使用,但不清楚如何在等级之间划分数据集(给出的示例来自MNIST,不起作用)。我在下面仅添加了一些重要的代码段。

QPersistentModelIndex

使用此代码,似乎每个等级都在训练总数为50K的图像,而不仅仅是其中的一部分。如果像MNIST示例中那样稍微改变QPersistentModelIndex并使用QModelIndex,它会训练12500个样本,但是在训练开始之前它会耗尽内存,并且还会发出警告,请不要使用{{1 }}。

    model = QStandardItemModel()
    filter = QSortFilterProxyModel()
    self.filter.setSourceModel(model)
    # Set the model/check function
    table_view = QTableView()        
    table_view.setModel(filter)

    # Delete Row using 
    index_list = []                                                          
    for model_index in table_view.selectionModel().selectedRows():       
        index = QPersistentModelIndex(model_index)         
        index_list.append(index)                                         

    if index_list:
       for index in index_list: 
           "The error is here, it only accepts `QModelIndex` and refuses `QPersistentModelIndex`"
           ix      = table_view.model().mapToSource(index.row())  
           # ix      = table_view.model().mapToSource(index)            
           item    = model.itemFromIndex(ix)

0 个答案:

没有答案