Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify get_version.sh to deal better with whitespace (avoid space in … #1526

Merged
merged 1 commit into from
Apr 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/base/get_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,20 @@ elif [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" != true ]; then
echo "$0: Using the version number \"$version\" specified in src/.version."
else
# Figure out patch number.
version_commit=$(git log -1 --pretty=oneline ../.version | cut -f 1 -d ' ')
patch_number=$(git rev-list ${version_commit}..HEAD | wc -l)
version_commit=$(git log -1 --pretty=oneline ../.version | awk '{print $1}')
patch_number=$(git rev-list ${version_commit}..HEAD | wc -l | awk '{print $1}')
version="$version.$patch_number"

# Check for uncommitted changes in src/.
uncommitted_changes=$(git diff-index HEAD -- .. | wc -l)
uncommitted_changes=$(git diff-index HEAD -- .. | wc -l | awk '{print $1}')
if [ $uncommitted_changes -gt 0 ]; then
# Add suffix ~N if there are N files in src/ with uncommitted changes
version="$version~$uncommitted_changes"
fi

# Figure out HEAD commit SHA-1.
head_commit=$(git log -1 --pretty=oneline | cut -f 1 -d ' ')
head_commit_short=$(git log -1 --oneline --abbrev=4 | cut -f 1 -d ' ')
head_commit=$(git log -1 --pretty=oneline | awk '{print $1}')
head_commit_short=$(git log -1 --oneline --abbrev=4 | awk '{print $1}')
version="$version-${head_commit_short}"
fi

Expand Down
4 changes: 2 additions & 2 deletions src/chain/chain-training.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void ComputeChainObjfAndDeriv(const ChainTrainingOptions &opts,
const Supervision &supervision,
const CuMatrixBase<BaseFloat> &nnet_output,
BaseFloat *objf,
BaseFloat *l2_term,
BaseFloat *l2_term,
BaseFloat *weight,
CuMatrixBase<BaseFloat> *nnet_output_deriv,
CuMatrixBase<BaseFloat> *xent_output_deriv) {
Expand Down Expand Up @@ -86,7 +86,7 @@ void ComputeChainObjfAndDeriv(const ChainTrainingOptions &opts,
// for different frames of the sequences. As expected, they are
// smaller towards the edges of the sequences (due to the penalization
// of 'incorrect' pdf-ids.
if (GetVerboseLevel() >= 1) {
if (GetVerboseLevel() >= 1 && nnet_output_deriv != NULL) {
int32 tot_frames = nnet_output_deriv->NumRows(),
frames_per_sequence = supervision.frames_per_sequence,
num_sequences = supervision.num_sequences;
Expand Down
Loading