Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Input vectors #168

Merged
merged 21 commits into from Apr 18, 2017
Merged

Input vectors #168

merged 21 commits into from Apr 18, 2017

Conversation

jsenellart
Copy link
Contributor

@jsenellart jsenellart commented Mar 19, 2017

Added 2 new features for adding support of input vectors

  • option -idx_files indicate that source/target files are indexed meaning that their format is key value not necessarily in the same order
  • new data type feattext which is using Kaldi text ark dump format
KEY [
VAL1 VAL2 VAL3
VAL4 VAL5 VAL6 ]
KEY2 [
...
]

Typical preprocessing command:

th preprocess.lua -data_type 'feattext' -train_src TIMIT/raw_mfcc_train.ark.txt \
                -train_tgt TIMIT/data/train/text -valid_src TIMIT/raw_mfcc_dev.ark.txt \
                -valid_tgt TIMIT/data/dev/text -save_data TIMIT/baseline -idx_files \
                -src_seq_length 1000 -tgt_seq_length 100

For training:

th train.lua -data TIMIT/baseline-train.t7 -save_model TIMIT -pdbrnn -report_every 1 \
           -rnn_size 800 -word_vec_size 20  -layers 4 -max_batch_size 16 -learning_rate 0.7 \
           -learning_rate_decay 0.8 -end_epoch 20

For decoding:

th translate.lua -model data/asr1_epoch15_8.17.t7 -src TIMIT/raw_mfcc_test.ark.txt  -batch_size 1

@jsenellart jsenellart changed the title [WIP] Input vectors Input vectors Mar 21, 2017
Copy link
Collaborator

@guillaumekln guillaumekln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also add a documentation page on this.

onmt/Factory.lua Outdated
opt.pre_word_vecs_enc, opt.fix_word_vecs_enc == 1,
verbose)
else
inputNetwork = nn.Identity()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be in another function, like buildInputEncoder.

@@ -110,6 +110,23 @@ function PDBiEncoder:maskPadding()
self.layers[1]:maskPadding()
end

-- size of context vector
function PDBiEncoder:contextSize(sourceSize, sourceLength)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need that? Past the first layer, padding no more applies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contextSize is used in decoder to have size of the context size outside of the encoder which varies for pdbiencoder

preprocess.lua Outdated
if dataType == 'monotext' then
src_file = opt.train
end
data.dicts.src = Vocabulary.init('train',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep 'source' instead? See #162.

@guillaumekln guillaumekln merged commit 1b7632a into OpenNMT:master Apr 18, 2017
@@ -74,14 +74,24 @@ function Batch:__init(src, srcFeatures, tgt, tgtFeatures)

self.sourceLength, self.sourceSize, self.uneven = getLength(src)

-- if input vectors (speech for instance)
self.inputVectors = src[1]:dim() > 1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails with default constructor like local batch = Batch()

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! It has been fixed.

guillaumekln added a commit that referenced this pull request Apr 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants