【问题标题】:CNTK Output command does not produce an output fileCNTK 输出命令不生成输出文件
【发布时间】:2017-04-08 05:06:20
【问题描述】:

我是 CNTK 的新手。按照本教程,我使用 BrainScript 创建了第一个示例 Logistic 回归。运行脚本很顺利。但是我找不到 output.txt 文件,该文件应该是 BrainScript 配置中的输出命令的结果。有人可以帮忙吗?

有BrainScript配置:

# CNTK Machine Learning Configuration
# commands to run
command=Train:Output
modelPath = "model.dnn"
deviceId = -1
dimension = 2
labelDimension = 2
# Train command
Train = {
    action="train"

    # configuration of data reading
    reader = {
        readerType = "CNTKTextFormatReader"
        file = "C:\Newtera\ECM\Src\MLStudio\Data\Train_cntk_text.txt"
        input = [
            features = [
                dim = $dimension$
                format = "dense"
            ]
            labels = [
                dim = 1
                format = "dense"
            ]
        ]
    }

    # network description
    BrainScriptNetworkBuilder = {
        # sample and label dimensions
        SDim = $dimension$
        LDim = 1
        features = Input(SDim)
        labels = Input(LDim)
        # parameters to learn
        b = Parameter(LDim, 1)     # bias
        w = Parameter(LDim, SDim)  # weights
        # operations
        p = Sigmoid(w * features + b)
        lr = Logistic(labels, p)
        err = SquareError(labels, p)
        # root nodes
        featureNodes = (features)
        labelNodes = (labels)
        criterionNodes = (lr)
        evaluationNodes = (err)
        outputNodes = (p)
    }

    # configuration parameters of the SGD procedure
    SGD = {
        epochSize = 0                 # =0 means size of the training set
        minibatchSize = 25
        learningRatesPerSample = 0.04  # gradient contribution from each sample
        maxEpochs = 50
    }

}

# Output command
Output = {
   action="write"
   # configuration of data reading
   reader = {
       readerType = "CNTKTextFormatReader"
       file = "C:\Newtera\ECM\Src\MLStudio\Data\Test_cntk_text.txt"
       input = [
           features = [
               dim = $dimension$
               format = "dense"
          ]
          labels = [
              dim = 1
              format = "dense"
          ]
       ]
   }

   outputPath = "output.txt"
   outputNodeNames = p
}

部分 CNTK 输出到控制台:

Finished Epoch[29 of 50]: [Training] lr = 0.04359039 * 1000; err = 0.01143183 * 1000; totalSamplesSeen = 29000; learningRatePerSample = 0.039999999; epochTime=0.0379145s
Finished Epoch[30 of 50]: [Training] lr = 0.04405872 * 1000; err = 0.01164983 * 1000; totalSamplesSeen = 30000; learningRatePerSample = 0.039999999; epochTime=0.0322998s
Finished Epoch[31 of 50]: [Training] lr = 0.04420973 * 1000; err = 0.01164209 * 1000; totalSamplesSeen = 31000; learningRatePerSample = 0.039999999; epochTime=0.0402s
Finished Epoch[32 of 50]: [Training] lr = 0.04337909 * 1000; err = 0.01130067 * 1000; totalSamplesSeen = 32000; learningRatePerSample = 0.039999999; epochTime=0.0333882s
Finished Epoch[33 of 50]: [Training] lr = 0.04398178 * 1000; err = 0.01223733 * 1000; totalSamplesSeen = 33000; learningRatePerSample = 0.039999999; epochTime=0.0344874s
Finished Epoch[34 of 50]: [Training] lr = 0.04342690 * 1000; err = 0.01140238 * 1000; totalSamplesSeen = 34000; learningRatePerSample = 0.039999999; epochTime=0.0332142s
Finished Epoch[35 of 50]: [Training] lr = 0.04300383 * 1000; err = 0.01094254 * 1000; totalSamplesSeen = 35000; learningRatePerSample = 0.039999999; epochTime=0.042097s
Finished Epoch[36 of 50]: [Training] lr = 0.04331203 * 1000; err = 0.01136943 * 1000; totalSamplesSeen = 36000; learningRatePerSample = 0.039999999; epochTime=0.0321645s
Finished Epoch[37 of 50]: [Training] lr = 0.04345496 * 1000; err = 0.01147922 * 1000; totalSamplesSeen = 37000; learningRatePerSample = 0.039999999; epochTime=0.0332394s
Finished Epoch[38 of 50]: [Training] lr = 0.04424128 * 1000; err = 0.01172341 * 1000; totalSamplesSeen = 38000; learningRatePerSample = 0.039999999; epochTime=0.0327771s
Finished Epoch[39 of 50]: [Training] lr = 0.04669956 * 1000; err = 0.01262951 * 1000; totalSamplesSeen = 39000; learningRatePerSample = 0.039999999; epochTime=0.0397526s
Finished Epoch[40 of 50]: [Training] lr = 0.04297209 * 1000; err = 0.01148758 * 1000; totalSamplesSeen = 40000; learningRatePerSample = 0.039999999; epochTime=0.0333094s
Finished Epoch[41 of 50]: [Training] lr = 0.04553096 * 1000; err = 0.01266350 * 1000; totalSamplesSeen = 41000; learningRatePerSample = 0.039999999; epochTime=0.0336593s
Finished Epoch[42 of 50]: [Training] lr = 0.04287576 * 1000; err = 0.01152806 * 1000; totalSamplesSeen = 42000; learningRatePerSample = 0.039999999; epochTime=0.0344351s
Finished Epoch[43 of 50]: [Training] lr = 0.04388394 * 1000; err = 0.01206369 * 1000; totalSamplesSeen = 43000; learningRatePerSample = 0.039999999; epochTime=0.0342201s
Finished Epoch[44 of 50]: [Training] lr = 0.04223350 * 1000; err = 0.01105061 * 1000; totalSamplesSeen = 44000; learningRatePerSample = 0.039999999; epochTime=0.0337745s
Finished Epoch[45 of 50]: [Training] lr = 0.04207988 * 1000; err = 0.01140505 * 1000; totalSamplesSeen = 45000; learningRatePerSample = 0.039999999; epochTime=0.0338235s
Finished Epoch[46 of 50]: [Training] lr = 0.04261599 * 1000; err = 0.01158317 * 1000; totalSamplesSeen = 46000; learningRatePerSample = 0.039999999; epochTime=0.0400027s
Finished Epoch[47 of 50]: [Training] lr = 0.04326449 * 1000; err = 0.01164270 * 1000; totalSamplesSeen = 47000; learningRatePerSample = 0.039999999; epochTime=0.0339331s
Finished Epoch[48 of 50]: [Training] lr = 0.04225180 * 1000; err = 0.01148765 * 1000; totalSamplesSeen = 48000; learningRatePerSample = 0.039999999; epochTime=0.0399052s
Finished Epoch[49 of 50]: [Training] lr = 0.04173198 * 1000; err = 0.01124937 * 1000; totalSamplesSeen = 49000; learningRatePerSample = 0.039999999; epochTime=0.0338758s
Finished Epoch[50 of 50]: [Training] lr = 0.04399340 * 1000; err = 0.01202173 * 1000; totalSamplesSeen = 50000; learningRatePerSample = 0.039999999; epochTime=0.0330397s

COMPLETED.

【问题讨论】:

    标签: cntk


    【解决方案1】:

    outputpath 元素不是输出文件将被写入的路径,而只是它的前缀。后缀将根据您希望输出的网络节点的名称创建。所以,如果你输出节点p,你会期望文件output.txt.p中的结果

    但是,目前,您没有指定要输出哪个节点。您可以通过将outputNodeNames=p 添加到您的配置来做到这一点。

    【讨论】:

    • 感谢您的帮助。我在配置的输出命令中添加了“outputNodeNames=p”。它仍然不会产生 output.txt.p 文件。我错过了什么吗?
    • 您能将 CNTK 输出到控制台的最后 20 行代码发布到控制台吗?
    • CNTK 输出到控制台已发布。我正在使用 CNTK 2.0rc1。
    • 我的错误。我将“command=Train”作为cntk.exe 的参数。所以它忽略了配置文件中的输出命令。现在可以了。谢谢,安东。
    猜你喜欢
    • 2013-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-09-23
    • 1970-01-01
    • 1970-01-01
    • 2022-01-16
    • 1970-01-01
    相关资源
    最近更新 更多