示例#1
0
 def beam_search_wrapper():
     """ Beam Search """
     decoded_ids, scores = beam_search(  # [batch,beam,len] [batch,beam]
         symbols_to_logits_fn,
         initial_ids,
         conf.beam_size,
         conf.max_decode_len,
         conf.vocab_size,
         alpha=0,
         states=cache,
         eos_id=conf.eos_id,
     )
     return decoded_ids, scores
示例#2
0
 def beam_search_wrapper():
     """ Beam Search """
     decoded_ids, scores = beam_search(  # [batch,beam,len] [batch,beam]
         symbols_to_logits_fn,
         initial_ids,
         beam_size=conf.beam_size,
         max_decode_len=conf.max_decode_len,
         vocab_size=conf.vocab_size,
         states=cache,
         eos_id=conf.eos_id,
         gamma=conf.gamma,
         num_group=conf.num_group,
         top_k=conf.top_k,
     )
     return decoded_ids, scores