MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / ftt5_decoding

Function ftt5_decoding

examples/tensorflow/t5/utils/ft_decoding.py:212–245  ·  view source on GitHub ↗
(mem_hidden_states, mem_seq_len, decoding_params, max_seq_len, beam_width, top_k = 1, top_p = 0.0,
                    beam_search_diversity_rate = 0.0, temperature = 1.0, len_penalty = 0.0, repetition_penalty = 1.0,
                    random_seed = 0, return_cum_log_probs = False, return_output_log_probs = False)

Source from the content-addressed store, hash-verified

210 self.weights = tuple(weights)
211
212def ftt5_decoding(mem_hidden_states, mem_seq_len, decoding_params, max_seq_len, beam_width, top_k = 1, top_p = 0.0,
213 beam_search_diversity_rate = 0.0, temperature = 1.0, len_penalty = 0.0, repetition_penalty = 1.0,
214 random_seed = 0, return_cum_log_probs = False, return_output_log_probs = False):
215
216 outputs = transformer_op_module.t5_decoding(mem_hidden_states,
217 mem_seq_len,
218 *decoding_params.weights,
219 max_seq_len = max_seq_len,
220 beam_width = beam_width,
221 head_num = decoding_params.num_heads,
222 head_size = decoding_params.head_size,
223 inter_size = decoding_params.inter_size,
224 num_layer = decoding_params.num_layer,
225 d_model = decoding_params.d_model,
226 num_bucket = decoding_params.num_bucket,
227 max_distance = decoding_params.max_distance,
228 start_id = decoding_params.start_id,
229 end_id = decoding_params.end_id,
230 beam_search_diversity_rate = beam_search_diversity_rate,
231 top_k = top_k,
232 top_p = top_p,
233 temperature = temperature,
234 len_penalty = len_penalty,
235 repetition_penalty = repetition_penalty,
236 return_cum_log_probs = return_cum_log_probs,
237 return_output_log_probs = return_output_log_probs,
238 t5_with_bias = decoding_params.t5_with_bias,
239 activation_type = decoding_params.activation_type,
240 q_scaling = decoding_params.q_scaling,
241 position_embedding_type = decoding_params.position_embedding_type,
242 random_seed = random_seed,
243 tie_word_embeddings = decoding_params.tie_word_embeddings)
244
245 return outputs
246
247class FTT5Model():
248 def __init__(self, encoder_params, decoding_params):

Callers 1

computeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected