예제 #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
파일: s2s_model.py 프로젝트: sjx0451/QizNLP
 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