added _Solution versions of SLUHandsOn up to Solution4
This commit is contained in:
Родитель
7e764a0122
Коммит
b6742c23ff
5
CNTK.sln
5
CNTK.sln
|
@ -1160,14 +1160,19 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ImageHandsOn", "ImageHandsO
|
|||
Tutorials\ImageHandsOn\cifar10.pretrained.cmf = Tutorials\ImageHandsOn\cifar10.pretrained.cmf
|
||||
Tutorials\ImageHandsOn\CifarConverter.py = Tutorials\ImageHandsOn\CifarConverter.py
|
||||
Tutorials\ImageHandsOn\ImageHandsOn.cntk = Tutorials\ImageHandsOn\ImageHandsOn.cntk
|
||||
Tutorials\SLUHandsOn\slu.forward.backward.cmf = Tutorials\SLUHandsOn\slu.forward.backward.cmf
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SLUHandsOn", "SLUHandsOn", "{CC143D08-567D-4DAC-9E14-264749C19039}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Tutorials\SLUHandsOn\atis.test.ctf = Tutorials\SLUHandsOn\atis.test.ctf
|
||||
Tutorials\SLUHandsOn\atis.train.ctf = Tutorials\SLUHandsOn\atis.train.ctf
|
||||
Tutorials\SLUHandsOn\slu.forward.cmf = Tutorials\SLUHandsOn\slu.forward.cmf
|
||||
Tutorials\SLUHandsOn\slu.forward.lookahead.cmf = Tutorials\SLUHandsOn\slu.forward.lookahead.cmf
|
||||
Tutorials\SLUHandsOn\slu.forward.nobn.cmf = Tutorials\SLUHandsOn\slu.forward.nobn.cmf
|
||||
Tutorials\SLUHandsOn\SLUHandsOn.cntk = Tutorials\SLUHandsOn\SLUHandsOn.cntk
|
||||
Tutorials\SLUHandsOn\SLUHandsOn_Solution1.cntk = Tutorials\SLUHandsOn\SLUHandsOn_Solution1.cntk
|
||||
Tutorials\SLUHandsOn\SLUHandsOn_Solution2.cntk = Tutorials\SLUHandsOn\SLUHandsOn_Solution2.cntk
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
# CNTK Configuration File for creating a slot tagger and an intent tagger.
|
||||
|
||||
command = TrainTagger:TestTagger
|
||||
|
||||
makeMode = false ; traceLevel = 0 ; deviceId = "auto"
|
||||
|
||||
rootDir = "." ; dataDir = "$rootDir$" ; modelDir = "$rootDir$/Models"
|
||||
|
||||
modelPath = "$modelDir$/slu.cmf"
|
||||
|
||||
vocabSize = 943 ; numLabels = 129 ; numIntents = 26 # number of words in vocab, slot labels, and intent labels
|
||||
|
||||
# The command to train the LSTM model
|
||||
TrainTagger = {
|
||||
action = "train"
|
||||
BrainScriptNetworkBuilder = {
|
||||
inputDim = $vocabSize$
|
||||
labelDim = $numLabels$
|
||||
embDim = 150
|
||||
hiddenDim = 300
|
||||
|
||||
model = Sequential (
|
||||
EmbeddingLayer {embDim} : # embedding
|
||||
BatchNormalizationLayer {normalizationTimeConstant=2048} : ##### added
|
||||
RecurrentLSTMLayer {hiddenDim, goBackwards=false} : # LSTM
|
||||
BatchNormalizationLayer {normalizationTimeConstant=2048} : ##### added
|
||||
DenseLayer {labelDim, initValueScale=7} # output layer
|
||||
)
|
||||
|
||||
# features
|
||||
query = Input {inputDim}
|
||||
slotLabels = Input {labelDim}
|
||||
|
||||
# model application
|
||||
z = model (query)
|
||||
|
||||
# loss and metric
|
||||
ce = CrossEntropyWithSoftmax (slotLabels, z)
|
||||
errs = ErrorPrediction (slotLabels, z)
|
||||
|
||||
featureNodes = (query)
|
||||
labelNodes = (slotLabels)
|
||||
criterionNodes = (ce)
|
||||
evaluationNodes = (errs)
|
||||
outputNodes = (z)
|
||||
}
|
||||
|
||||
SGD = {
|
||||
maxEpochs = 8 ; epochSize = 36000
|
||||
|
||||
minibatchSize = 70
|
||||
|
||||
learningRatesPerSample = 0.01*2:0.005*12:0.001
|
||||
gradUpdateType = "FSAdaGrad"
|
||||
gradientClippingWithTruncation = true ; clippingThresholdPerSample = 15.0
|
||||
|
||||
firstMBsToShowResult = 10 ; numMBsToShowResult = 100
|
||||
}
|
||||
|
||||
reader = {
|
||||
readerType = "CNTKTextFormatReader"
|
||||
file = "$DataDir$/atis.train.ctf"
|
||||
randomize = true
|
||||
input = {
|
||||
query = { alias = "S0" ; dim = $vocabSize$ ; format = "sparse" }
|
||||
intentLabels = { alias = "S1" ; dim = $numIntents$ ; format = "sparse" }
|
||||
slotLabels = { alias = "S2" ; dim = $numLabels$ ; format = "sparse" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Test the model's accuracy (as an error count)
|
||||
TestTagger = {
|
||||
action = "eval"
|
||||
modelPath = $modelPath$
|
||||
reader = {
|
||||
readerType = "CNTKTextFormatReader"
|
||||
file = "$DataDir$/atis.test.ctf"
|
||||
randomize = false
|
||||
input = {
|
||||
query = { alias = "S0" ; dim = $vocabSize$ ; format = "sparse" }
|
||||
intentLabels = { alias = "S1" ; dim = $numIntents$ ; format = "sparse" }
|
||||
slotLabels = { alias = "S2" ; dim = $numLabels$ ; format = "sparse" }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
# CNTK Configuration File for creating a slot tagger and an intent tagger.
|
||||
|
||||
command = TrainTagger:TestTagger
|
||||
|
||||
makeMode = false ; traceLevel = 0 ; deviceId = "auto"
|
||||
|
||||
rootDir = "." ; dataDir = "$rootDir$" ; modelDir = "$rootDir$/Models"
|
||||
|
||||
modelPath = "$modelDir$/slu.cmf"
|
||||
|
||||
vocabSize = 943 ; numLabels = 129 ; numIntents = 26 # number of words in vocab, slot labels, and intent labels
|
||||
|
||||
# The command to train the LSTM model
|
||||
TrainTagger = {
|
||||
action = "train"
|
||||
BrainScriptNetworkBuilder = {
|
||||
inputDim = $vocabSize$
|
||||
labelDim = $numLabels$
|
||||
embDim = 150
|
||||
hiddenDim = 300
|
||||
|
||||
LookaheadLayer (x) = Splice (x : FutureValue (0, x, defaultHiddenActivation=0))
|
||||
|
||||
model = Sequential (
|
||||
EmbeddingLayer {embDim} : # embedding
|
||||
LookaheadLayer : ##### added
|
||||
BatchNormalizationLayer {normalizationTimeConstant=2048} :
|
||||
RecurrentLSTMLayer {hiddenDim, goBackwards=false} : # LSTM
|
||||
BatchNormalizationLayer {normalizationTimeConstant=2048} :
|
||||
DenseLayer {labelDim, initValueScale=7} # output layer
|
||||
)
|
||||
|
||||
# features
|
||||
query = Input {inputDim}
|
||||
slotLabels = Input {labelDim}
|
||||
|
||||
# model application
|
||||
z = model (query)
|
||||
|
||||
# loss and metric
|
||||
ce = CrossEntropyWithSoftmax (slotLabels, z)
|
||||
errs = ErrorPrediction (slotLabels, z)
|
||||
|
||||
featureNodes = (query)
|
||||
labelNodes = (slotLabels)
|
||||
criterionNodes = (ce)
|
||||
evaluationNodes = (errs)
|
||||
outputNodes = (z)
|
||||
}
|
||||
|
||||
SGD = {
|
||||
maxEpochs = 8 ; epochSize = 36000
|
||||
|
||||
minibatchSize = 70
|
||||
|
||||
learningRatesPerSample = 0.01*2:0.005*12:0.001
|
||||
gradUpdateType = "FSAdaGrad"
|
||||
gradientClippingWithTruncation = true ; clippingThresholdPerSample = 15.0
|
||||
|
||||
firstMBsToShowResult = 10 ; numMBsToShowResult = 100
|
||||
}
|
||||
|
||||
reader = {
|
||||
readerType = "CNTKTextFormatReader"
|
||||
file = "$DataDir$/atis.train.ctf"
|
||||
randomize = true
|
||||
input = {
|
||||
query = { alias = "S0" ; dim = $vocabSize$ ; format = "sparse" }
|
||||
intentLabels = { alias = "S1" ; dim = $numIntents$ ; format = "sparse" }
|
||||
slotLabels = { alias = "S2" ; dim = $numLabels$ ; format = "sparse" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Test the model's accuracy (as an error count)
|
||||
TestTagger = {
|
||||
action = "eval"
|
||||
modelPath = $modelPath$
|
||||
reader = {
|
||||
readerType = "CNTKTextFormatReader"
|
||||
file = "$DataDir$/atis.test.ctf"
|
||||
randomize = false
|
||||
input = {
|
||||
query = { alias = "S0" ; dim = $vocabSize$ ; format = "sparse" }
|
||||
intentLabels = { alias = "S1" ; dim = $numIntents$ ; format = "sparse" }
|
||||
slotLabels = { alias = "S2" ; dim = $numLabels$ ; format = "sparse" }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
# CNTK Configuration File for creating a slot tagger and an intent tagger.
|
||||
|
||||
command = TrainTagger:TestTagger
|
||||
|
||||
makeMode = false ; traceLevel = 0 ; deviceId = "auto"
|
||||
|
||||
rootDir = "." ; dataDir = "$rootDir$" ; modelDir = "$rootDir$/Models"
|
||||
|
||||
modelPath = "$modelDir$/slu.cmf"
|
||||
|
||||
vocabSize = 943 ; numLabels = 129 ; numIntents = 26 # number of words in vocab, slot labels, and intent labels
|
||||
|
||||
# The command to train the LSTM model
|
||||
TrainTagger = {
|
||||
action = "train"
|
||||
BrainScriptNetworkBuilder = {
|
||||
inputDim = $vocabSize$
|
||||
labelDim = $numLabels$
|
||||
embDim = 150
|
||||
#hiddenDim = 300
|
||||
hiddenDim = 150
|
||||
|
||||
BiRecurrentLSTMLayer {outDim} = {
|
||||
F = RecurrentLSTMLayer {outDim, goBackwards=false}
|
||||
G = RecurrentLSTMLayer {outDim, goBackwards=true}
|
||||
apply (x) = Splice (F(x):G(x))
|
||||
}.apply
|
||||
|
||||
model = Sequential (
|
||||
EmbeddingLayer {embDim} :
|
||||
BatchNormalizationLayer {normalizationTimeConstant=2048} :
|
||||
BiRecurrentLSTMLayer {hiddenDim} :
|
||||
BatchNormalizationLayer {normalizationTimeConstant=2048} :
|
||||
DenseLayer {labelDim, initValueScale=7}
|
||||
)
|
||||
|
||||
# features
|
||||
query = Input {inputDim}
|
||||
slotLabels = Input {labelDim}
|
||||
|
||||
# model application
|
||||
z = model (query)
|
||||
|
||||
# loss and metric
|
||||
ce = CrossEntropyWithSoftmax (slotLabels, z)
|
||||
errs = ErrorPrediction (slotLabels, z)
|
||||
|
||||
featureNodes = (query)
|
||||
labelNodes = (slotLabels)
|
||||
criterionNodes = (ce)
|
||||
evaluationNodes = (errs)
|
||||
outputNodes = (z)
|
||||
}
|
||||
|
||||
SGD = {
|
||||
maxEpochs = 8 ; epochSize = 36000
|
||||
|
||||
minibatchSize = 70
|
||||
|
||||
learningRatesPerSample = 0.01*2:0.005*12:0.001
|
||||
gradUpdateType = "FSAdaGrad"
|
||||
gradientClippingWithTruncation = true ; clippingThresholdPerSample = 15.0
|
||||
|
||||
firstMBsToShowResult = 10 ; numMBsToShowResult = 100
|
||||
}
|
||||
|
||||
reader = {
|
||||
readerType = "CNTKTextFormatReader"
|
||||
file = "$DataDir$/atis.train.ctf"
|
||||
randomize = true
|
||||
input = {
|
||||
query = { alias = "S0" ; dim = $vocabSize$ ; format = "sparse" }
|
||||
intentLabels = { alias = "S1" ; dim = $numIntents$ ; format = "sparse" }
|
||||
slotLabels = { alias = "S2" ; dim = $numLabels$ ; format = "sparse" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Test the model's accuracy (as an error count)
|
||||
TestTagger = {
|
||||
action = "eval"
|
||||
modelPath = $modelPath$
|
||||
reader = {
|
||||
readerType = "CNTKTextFormatReader"
|
||||
file = "$DataDir$/atis.test.ctf"
|
||||
randomize = false
|
||||
input = {
|
||||
query = { alias = "S0" ; dim = $vocabSize$ ; format = "sparse" }
|
||||
intentLabels = { alias = "S1" ; dim = $numIntents$ ; format = "sparse" }
|
||||
slotLabels = { alias = "S2" ; dim = $numLabels$ ; format = "sparse" }
|
||||
}
|
||||
}
|
||||
}
|
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче