Skip to content

Commit

Permalink
[MERGE into v1.0.0 ONLY] Fix license for 1.0.0 (apache#8876)
Browse files Browse the repository at this point in the history
* Remove ASF Licenses from some files

* typo

* typo 2

* whitelisting files for header check

(cherry picked from commit 74be98b)
  • Loading branch information
mbaijal committed Dec 21, 2017
1 parent ddec3cc commit 9d4d528
Show file tree
Hide file tree
Showing 9 changed files with 232 additions and 95 deletions.
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,32 @@
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.


3. Sphinx JavaScript utilties for the full-text search

For details, see, docs/_static/searchtools_custom.js

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/*!
* Copyright (c) 2015 by Xiao Liu, pertusa, caprice-j
* \file image_classification-predict.cpp
Expand Down
94 changes: 94 additions & 0 deletions example/speech-demo/decode_mxnet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/bin/bash

# Copyright 2012-2013 Karel Vesely, Daniel Povey
# 2015 Yu Zhang
# Apache 2.0

# Begin configuration section.
nnet= # Optionally pre-select network to use for getting state-likelihoods
feature_transform= # Optionally pre-select feature transform (in front of nnet)
model= # Optionally pre-select transition model
class_frame_counts= # Optionally pre-select class-counts used to compute PDF priors

stage=0 # stage=1 skips lattice generation
nj=4
cmd=run.pl
max_active=7000 # maximum of active tokens
min_active=200 #minimum of active tokens
max_mem=50000000 # limit the fst-size to 50MB (larger fsts are minimized)
beam=13.0 # GMM:13.0
latbeam=8.0 # GMM:6.0
acwt=0.10 # GMM:0.0833, note: only really affects pruning (scoring is on lattices).
scoring_opts="--min-lmwt 1 --max-lmwt 10"
skip_scoring=false
use_gpu_id=-1 # disable gpu
#parallel_opts="-pe smp 2" # use 2 CPUs (1 DNN-forward, 1 decoder)
parallel_opts= # use 2 CPUs (1 DNN-forward, 1 decoder)
# End configuration section.

echo "$0 $@" # Print the command line for logging

[ -f ./path.sh ] && . ./path.sh; # source the path.
. parse_options.sh || exit 1;

graphdir=$1
data=$2
dir=$3
srcdir=`dirname $dir`; # The model directory is one level up from decoding directory.
sdata=$data/split$nj;

mxstring=$4

mkdir -p $dir/log
[[ -d $sdata && $data/feats.scp -ot $sdata ]] || split_data.sh $data $nj || exit 1;
echo $nj > $dir/num_jobs

if [ -z "$model" ]; then # if --model <mdl> was not specified on the command line...
if [ -z $iter ]; then model=$srcdir/final.mdl;
else model=$srcdir/$iter.mdl; fi
fi

for f in $model $graphdir/HCLG.fst; do
[ ! -f $f ] && echo "decode_mxnet.sh: no such file $f" && exit 1;
done


# check that files exist
for f in $sdata/1/feats.scp $model $graphdir/HCLG.fst; do
[ ! -f $f ] && echo "$0: no such file $f" && exit 1;
done

# PREPARE THE LOG-POSTERIOR COMPUTATION PIPELINE
if [ -z "$class_frame_counts" ]; then
class_frame_counts=$srcdir/ali_train_pdf.counts
else
echo "Overriding class_frame_counts by $class_frame_counts"
fi

# Create the feature stream:
feats="scp:$sdata/JOB/feats.scp"
inputfeats="$sdata/JOB/mxnetInput.scp"


if [ -f $sdata/1/feats.scp ]; then
$cmd JOB=1:$nj $dir/log/make_input.JOB.log \
echo NO_FEATURE_TRANSFORM scp:$sdata/JOB/feats.scp \> $inputfeats
fi

# Run the decoding in the queue
if [ $stage -le 0 ]; then
$cmd $parallel_opts JOB=1:$nj $dir/log/decode.JOB.log \
$mxstring --data_test $inputfeats \| \
latgen-faster-mapped --min-active=$min_active --max-active=$max_active --max-mem=$max_mem --beam=$beam --lattice-beam=$latbeam \
--acoustic-scale=$acwt --allow-partial=true --word-symbol-table=$graphdir/words.txt \
$model $graphdir/HCLG.fst ark:- "ark:|gzip -c > $dir/lat.JOB.gz" || exit 1;
fi

# Run the scoring
if ! $skip_scoring ; then
[ ! -x local/score.sh ] && \
echo "Not scoring because local/score.sh does not exist or not executable." && exit 1;
local/score.sh $scoring_opts --cmd "$cmd" $data $graphdir $dir || exit 1;
fi

exit 0;
102 changes: 102 additions & 0 deletions example/speech-demo/io_func/convert2kaldi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@

# Copyright 2013 Yajie Miao Carnegie Mellon University


import numpy as np
import os
import sys

from StringIO import StringIO
import json
import utils.utils as utils
from model_io import string_2_array

# Various functions to convert models into Kaldi formats
def _nnet2kaldi(nnet_spec, set_layer_num = -1, filein='nnet.in',
fileout='nnet.out', activation='sigmoid', withfinal=True):
_nnet2kaldi_main(nnet_spec, set_layer_num=set_layer_num, filein=filein,
fileout=fileout, activation=activation, withfinal=withfinal, maxout=False)

def _nnet2kaldi_maxout(nnet_spec, pool_size = 1, set_layer_num = -1,
filein='nnet.in', fileout='nnet.out', activation='sigmoid', withfinal=True):
_nnet2kaldi_main(nnet_spec, set_layer_num=set_layer_num, filein=filein,
fileout=fileout, activation=activation, withfinal=withfinal,
pool_size = 1, maxout=True)

def _nnet2kaldi_main(nnet_spec, set_layer_num = -1, filein='nnet.in',
fileout='nnet.out', activation='sigmoid', withfinal=True, maxout=False):
elements = nnet_spec.split(':')
layers = []
for x in elements:
layers.append(int(x))
if set_layer_num == -1:
layer_num = len(layers) - 1
else:
layer_num = set_layer_num + 1
nnet_dict = {}
nnet_dict = utils.pickle_load(filein)

fout = open(fileout, 'wb')
for i in xrange(layer_num - 1):
input_size = int(layers[i])
if maxout:
output_size = int(layers[i + 1]) * pool_size
else:
output_size = int(layers[i + 1])
W_layer = []
b_layer = ''
for rowX in xrange(output_size):
W_layer.append('')

dict_key = str(i) + ' ' + activation + ' W'
matrix = string_2_array(nnet_dict[dict_key])

for x in xrange(input_size):
for t in xrange(output_size):
W_layer[t] = W_layer[t] + str(matrix[x][t]) + ' '

dict_key = str(i) + ' ' + activation + ' b'
vector = string_2_array(nnet_dict[dict_key])
for x in xrange(output_size):
b_layer = b_layer + str(vector[x]) + ' '

fout.write('<affinetransform> ' + str(output_size) + ' ' + str(input_size) + '\n')
fout.write('[' + '\n')
for x in xrange(output_size):
fout.write(W_layer[x].strip() + '\n')
fout.write(']' + '\n')
fout.write('[ ' + b_layer.strip() + ' ]' + '\n')
if maxout:
fout.write('<maxout> ' + str(int(layers[i + 1])) + ' ' + str(output_size) + '\n')
else:
fout.write('<sigmoid> ' + str(output_size) + ' ' + str(output_size) + '\n')

if withfinal:
input_size = int(layers[-2])
output_size = int(layers[-1])
W_layer = []
b_layer = ''
for rowX in xrange(output_size):
W_layer.append('')

dict_key = 'logreg W'
matrix = string_2_array(nnet_dict[dict_key])
for x in xrange(input_size):
for t in xrange(output_size):
W_layer[t] = W_layer[t] + str(matrix[x][t]) + ' '


dict_key = 'logreg b'
vector = string_2_array(nnet_dict[dict_key])
for x in xrange(output_size):
b_layer = b_layer + str(vector[x]) + ' '

fout.write('<affinetransform> ' + str(output_size) + ' ' + str(input_size) + '\n')
fout.write('[' + '\n')
for x in xrange(output_size):
fout.write(W_layer[x].strip() + '\n')
fout.write(']' + '\n')
fout.write('[ ' + b_layer.strip() + ' ]' + '\n')
fout.write('<softmax> ' + str(output_size) + ' ' + str(output_size) + '\n')

fout.close();
19 changes: 0 additions & 19 deletions src/operator/contrib/nn/deformable_im2col.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/*!
******************* BEGIN Caffe Copyright Notice and Disclaimer ****************
*
Expand Down
19 changes: 0 additions & 19 deletions src/operator/contrib/psroi_pooling-inl.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/*!
* Copyright (c) 2017 by Contributors
* Copyright (c) 2017 Microsoft
Expand Down
19 changes: 0 additions & 19 deletions src/operator/nn/pool.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/*!
******************* BEGIN Caffe Copyright Notice and Disclaimer ****************
*
Expand Down
19 changes: 0 additions & 19 deletions src/operator/special_functions-inl.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/*!
* Copyright (c) 2015 by Contributors
* \file special_functions-inl.h
Expand Down
7 changes: 7 additions & 0 deletions tools/license_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@
'3rdparty',
'ps-lite',
'src/operator/mkl/',
'src/operator/special_functions-inl.h',
'src/operator/nn/pool.h',
'src/operator/contrib/psroi_pooling-inl.h',
'src/operator/contrib/nn/deformable_im2col.h',
'example/speech-demo/io_func/convert2kaldi.py',
'example/speech-demo/decode_mxnet.sh',
'example/image-classification/predict-cpp/image-classification-predict.cc',
'src/operator/contrib/ctc_include/']

# language extensions and the according commment mark
Expand Down

0 comments on commit 9d4d528

Please sign in to comment.