Skip to content

Commit

Permalink
Sample_server (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
midobal committed Jul 3, 2020
1 parent 568355e commit 90813b0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions demo-web/sample_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def generate_sample(self, source_sentence, validated_prefix=None, max_N=5, isle_
sample_beam_search_end_time = time.time()
logger.log(2, 'sample_beam_search time: %.6f' % (sample_beam_search_end_time - sample_beam_search_start_time))

if False and self.params_prediction['pos_unk']:
if self.params_prediction['pos_unk']:
alphas = [alphas]
sources = [tokenized_input]
heuristic = self.params_prediction['heuristic']
Expand Down Expand Up @@ -434,6 +434,9 @@ def main():
exit(2)
dataset = loadDataset(args.dataset)

parameters['INPUT_VOCABULARY_SIZE'] = dataset.vocabulary_len[parameters['INPUTS_IDS_DATASET'][0]]
parameters['OUTPUT_VOCABULARY_SIZE'] = dataset.vocabulary_len[parameters['OUTPUTS_IDS_DATASET'][0]]

# For converting predictions into sentences
# Dataset backwards compatibility
bpe_separator = dataset.BPE_separator if hasattr(dataset,
Expand Down Expand Up @@ -541,9 +544,6 @@ def main():
nmt_model.setParams(parameters)
nmt_model.setOptimizer()

parameters['INPUT_VOCABULARY_SIZE'] = dataset.vocabulary_len[parameters['INPUTS_IDS_DATASET'][0]]
parameters['OUTPUT_VOCABULARY_SIZE'] = dataset.vocabulary_len[parameters['OUTPUTS_IDS_DATASET'][0]]

# Get word2index and index2word dictionaries
index2word_y = dataset.vocabulary[parameters['OUTPUTS_IDS_DATASET'][0]]['idx2words']
word2index_y = dataset.vocabulary[parameters['OUTPUTS_IDS_DATASET'][0]]['words2idx']
Expand Down

0 comments on commit 90813b0

Please sign in to comment.