Integrate zhouwang/pr899 into master
This commit is contained in:
Коммит
12b1c23fd0
28
CNTK.sln
28
CNTK.sln
|
@ -1285,6 +1285,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "V2LibraryDistributionTests"
|
|||
{E5606ECE-48CA-4464-BB12-09D81D02B9EF} = {E5606ECE-48CA-4464-BB12-09D81D02B9EF}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CPPEvalExtendedClientTest", "Tests\EndToEndTests\EvalClientTests\CPPEvalExtendedClientTest\CPPEvalExtendedClientTest.vcxproj", "{5D29C76D-648A-456F-920D-48230F2FB3C8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug_CpuOnly|Any CPU = Debug_CpuOnly|Any CPU
|
||||
|
@ -2240,6 +2242,31 @@ Global
|
|||
{F4CCAAB2-0DB2-4281-929A-2E68E30F0F6E}.Release|Mixed Platforms.Build.0 = Release|x64
|
||||
{F4CCAAB2-0DB2-4281-929A-2E68E30F0F6E}.Release|x64.ActiveCfg = Release|x64
|
||||
{F4CCAAB2-0DB2-4281-929A-2E68E30F0F6E}.Release|x64.Build.0 = Release|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Debug_CpuOnly|Any CPU.ActiveCfg = Debug_CpuOnly|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Debug_CpuOnly|Mixed Platforms.ActiveCfg = Debug_CpuOnly|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Debug_CpuOnly|Mixed Platforms.Build.0 = Debug_CpuOnly|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Debug_CpuOnly|x64.ActiveCfg = Debug_CpuOnly|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Debug_CpuOnly|x64.Build.0 = Debug_CpuOnly|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Debug|Mixed Platforms.Build.0 = Debug|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Debug|x64.Build.0 = Debug|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Release_CpuOnly|Any CPU.ActiveCfg = Release_CpuOnly|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Release_CpuOnly|Mixed Platforms.ActiveCfg = Release_CpuOnly|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Release_CpuOnly|Mixed Platforms.Build.0 = Release_CpuOnly|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Release_CpuOnly|x64.ActiveCfg = Release_CpuOnly|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Release_CpuOnly|x64.Build.0 = Release_CpuOnly|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Release_NoOpt|Any CPU.ActiveCfg = Release_CpuOnly|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Release_NoOpt|Mixed Platforms.ActiveCfg = Release_CpuOnly|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Release_NoOpt|Mixed Platforms.Build.0 = Release_CpuOnly|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Release_NoOpt|x64.ActiveCfg = Release_CpuOnly|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Release_NoOpt|x64.Build.0 = Release_CpuOnly|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Release|Mixed Platforms.Build.0 = Release|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Release|x64.ActiveCfg = Release|x64
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -2417,5 +2444,6 @@ Global
|
|||
{E844AB9A-A48F-4A99-9625-F528C5C46D83} = {8656B71D-E24C-4AC2-8BE4-C07B415A3E15}
|
||||
{CD721536-CFD3-413E-A3D7-FB0FAF989635} = {DD043083-71A4-409A-AA91-F9C548DCF7EC}
|
||||
{F4CCAAB2-0DB2-4281-929A-2E68E30F0F6E} = {6F19321A-65E7-4829-B00C-3886CD6C6EDE}
|
||||
{5D29C76D-648A-456F-920D-48230F2FB3C8} = {05E45AF7-C069-4057-BC16-0A532D068CE4}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -0,0 +1,326 @@
|
|||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
|
||||
//
|
||||
// CPPEvalExtendedClient.cpp : Sample application using the extended evaluation interface from C++
|
||||
//
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <inttypes.h>
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "Eval.h"
|
||||
#ifdef _WIN32
|
||||
#include "Windows.h"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace Microsoft::MSR::CNTK;
|
||||
|
||||
// Used for retrieving the model appropriate for the element type (float / double)
|
||||
template<typename ElemType>
|
||||
using GetEvalProc = void(*)(IEvaluateModelExtended<ElemType>**);
|
||||
|
||||
std::unordered_map<std::string, size_t> buildVocab(std::string filePath)
|
||||
{
|
||||
std::ifstream ifs(filePath);
|
||||
size_t idx = 0;
|
||||
|
||||
std::unordered_map<std::string, size_t> vocab;
|
||||
std::string line;
|
||||
while (std::getline(ifs, line))
|
||||
{
|
||||
vocab.insert(std::pair<std::string, size_t>(line, idx));
|
||||
idx += 1;
|
||||
}
|
||||
|
||||
ifs.close();
|
||||
return vocab;
|
||||
}
|
||||
|
||||
std::unordered_map<size_t, std::string> buildInvVocab(std::string filePath)
|
||||
{
|
||||
std::ifstream ifs(filePath);
|
||||
size_t idx = 1;
|
||||
|
||||
std::unordered_map<size_t, std::string> vocab;
|
||||
std::string line;
|
||||
while (std::getline(ifs, line))
|
||||
{
|
||||
vocab.insert(std::pair<size_t, std::string>(idx, line));
|
||||
idx += 1;
|
||||
}
|
||||
|
||||
ifs.close();
|
||||
return vocab;
|
||||
}
|
||||
|
||||
size_t word2idx(std::string word, std::unordered_map<std::string, size_t>& word2idxVocab)
|
||||
{
|
||||
std::unordered_map<std::string, size_t>::iterator iter = word2idxVocab.find(word);
|
||||
if (iter == word2idxVocab.end())
|
||||
{
|
||||
throw std::runtime_error("word not found in source vocab");
|
||||
}
|
||||
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
|
||||
std::string idx2word(size_t idx, std::unordered_map<size_t, std::string>& idx2wordVocab)
|
||||
{
|
||||
std::unordered_map<size_t, std::string>::iterator iter = idx2wordVocab.find(idx);
|
||||
if (iter == idx2wordVocab.end())
|
||||
{
|
||||
throw std::runtime_error("word index is not found in target vocab");
|
||||
}
|
||||
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
void addOneHotWord(Values<float>& inputBuffers, size_t idx, VariableSchema& inputLayouts, size_t inputNode)
|
||||
{
|
||||
size_t inputDim = inputLayouts[inputNode].m_numElements;
|
||||
for (size_t i = 0; i < inputDim; i++)
|
||||
{
|
||||
if (i == idx)
|
||||
{
|
||||
inputBuffers[inputNode].m_buffer.push_back(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
inputBuffers[inputNode].m_buffer.push_back(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> feedInputVectors(std::string sentence, std::unordered_map<std::string, size_t>& word2idxVocab, Values<float>& inputBuffers, VariableSchema& inputLayouts)
|
||||
{
|
||||
std::vector<std::string> words;
|
||||
|
||||
// Split input sentence by space.
|
||||
char delimiters = ' ';
|
||||
size_t begin = 0;
|
||||
size_t end = sentence.find_first_of(delimiters);
|
||||
while (end != sentence.npos)
|
||||
{
|
||||
words.push_back(sentence.substr(begin, end - begin));
|
||||
begin = end + 1;
|
||||
end = sentence.find(delimiters, begin);
|
||||
}
|
||||
|
||||
words.push_back(sentence.substr(begin));
|
||||
|
||||
// Convert words to ids.
|
||||
std::vector<size_t> wordIds;
|
||||
for (size_t i = 0; i < words.size(); i++)
|
||||
{
|
||||
size_t id = word2idx(words[i], word2idxVocab);
|
||||
wordIds.push_back(id);
|
||||
}
|
||||
|
||||
// Process the input words to construct network input vectors.
|
||||
// As the sentence begins and ends with special tag, we will ignore the first and last word.
|
||||
for (size_t i = 1; i < words.size() - 1; i++)
|
||||
{
|
||||
// Current word.
|
||||
size_t cwIdx = wordIds[i];
|
||||
addOneHotWord(inputBuffers, cwIdx, inputLayouts, 0);
|
||||
|
||||
// Next word.
|
||||
size_t nwIdx = wordIds[i + 1];
|
||||
addOneHotWord(inputBuffers, nwIdx, inputLayouts, 1);
|
||||
|
||||
// Previous word.
|
||||
size_t pwIdx = wordIds[i - 1];
|
||||
addOneHotWord(inputBuffers, pwIdx, inputLayouts, 2);
|
||||
}
|
||||
|
||||
return words;
|
||||
}
|
||||
|
||||
IEvaluateModelExtended<float>* SetupNetworkAndGetLayouts(std::string modelDefinition, VariableSchema& inputLayouts, VariableSchema& outputLayouts)
|
||||
{
|
||||
// Native model evaluation instance
|
||||
IEvaluateModelExtended<float> *eval;
|
||||
|
||||
GetEvalExtendedF(&eval);
|
||||
|
||||
try
|
||||
{
|
||||
eval->CreateNetwork(modelDefinition);
|
||||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
fprintf(stderr, "%s\n", ex.what());
|
||||
throw;
|
||||
}
|
||||
fflush(stderr);
|
||||
|
||||
// Get the model's layers dimensions
|
||||
outputLayouts = eval->GetOutputSchema();
|
||||
|
||||
for (auto vl : outputLayouts)
|
||||
{
|
||||
fprintf(stderr, "Output dimension: %" PRIu64 "\n", vl.m_numElements);
|
||||
fprintf(stderr, "Output name: %ls\n", vl.m_name.c_str());
|
||||
}
|
||||
|
||||
eval->StartForwardEvaluation({ outputLayouts[0].m_name });
|
||||
inputLayouts = eval->GetInputSchema();
|
||||
outputLayouts = eval->GetOutputSchema();
|
||||
|
||||
return eval;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Program for demonstrating how to run model evaluations using the native extended evaluation interface, also show
|
||||
/// how to input sequence vectors to LSTM(RNN) network.
|
||||
/// </summary>
|
||||
/// <description>
|
||||
/// This program is a native C++ client using the native extended evaluation interface
|
||||
/// located in the <see cref="eval.h"/> file.
|
||||
/// The CNTK evaluation library (EvalDLL.dll on Windows, and LibEval.so on Linux), must be found through the system's path.
|
||||
/// The other requirement is that Eval.h be included
|
||||
/// In order to run this program the model must already exist in the example. To create the model,
|
||||
/// first run the example in <CNTK>/Examples/Text/ATIS. Once the model file ATIS.slot.lstm is created,
|
||||
/// you can run this client.
|
||||
/// This program demonstrates the usage of the Evaluate method requiring the input and output layers as parameters.
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// Get the binary path (current working directory)
|
||||
argc = 0;
|
||||
std::string app = argv[0];
|
||||
std::string path;
|
||||
size_t pos;
|
||||
int ret;
|
||||
|
||||
#ifdef _WIN32
|
||||
pos = app.rfind("\\");
|
||||
path = (pos == std::string::npos) ? "." : app.substr(0, pos);
|
||||
|
||||
// This relative path assumes launching from CNTK's binary folder, e.g. x64\Release
|
||||
const std::string modelBaseDir = path + "/../../Examples/Text/ATIS/";
|
||||
|
||||
#else // on Linux
|
||||
pos = app.rfind("/");
|
||||
path = (pos == std::string::npos) ? "." : app.substr(0, pos);
|
||||
|
||||
// This relative path assumes launching from CNTK's binary folder, e.g. build/cpu/release/bin/
|
||||
const std::string modelBaseDir = path + "/../../../../Examples/Text/ATIS/";
|
||||
#endif
|
||||
const std::string modelWorkingDirectory = modelBaseDir + "work/";
|
||||
|
||||
const std::string modelFilePath = modelWorkingDirectory + "ATIS.slot.lstm";
|
||||
|
||||
try
|
||||
{
|
||||
struct stat statBuf;
|
||||
if (stat(modelFilePath.c_str(), &statBuf) != 0)
|
||||
{
|
||||
fprintf(stderr, "Error: The model %s does not exist. Please follow instructions in README.md in <CNTK>/Examples/Text/ATIS to create the model.\n", modelFilePath.c_str());
|
||||
return(1);
|
||||
}
|
||||
|
||||
std::string networkConfiguration;
|
||||
networkConfiguration += "modelPath=\"" + modelFilePath + "\"";
|
||||
|
||||
VariableSchema inputLayouts;
|
||||
VariableSchema outputLayouts;
|
||||
IEvaluateModelExtended<float> *eval;
|
||||
eval = SetupNetworkAndGetLayouts(networkConfiguration, inputLayouts, outputLayouts);
|
||||
|
||||
vector<size_t> inputBufferSize;
|
||||
for (size_t i = 0; i < inputLayouts.size(); i++)
|
||||
{
|
||||
fprintf(stdout, "Input node name: %ls\n", inputLayouts[i].m_name.c_str());
|
||||
fprintf(stdout, "Input feature dimension: %" PRIu64 "\n", inputLayouts[i].m_numElements);
|
||||
inputBufferSize.push_back(inputLayouts[i].m_numElements);
|
||||
}
|
||||
|
||||
vector<size_t> outputBufferSize;
|
||||
for (size_t i = 0; i < outputLayouts.size(); i++)
|
||||
{
|
||||
outputBufferSize.push_back(outputLayouts[i].m_numElements);
|
||||
}
|
||||
|
||||
// Build source word vocab to id
|
||||
const::string sourceVocab = modelBaseDir + "/Data/ATIS.vocab";
|
||||
if (stat(sourceVocab.c_str(), &statBuf) != 0)
|
||||
{
|
||||
fprintf(stderr, "Error: The file '%s' does not exist.\n", sourceVocab.c_str());
|
||||
return(1);
|
||||
}
|
||||
std::unordered_map<std::string, size_t> word2idxVocab = buildVocab(sourceVocab);
|
||||
|
||||
// Build id to target word vocab
|
||||
const::string targetVocab = modelBaseDir + "/Data/ATIS.label";
|
||||
if (stat(targetVocab.c_str(), &statBuf) != 0)
|
||||
{
|
||||
fprintf(stderr, "Error: The file '%s' does not exist.\n", targetVocab.c_str());
|
||||
return(1);
|
||||
}
|
||||
std::unordered_map<size_t, std::string> idx2wordVocab = buildInvVocab(targetVocab);
|
||||
|
||||
// Use the following sentence as input example.
|
||||
// One single space is used as word sperator.
|
||||
std::string inputSequences = "BOS i would like to find a flight from charlotte to las vegas that makes a stop in st. louis EOS";
|
||||
|
||||
Values<float> inputBuffers = inputLayouts.CreateBuffers<float>(inputBufferSize);
|
||||
Values<float> outputBuffers = outputLayouts.CreateBuffers<float>(outputBufferSize);
|
||||
|
||||
// Feed input sequence vectors to network
|
||||
std::vector<std::string> words = feedInputVectors(inputSequences, word2idxVocab, inputBuffers, inputLayouts);
|
||||
|
||||
// Forward propagation
|
||||
eval->ForwardPass(inputBuffers, outputBuffers);
|
||||
|
||||
// Get output from output layer
|
||||
auto buf = outputBuffers[0].m_buffer;
|
||||
size_t bufSize = outputBuffers[0].m_buffer.size();
|
||||
|
||||
std::vector<std::string> outputs;
|
||||
size_t outputDim = outputLayouts[0].m_numElements;
|
||||
size_t outputStep = bufSize / outputDim;
|
||||
|
||||
auto iter = buf.begin();
|
||||
for (size_t i = 0; i < outputStep; i++)
|
||||
{
|
||||
auto max_iter = std::max_element(iter, iter + outputDim);
|
||||
auto index = max_iter - iter;
|
||||
outputs.push_back(idx2word(index, idx2wordVocab));
|
||||
iter += outputDim;
|
||||
}
|
||||
|
||||
words.erase(words.begin());
|
||||
words.pop_back();
|
||||
fprintf(stdout, "Slot tag for sentence \"%s\" is as follows:\n", inputSequences.c_str());
|
||||
for (size_t i = 0; i < outputs.size(); i++)
|
||||
{
|
||||
fprintf(stdout, "%10s -- %s\n", words[i].c_str(), outputs[i].c_str());
|
||||
}
|
||||
|
||||
eval->Destroy();
|
||||
|
||||
// This pattern is used by End2EndTests to check whether the program runs to complete.
|
||||
fprintf(stdout, "Evaluation complete.\n");
|
||||
ret = 0;
|
||||
}
|
||||
catch (const std::exception& err)
|
||||
{
|
||||
fprintf(stderr, "Evaluation failed. EXCEPTION occurred: %s\n", err.what());
|
||||
ret = 1;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
fprintf(stderr, "Evaluation failed. Unknown ERROR occurred.\n");
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
return ret;
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{93ECB70B-FDDD-44B4-BD6A-D63E094C704B}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>CPPEvalExtendedClient</RootNamespace>
|
||||
<ProjectName>CPPEvalExtendedClient</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)..\..\$(Platform)\$(ProjectName).$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\..\Include</AdditionalIncludeDirectories>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\..\..\cntk</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>EvalDll.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<Profile>true</Profile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CPPEvalExtendedClient.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CPPEvalExtendedClient.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSEvalClient", "CSEvalClien
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CPPEvalV2Client", "CPPEvalV2Client\CPPEvalV2Client.vcxproj", "{D771A06D-CC25-4582-B5CD-D2A4782BB005}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CPPEvalExtendedClient", "CPPEvalExtendedClient\CPPEvalExtendedClient.vcxproj", "{93ECB70B-FDDD-44B4-BD6A-D63E094C704B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
|
@ -25,6 +27,9 @@ Global
|
|||
{D771A06D-CC25-4582-B5CD-D2A4782BB005}.Debug|x64.ActiveCfg = Release|x64
|
||||
{D771A06D-CC25-4582-B5CD-D2A4782BB005}.Release|x64.ActiveCfg = Release|x64
|
||||
{D771A06D-CC25-4582-B5CD-D2A4782BB005}.Release|x64.Build.0 = Release|x64
|
||||
{93ECB70B-FDDD-44B4-BD6A-D63E094C704B}.Debug|x64.ActiveCfg = Release|x64
|
||||
{93ECB70B-FDDD-44B4-BD6A-D63E094C704B}.Release|x64.ActiveCfg = Release|x64
|
||||
{93ECB70B-FDDD-44B4-BD6A-D63E094C704B}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
EvalClients
|
||||
#EvalClients
|
||||
|
||||
The folder contains some examples using the CNTK evaluation library. Please note that only the 64-bit target is supported by CNTK evaluation library.
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# An LSTM model is built to tag each word in sentences with its semantic label.
|
||||
|
||||
WorkDir = work
|
||||
DataDir = data
|
||||
DataDir = Data
|
||||
|
||||
makeMode = false
|
||||
modelPath = $WorkDir$/ATIS.slot.lstm
|
||||
|
@ -96,9 +96,11 @@ Train = [
|
|||
parallelizationMethod = "DataParallelSGD"
|
||||
parallelizationStartEpoch = 2
|
||||
distributedMBReading = true
|
||||
dataParallelSGD = [
|
||||
gradientBits = 1
|
||||
]
|
||||
# Comment out the following lines if you want to enable parallelTrain to use 1-bit-SGD.
|
||||
# For that you also need CNTK binaries built with 1-bit-SGD enabled.
|
||||
# dataParallelSGD = [
|
||||
# gradientBits = 1
|
||||
# ]
|
||||
]
|
||||
]
|
||||
|
||||
|
|
31
Makefile
31
Makefile
|
@ -543,24 +543,39 @@ $(EVAL_LIB): $(EVAL_OBJ) | $(CNTKMATH_LIB)
|
|||
$(CXX) $(LDFLAGS) -shared $(patsubst %,-L%, $(LIBDIR) $(LIBPATH) $(GDK_NVML_LIB_PATH)) $(patsubst %,$(RPATH)%, $(ORIGINDIR) $(LIBPATH)) -o $@ $^ $(LIBS) -l$(CNTKMATH) $(PROTOBUF_PATH)/lib/libprotobuf.a
|
||||
|
||||
########################################
|
||||
# Eval Sample client
|
||||
# Eval Sample clients
|
||||
########################################
|
||||
EVAL_SAMPLE_CLIENT:=$(BINDIR)/cppevalclient
|
||||
EVAL_CLIENT:=$(BINDIR)/cppevalclient
|
||||
|
||||
EVAL_SAMPLE_CLIENT_SRC=\
|
||||
EVAL_CLIENT_SRC=\
|
||||
$(SOURCEDIR)/../Examples/Evaluation/CPPEvalClient/CPPEvalClient.cpp
|
||||
|
||||
EVAL_SAMPLE_CLIENT_OBJ:=$(patsubst %.cpp, $(OBJDIR)/%.o, $(EVAL_SAMPLE_CLIENT_SRC))
|
||||
EVAL_CLIENT_OBJ:=$(patsubst %.cpp, $(OBJDIR)/%.o, $(EVAL_CLIENT_SRC))
|
||||
|
||||
ALL+=$(EVAL_SAMPLE_CLIENT)
|
||||
SRC+=$(EVAL_SAMPLE_CLIENT_SRC)
|
||||
ALL+=$(EVAL_CLIENT)
|
||||
SRC+=$(EVAL_CLIENT_SRC)
|
||||
|
||||
$(EVAL_SAMPLE_CLIENT): $(EVAL_SAMPLE_CLIENT_OBJ) | $(EVAL_LIB)
|
||||
$(EVAL_CLIENT): $(EVAL_CLIENT_OBJ) | $(EVAL_LIB)
|
||||
@echo $(SEPARATOR)
|
||||
@mkdir -p $(dir $@)
|
||||
@echo building $(EVAL_SAMPLE_CLIENT) for $(ARCH) with build type $(BUILDTYPE)
|
||||
@echo building $(EVAL_CLIENT) for $(ARCH) with build type $(BUILDTYPE)
|
||||
$(CXX) $(LDFLAGS) $(patsubst %,-L%, $(LIBDIR) $(LIBPATH) $(GDK_NVML_LIB_PATH)) $(patsubst %,$(RPATH)%, $(ORIGINLIBDIR) $(LIBPATH)) -o $@ $^ $(LIBS) -l$(EVAL) -l$(CNTKMATH)
|
||||
|
||||
EVAL_EXTENDED_CLIENT:=$(BINDIR)/cppevalextendedclient
|
||||
|
||||
EVAL_EXTENDED_CLIENT_SRC=\
|
||||
$(SOURCEDIR)/../Examples/Evaluation/CPPEvalExtendedClient/CPPEvalExtendedClient.cpp
|
||||
|
||||
EVAL_EXTENDED_CLIENT_OBJ:=$(patsubst %.cpp, $(OBJDIR)/%.o, $(EVAL_EXTENDED_CLIENT_SRC))
|
||||
|
||||
ALL+=$(EVAL_EXTENDED_CLIENT)
|
||||
SRC+=$(EVAL_EXTENDED_CLIENT_SRC)
|
||||
|
||||
$(EVAL_EXTENDED_CLIENT): $(EVAL_EXTENDED_CLIENT_OBJ) | $(EVAL_LIB)
|
||||
@echo $(SEPARATOR)
|
||||
@mkdir -p $(dir $@)
|
||||
@echo building $(EVAL_EXTENDED_CLIENT) for $(ARCH) with build type $(BUILDTYPE)
|
||||
$(CXX) $(LDFLAGS) $(patsubst %,-L%, $(LIBDIR) $(LIBPATH) $(GDK_NVML_LIB_PATH)) $(patsubst %,$(RPATH)%, $(ORIGINLIBDIR) $(LIBPATH)) -o $@ $^ $(LIBS) -l$(EVAL) -l$(CNTKMATH)
|
||||
|
||||
########################################
|
||||
# Eval V2 Sample client
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug_CpuOnly|x64">
|
||||
<Configuration>Debug_CpuOnly</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release_CpuOnly|x64">
|
||||
<Configuration>Release_CpuOnly</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{5D29C76D-648A-456F-920D-48230F2FB3C8}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>CPPEvalExtendedClientTest</RootNamespace>
|
||||
<ProjectName>CPPEvalExtendedClientTest</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(SolutionDir)\CNTK.Cpp.props" />
|
||||
<PropertyGroup Condition="$(DebugBuild)" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseIntelMKL>No</UseIntelMKL>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(ReleaseBuild)" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseIntelMKL>No</UseIntelMKL>
|
||||
<UseIntelIPP>false</UseIntelIPP>
|
||||
</PropertyGroup>
|
||||
<!--Importing CPP defaults must occur after declaring the desired toolset above
|
||||
Otherwise, the build may default back to an previous toolset -->
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings" />
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup>
|
||||
<!-- TODO intentional for all? -->
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>CPPEvalExtendedClientTest</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Source\Common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;UNICODE;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>EvalDLL.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<Profile>true</Profile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="$(DebugBuild)">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link />
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="$(ReleaseBuild)">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<FloatingPointExceptions>false</FloatingPointExceptions>
|
||||
<AdditionalOptions>/d2Zi+ %(AdditionalOptions)</AdditionalOptions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\Examples\Evaluation\CPPEvalExtendedClient\CPPEvalExtendedClient.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
</Project>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CPPEvalExtendedClient.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,2 @@
|
|||
This folder contains the VC++ project file for building CPPEvalExtendedClientTest.exe.
|
||||
The C++ source code used by the project is in Examples\Evaluation\CPPEvalExtendedClient.
|
|
@ -0,0 +1,114 @@
|
|||
CPU info:
|
||||
CPU Model Name: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
|
||||
Hardware threads: 32
|
||||
Total Memory: 33468508 kB
|
||||
-------------------------------------------------------------------
|
||||
+ [[ -z E:\CNTKTestData ]]
|
||||
+ [[ ! -d E:\CNTKTestData ]]
|
||||
+ '[' Windows_NT == Windows_NT ']'
|
||||
++ cygpath -au 'E:\CNTKTestData'
|
||||
+ TestDataDir=/cygdrive/e/CNTKTestData
|
||||
+ ATISDir=/cygdrive/c/repos/cntk/Tests/EndToEndTests/../../Examples/Text/ATIS
|
||||
+ DataDir=/cygdrive/c/repos/cntk/Tests/EndToEndTests/../../Examples/Text/ATIS/Data
|
||||
+ OutputDir=/cygdrive/c/repos/cntk/Tests/EndToEndTests/../../Examples/Text/ATIS/Data
|
||||
+ ConfigDir=/cygdrive/c/repos/cntk/Tests/EndToEndTests/../../Examples/Text/ATIS
|
||||
+ DeleteModelsAfterTest=0
|
||||
+ '[' -f /cygdrive/c/repos/cntk/Tests/EndToEndTests/../../Examples/Text/ATIS/ATIS.cntk ']'
|
||||
+ cntkrun ATIS.cntk 'stderr=- command=Train Train=[SGD=[maxEpochs=1]]'
|
||||
+ configFileName=ATIS.cntk
|
||||
+ additionalCNTKArgs='stderr=- command=Train Train=[SGD=[maxEpochs=1]]'
|
||||
+ '[' Windows_NT == Windows_NT ']'
|
||||
++ cygpath -aw /cygdrive/c/repos/cntk/Tests/EndToEndTests/../../Examples/Text/ATIS
|
||||
+ ConfigDir='C:\repos\cntk\Examples\Text\ATIS'
|
||||
++ cygpath -aw /tmp/cntk-test-20161108174139.565799/EvalClientTests_CPPEvalExtendedClientTest@release_cpu
|
||||
+ RunDir='C:\cygwin64\tmp\cntk-test-20161108174139.565799\EvalClientTests_CPPEvalExtendedClientTest@release_cpu'
|
||||
++ cygpath -aw /cygdrive/c/repos/cntk/Tests/EndToEndTests/../../Examples/Text/ATIS/Data
|
||||
+ DataDir='C:\repos\cntk\Examples\Text\ATIS\Data'
|
||||
++ cygpath -aw /cygdrive/c/repos/cntk/Tests/EndToEndTests/../../Examples/Text/ATIS/Data
|
||||
+ OutputDir='C:\repos\cntk\Examples\Text\ATIS\Data'
|
||||
+ CNTKArgs='configFile=C:\repos\cntk\Examples\Text\ATIS/ATIS.cntk currentDirectory=C:\repos\cntk\Examples\Text\ATIS\Data RunDir=C:\cygwin64\tmp\cntk-test-20161108174139.565799\EvalClientTests_CPPEvalExtendedClientTest@release_cpu DataDir=C:\repos\cntk\Examples\Text\ATIS\Data ConfigDir=C:\repos\cntk\Examples\Text\ATIS OutputDir=C:\repos\cntk\Examples\Text\ATIS\Data DeviceId=-1 timestamping=true stderr=- command=Train Train=[SGD=[maxEpochs=1]]'
|
||||
+ '[' '' '!=' '' ']'
|
||||
+ modelsDir=/tmp/cntk-test-20161108174139.565799/EvalClientTests_CPPEvalExtendedClientTest@release_cpu/Models
|
||||
+ [[ 1 == 1 ]]
|
||||
+ '[' -d /tmp/cntk-test-20161108174139.565799/EvalClientTests_CPPEvalExtendedClientTest@release_cpu/Models ']'
|
||||
+ mkdir -p /tmp/cntk-test-20161108174139.565799/EvalClientTests_CPPEvalExtendedClientTest@release_cpu/Models
|
||||
+ [[ 0 == 0 ]]
|
||||
+ run /cygdrive/c/repos/cntk/x64/release_CpuOnly/cntk.exe 'configFile=C:\repos\cntk\Examples\Text\ATIS/ATIS.cntk' 'currentDirectory=C:\repos\cntk\Examples\Text\ATIS\Data' 'RunDir=C:\cygwin64\tmp\cntk-test-20161108174139.565799\EvalClientTests_CPPEvalExtendedClientTest@release_cpu' 'DataDir=C:\repos\cntk\Examples\Text\ATIS\Data' 'ConfigDir=C:\repos\cntk\Examples\Text\ATIS' 'OutputDir=C:\repos\cntk\Examples\Text\ATIS\Data' DeviceId=-1 timestamping=true stderr=- command=Train 'Train=[SGD=[maxEpochs=1]]'
|
||||
+ cmd=/cygdrive/c/repos/cntk/x64/release_CpuOnly/cntk.exe
|
||||
+ shift
|
||||
+ '[' '' == 1 ']'
|
||||
+ echo === Running /cygdrive/c/repos/cntk/x64/release_CpuOnly/cntk.exe 'configFile=C:\repos\cntk\Examples\Text\ATIS/ATIS.cntk' 'currentDirectory=C:\repos\cntk\Examples\Text\ATIS\Data' 'RunDir=C:\cygwin64\tmp\cntk-test-20161108174139.565799\EvalClientTests_CPPEvalExtendedClientTest@release_cpu' 'DataDir=C:\repos\cntk\Examples\Text\ATIS\Data' 'ConfigDir=C:\repos\cntk\Examples\Text\ATIS' 'OutputDir=C:\repos\cntk\Examples\Text\ATIS\Data' DeviceId=-1 timestamping=true stderr=- command=Train 'Train=[SGD=[maxEpochs=1]]'
|
||||
=== Running /cygdrive/c/repos/cntk/x64/release_CpuOnly/cntk.exe configFile=C:\repos\cntk\Examples\Text\ATIS/ATIS.cntk currentDirectory=C:\repos\cntk\Examples\Text\ATIS\Data RunDir=C:\cygwin64\tmp\cntk-test-20161108174139.565799\EvalClientTests_CPPEvalExtendedClientTest@release_cpu DataDir=C:\repos\cntk\Examples\Text\ATIS\Data ConfigDir=C:\repos\cntk\Examples\Text\ATIS OutputDir=C:\repos\cntk\Examples\Text\ATIS\Data DeviceId=-1 timestamping=true stderr=- command=Train Train=[SGD=[maxEpochs=1]]
|
||||
+ /cygdrive/c/repos/cntk/x64/release_CpuOnly/cntk.exe 'configFile=C:\repos\cntk\Examples\Text\ATIS/ATIS.cntk' 'currentDirectory=C:\repos\cntk\Examples\Text\ATIS\Data' 'RunDir=C:\cygwin64\tmp\cntk-test-20161108174139.565799\EvalClientTests_CPPEvalExtendedClientTest@release_cpu' 'DataDir=C:\repos\cntk\Examples\Text\ATIS\Data' 'ConfigDir=C:\repos\cntk\Examples\Text\ATIS' 'OutputDir=C:\repos\cntk\Examples\Text\ATIS\Data' DeviceId=-1 timestamping=true stderr=- command=Train 'Train=[SGD=[maxEpochs=1]]'
|
||||
CNTK 2.0.beta2.0+ (zhouwang/pr899 0b1214, Nov 8 2016 17:27:36) on ZHOUWANGDEV4 at 2016/11/08 16:41:40
|
||||
|
||||
C:\repos\cntk\x64\release_CpuOnly\cntk.exe configFile=C:\repos\cntk\Examples\Text\ATIS/ATIS.cntk currentDirectory=C:\repos\cntk\Examples\Text\ATIS\Data RunDir=C:\cygwin64\tmp\cntk-test-20161108174139.565799\EvalClientTests_CPPEvalExtendedClientTest@release_cpu DataDir=C:\repos\cntk\Examples\Text\ATIS\Data ConfigDir=C:\repos\cntk\Examples\Text\ATIS OutputDir=C:\repos\cntk\Examples\Text\ATIS\Data DeviceId=-1 timestamping=true stderr=- command=Train Train=[SGD=[maxEpochs=1]]
|
||||
Changed current directory to C:\repos\cntk\Examples\Text\ATIS\Data
|
||||
11/08/2016 16:41:40: Redirecting stderr to file -_Train.logrank0
|
||||
CNTK 2.0.beta2.0+ (zhouwang/pr899 0b1214, Nov 8 2016 17:27:36) on ZHOUWANGDEV4 at 2016/11/08 16:41:40
|
||||
|
||||
C:\repos\cntk\x64\release_CpuOnly\cntk.exe configFile=C:\repos\cntk\Examples\Text\ATIS/ATIS.cntk currentDirectory=C:\repos\cntk\Examples\Text\ATIS\Data RunDir=C:\cygwin64\tmp\cntk-test-20161108174139.565799\EvalClientTests_CPPEvalExtendedClientTest@release_cpu DataDir=C:\repos\cntk\Examples\Text\ATIS\Data ConfigDir=C:\repos\cntk\Examples\Text\ATIS OutputDir=C:\repos\cntk\Examples\Text\ATIS\Data DeviceId=-1 timestamping=true stderr=- command=Train Train=[SGD=[maxEpochs=1]]
|
||||
|
||||
11/08/2016 16:41:40: ##############################################################################
|
||||
11/08/2016 16:41:40: # #
|
||||
11/08/2016 16:41:40: # Train command (train action) #
|
||||
11/08/2016 16:41:40: # #
|
||||
11/08/2016 16:41:40: ##############################################################################
|
||||
|
||||
Node 'lstmStack.layers[0].lstmState._.ot._.PlusArgs[0].PlusArgs[0].PlusArgs[1].TimesArgs[0]' (LearnableParameter operation) operation: Tensor shape was inferred as [300 x 150].
|
||||
Node 'lstmStack.layers[0].lstmState._.ft._.PlusArgs[0].PlusArgs[0].PlusArgs[1].TimesArgs[0]' (LearnableParameter operation) operation: Tensor shape was inferred as [300 x 150].
|
||||
Node 'lstmStack.layers[0].lstmState._.it._.PlusArgs[0].PlusArgs[0].PlusArgs[1].TimesArgs[0]' (LearnableParameter operation) operation: Tensor shape was inferred as [300 x 150].
|
||||
Node 'lstmStack.layers[0].lstmState._.bit.ElementTimesArgs[1].z.PlusArgs[0].PlusArgs[1].TimesArgs[0]' (LearnableParameter operation) operation: Tensor shape was inferred as [300 x 150].
|
||||
11/08/2016 16:41:40:
|
||||
Model has 61 nodes. Using CPU.
|
||||
|
||||
11/08/2016 16:41:40: Training criterion: cr = CrossEntropyWithSoftmax
|
||||
11/08/2016 16:41:40: Evaluation criterion: errs = ClassificationError
|
||||
|
||||
11/08/2016 16:41:40: Training 1005127 parameters in 18 parameter tensors.
|
||||
|
||||
11/08/2016 16:42:02: Finished Epoch[ 1 of 1]: [Training] cr = 0.40189165 * 36006; errs = 8.254% * 36006; totalSamplesSeen = 36006; learningRatePerSample = 0.0099999998; epochTime=22.2249s
|
||||
|
||||
11/08/2016 16:42:02: __COMPLETED__
|
||||
+ return 0
|
||||
+ local ExitCode=0
|
||||
+ [[ 0 == 1 ]]
|
||||
+ return 0
|
||||
+ '[' -d 'C:\repos\cntk\Examples\Text\ATIS\Data/work' ']'
|
||||
+ '[' -d /cygdrive/c/repos/cntk/Tests/EndToEndTests/../../Examples/Text/ATIS/work ']'
|
||||
+ mv 'C:\repos\cntk\Examples\Text\ATIS\Data/work' /cygdrive/c/repos/cntk/Tests/EndToEndTests/../../Examples/Text/ATIS/
|
||||
+ '[' Windows_NT == Windows_NT ']'
|
||||
+ /cygdrive/c/repos/cntk/x64/release_CpuOnly/CPPEvalExtendedClientTest.exe
|
||||
Input node name: featuresCW
|
||||
Input feature dimension: 944
|
||||
Input node name: featuresNW
|
||||
Input feature dimension: 944
|
||||
Input node name: featuresPW
|
||||
Input feature dimension: 944
|
||||
Slot tag for sentence "BOS i would like to find a flight from charlotte to las vegas that makes a stop in st. louis EOS" is as followings:
|
||||
i -- I-transport_type
|
||||
would -- I-transport_type
|
||||
like -- I-transport_type
|
||||
to -- I-transport_type
|
||||
find -- I-transport_type
|
||||
a -- I-transport_type
|
||||
flight -- I-transport_type
|
||||
from -- I-transport_type
|
||||
charlotte -- B-fromloc.airport_name
|
||||
to -- I-transport_type
|
||||
las -- B-toloc.airport_name
|
||||
vegas -- I-toloc.airport_name
|
||||
that -- I-transport_type
|
||||
makes -- I-transport_type
|
||||
a -- I-transport_type
|
||||
stop -- I-transport_type
|
||||
in -- I-transport_type
|
||||
st. -- B-stoploc.airport_name
|
||||
louis -- I-state_name
|
||||
Evaluation complete.
|
||||
Output dimension: 127
|
||||
Output name: outputs
|
||||
+ ExitCode=0
|
||||
+ '[' -d /cygdrive/c/repos/cntk/Tests/EndToEndTests/../../Examples/Text/ATIS/work ']'
|
||||
+ rm -rf /cygdrive/c/repos/cntk/Tests/EndToEndTests/../../Examples/Text/ATIS/work
|
||||
+ exit 0
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/bash
|
||||
|
||||
. $TEST_ROOT_DIR/run-test-common
|
||||
|
||||
set -x
|
||||
|
||||
# This test case is to test CPPEvalClient works with the same setup of users.
|
||||
# For that purpose, the test needs to create the pre-trained model in the Examples directories as expected by CPPEvalExtendedClient.
|
||||
# These files are removed by Jenkins during workspace cleanup.
|
||||
|
||||
# The eval test uses some pretrained models which are not part of the CNTK repository itself
|
||||
# We use the dataset from an external location specified using an environment variable
|
||||
if [[ -z "$CNTK_EXTERNAL_TESTDATA_SOURCE_DIRECTORY" || ! -d "$CNTK_EXTERNAL_TESTDATA_SOURCE_DIRECTORY" ]]; then
|
||||
echo This test uses external data that is not part of the CNTK repository. Environment variable CNTK_EXTERNAL_TESTDATA_SOURCE_DIRECTORY must be set to point to the external test data location.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$OS" == "Windows_NT" ]; then
|
||||
TestDataDir=`cygpath -au $CNTK_EXTERNAL_TESTDATA_SOURCE_DIRECTORY`
|
||||
else
|
||||
TestDataDir=$CNTK_EXTERNAL_TESTDATA_SOURCE_DIRECTORY
|
||||
fi
|
||||
|
||||
ATISDir=$TEST_ROOT_DIR/../../Examples/Text/ATIS
|
||||
DataDir=$ATISDir/Data
|
||||
OutputDir=$ATISDir/Data
|
||||
ConfigDir=$ATISDir
|
||||
|
||||
# Train model for evaluation
|
||||
DeleteModelsAfterTest=0
|
||||
[ -f $ConfigDir/ATIS.cntk ] || exit 1
|
||||
cntkrun ATIS.cntk "stderr=- command=Train Train=[SGD=[maxEpochs=1]]" || exit $?
|
||||
|
||||
# The created model is saved under $DataDir/work, according to ATIS.cntk. Move it to the $ATISDir/work
|
||||
[ -d $DataDir/work ] || exit $?
|
||||
[ -d $ATISDir/work ] && rm -rf $ATISDir/work
|
||||
mv $DataDir/work $ATISDir/ || exit $?
|
||||
|
||||
if [ "$OS" == "Windows_NT" ]; then
|
||||
$TEST_BIN_DIR/CPPEvalExtendedClientTest.exe
|
||||
else
|
||||
$TEST_BIN_DIR/cppevalextendedclient
|
||||
fi
|
||||
ExitCode=$?
|
||||
|
||||
[ -d $ATISDir/work ] && rm -rf $ATISDir/work
|
||||
|
||||
exit $ExitCode
|
|
@ -0,0 +1,92 @@
|
|||
dataDir: .
|
||||
|
||||
tags:
|
||||
- bvt-i (build_sku != '1bitsgd') and ((build_sku == 'cpu') or (device == 'gpu')) and (flavor == 'release')
|
||||
# This test also runs in debug mode, as the debug version of EvalDll is also included in the NuGet package.
|
||||
- nightly-i (build_sku != '1bitsgd') and ((build_sku == 'cpu') or (device == 'gpu'))
|
||||
|
||||
testCases:
|
||||
Test run must be completed:
|
||||
patterns:
|
||||
- Evaluation complete
|
||||
|
||||
# Due to time limitation, the test can only train the model with 1 Epoch, so the
|
||||
# model is not accurate enough to create correct results under some build flavors.
|
||||
# Disable to check results for now.
|
||||
|
||||
#Test results Line 1:
|
||||
#patterns:
|
||||
# - i -- I-transport_type
|
||||
|
||||
#Test results Line 2:
|
||||
# patterns:
|
||||
# - would -- I-transport_type
|
||||
|
||||
#Test results Line 3:
|
||||
# patterns:
|
||||
# - like -- I-transport_type
|
||||
|
||||
#Test results Line 4:
|
||||
# patterns:
|
||||
# - to -- I-transport_type
|
||||
|
||||
#Test results Line 5:
|
||||
# patterns:
|
||||
# - find -- I-transport_type
|
||||
|
||||
#Test results Line 6:
|
||||
# patterns:
|
||||
# - a -- I-transport_type
|
||||
|
||||
#Test results Line 7:
|
||||
# patterns:
|
||||
# - flight -- I-transport_type
|
||||
|
||||
#Test results Line 8:
|
||||
# patterns:
|
||||
# - from -- I-transport_type
|
||||
|
||||
#Test results Line 9:
|
||||
# patterns:
|
||||
# - charlotte -- B-fromloc.airport_name
|
||||
|
||||
#Test results Line 10:
|
||||
# patterns:
|
||||
# - to -- I-transport_type
|
||||
|
||||
#Test results Line 11:
|
||||
# patterns:
|
||||
# - las -- B-toloc.airport_name
|
||||
|
||||
#Test results Line 12:
|
||||
# patterns:
|
||||
# - vegas -- I-toloc.airport_name
|
||||
|
||||
#Test results Line 13:
|
||||
# patterns:
|
||||
# - that -- I-transport_type
|
||||
|
||||
#Test results Line 14:
|
||||
# patterns:
|
||||
# - makes -- I-transport_type
|
||||
|
||||
#Test results Line 15:
|
||||
# patterns:
|
||||
# - a -- I-transport_type
|
||||
|
||||
#Test results Line 16:
|
||||
# patterns:
|
||||
# - stop -- I-transport_type
|
||||
|
||||
#Test results Line 17:
|
||||
# patterns:
|
||||
# - in -- I-transport_type
|
||||
|
||||
#Test results Line 18:
|
||||
# patterns:
|
||||
# - st. -- B-stoploc.airport_name
|
||||
|
||||
#Test results Line 19:
|
||||
# patterns:
|
||||
# - louis -- I-state_name
|
||||
|
Загрузка…
Ссылка в новой задаче