partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
T2TModel._beam_decode_slow
Slow version of Beam search decoding. Quadratic time in decode_length. Args: features: an map of string to `Tensor` decode_length: an integer. How many additional timesteps to decode. beam_size: number of beams. top_beams: an integer. How many of the beams to return. alpha: Floa...
tensor2tensor/utils/t2t_model.py
def _beam_decode_slow(self, features, decode_length, beam_size, top_beams, alpha, use_tpu=False): """Slow version of Beam search decoding. Quadratic time in decode_length. Args: features: an map of string to `Tensor` decode_length: an integer. How many additional times...
def _beam_decode_slow(self, features, decode_length, beam_size, top_beams, alpha, use_tpu=False): """Slow version of Beam search decoding. Quadratic time in decode_length. Args: features: an map of string to `Tensor` decode_length: an integer. How many additional times...
[ "Slow", "version", "of", "Beam", "search", "decoding", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/t2t_model.py#L845-L951
[ "def", "_beam_decode_slow", "(", "self", ",", "features", ",", "decode_length", ",", "beam_size", ",", "top_beams", ",", "alpha", ",", "use_tpu", "=", "False", ")", ":", "batch_size", "=", "common_layers", ".", "shape_list", "(", "features", "[", "\"inputs\"",...
272500b6efe353aeb638d2745ed56e519462ca31
train
T2TModel._greedy_infer
A greedy inference method. Models should ideally implement a more efficient version of this function. Args: features: an map of string to `Tensor` decode_length: an integer. How many additional timesteps to decode. use_tpu: A bool, whether to build the inference graph for TPU. Returns:...
tensor2tensor/utils/t2t_model.py
def _greedy_infer(self, features, decode_length, use_tpu=False): """A greedy inference method. Models should ideally implement a more efficient version of this function. Args: features: an map of string to `Tensor` decode_length: an integer. How many additional timesteps to decode. use_...
def _greedy_infer(self, features, decode_length, use_tpu=False): """A greedy inference method. Models should ideally implement a more efficient version of this function. Args: features: an map of string to `Tensor` decode_length: an integer. How many additional timesteps to decode. use_...
[ "A", "greedy", "inference", "method", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/t2t_model.py#L953-L975
[ "def", "_greedy_infer", "(", "self", ",", "features", ",", "decode_length", ",", "use_tpu", "=", "False", ")", ":", "if", "use_tpu", ":", "return", "self", ".", "_slow_greedy_infer_tpu", "(", "features", ",", "decode_length", ")", "return", "self", ".", "_sl...
272500b6efe353aeb638d2745ed56e519462ca31
train
T2TModel._slow_greedy_infer_tpu
A slow greedy inference method on TPU. Quadratic time in decode_length. Args: features: An map of string to `Tensor`. decode_length: An integer, how many additional timesteps to decode. Returns: A dict of decoding results { "outputs": integer `Tensor` of decoded ids of shape ...
tensor2tensor/utils/t2t_model.py
def _slow_greedy_infer_tpu(self, features, decode_length): """A slow greedy inference method on TPU. Quadratic time in decode_length. Args: features: An map of string to `Tensor`. decode_length: An integer, how many additional timesteps to decode. Returns: A dict of decoding results...
def _slow_greedy_infer_tpu(self, features, decode_length): """A slow greedy inference method on TPU. Quadratic time in decode_length. Args: features: An map of string to `Tensor`. decode_length: An integer, how many additional timesteps to decode. Returns: A dict of decoding results...
[ "A", "slow", "greedy", "inference", "method", "on", "TPU", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/t2t_model.py#L977-L1143
[ "def", "_slow_greedy_infer_tpu", "(", "self", ",", "features", ",", "decode_length", ")", ":", "if", "not", "features", ":", "features", "=", "{", "}", "inputs_old", "=", "None", "if", "\"inputs\"", "in", "features", "and", "len", "(", "features", "[", "\"...
272500b6efe353aeb638d2745ed56e519462ca31
train
T2TModel.sample
Run the model and extract samples. Args: features: an map of string to `Tensor`. Returns: samples: an integer `Tensor`. logits: a list of `Tensor`s, one per datashard. losses: a dictionary: {loss-name (string): floating point `Scalar`}.
tensor2tensor/utils/t2t_model.py
def sample(self, features): """Run the model and extract samples. Args: features: an map of string to `Tensor`. Returns: samples: an integer `Tensor`. logits: a list of `Tensor`s, one per datashard. losses: a dictionary: {loss-name (string): floating point `Scalar`}. """ ...
def sample(self, features): """Run the model and extract samples. Args: features: an map of string to `Tensor`. Returns: samples: an integer `Tensor`. logits: a list of `Tensor`s, one per datashard. losses: a dictionary: {loss-name (string): floating point `Scalar`}. """ ...
[ "Run", "the", "model", "and", "extract", "samples", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/t2t_model.py#L1326-L1355
[ "def", "sample", "(", "self", ",", "features", ")", ":", "logits", ",", "losses", "=", "self", "(", "features", ")", "# pylint: disable=not-callable", "if", "self", ".", "_target_modality_is_real", ":", "return", "logits", ",", "logits", ",", "losses", "# Raw ...
272500b6efe353aeb638d2745ed56e519462ca31
train
T2TModel.estimator_model_fn
Model fn for Estimator. Args: hparams: HParams, model hyperparameters features: dict<str name, Tensor feature> labels: Tensor mode: tf.estimator.ModeKeys config: RunConfig, possibly with data_parallelism attribute params: dict, may include batch_size, use_tpu decode_hparam...
tensor2tensor/utils/t2t_model.py
def estimator_model_fn(cls, hparams, features, labels, mode, config=None, params=None, decode_hparams=None, use_tpu=Fals...
def estimator_model_fn(cls, hparams, features, labels, mode, config=None, params=None, decode_hparams=None, use_tpu=Fals...
[ "Model", "fn", "for", "Estimator", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/t2t_model.py#L1418-L1538
[ "def", "estimator_model_fn", "(", "cls", ",", "hparams", ",", "features", ",", "labels", ",", "mode", ",", "config", "=", "None", ",", "params", "=", "None", ",", "decode_hparams", "=", "None", ",", "use_tpu", "=", "False", ")", ":", "if", "mode", "=="...
272500b6efe353aeb638d2745ed56e519462ca31
train
T2TModel.estimator_spec_train
Constructs `tf.estimator.EstimatorSpec` for TRAIN (training) mode.
tensor2tensor/utils/t2t_model.py
def estimator_spec_train(self, loss, num_async_replicas=1, use_tpu=False): """Constructs `tf.estimator.EstimatorSpec` for TRAIN (training) mode.""" train_op = self.optimize(loss, num_async_replicas=num_async_replicas, use_tpu=use_tpu) if use_tpu: if self._hparams.warm_sta...
def estimator_spec_train(self, loss, num_async_replicas=1, use_tpu=False): """Constructs `tf.estimator.EstimatorSpec` for TRAIN (training) mode.""" train_op = self.optimize(loss, num_async_replicas=num_async_replicas, use_tpu=use_tpu) if use_tpu: if self._hparams.warm_sta...
[ "Constructs", "tf", ".", "estimator", ".", "EstimatorSpec", "for", "TRAIN", "(", "training", ")", "mode", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/t2t_model.py#L1549-L1586
[ "def", "estimator_spec_train", "(", "self", ",", "loss", ",", "num_async_replicas", "=", "1", ",", "use_tpu", "=", "False", ")", ":", "train_op", "=", "self", ".", "optimize", "(", "loss", ",", "num_async_replicas", "=", "num_async_replicas", ",", "use_tpu", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
T2TModel.estimator_spec_eval
Constructs `tf.estimator.EstimatorSpec` for EVAL (evaluation) mode.
tensor2tensor/utils/t2t_model.py
def estimator_spec_eval(self, features, logits, labels, loss, losses_dict): """Constructs `tf.estimator.EstimatorSpec` for EVAL (evaluation) mode.""" del losses_dict hparams = self.hparams if not hasattr(hparams, "problem"): raise NotImplementedError(_no_problem_err("estimator_spec_eval")) p...
def estimator_spec_eval(self, features, logits, labels, loss, losses_dict): """Constructs `tf.estimator.EstimatorSpec` for EVAL (evaluation) mode.""" del losses_dict hparams = self.hparams if not hasattr(hparams, "problem"): raise NotImplementedError(_no_problem_err("estimator_spec_eval")) p...
[ "Constructs", "tf", ".", "estimator", ".", "EstimatorSpec", "for", "EVAL", "(", "evaluation", ")", "mode", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/t2t_model.py#L1588-L1679
[ "def", "estimator_spec_eval", "(", "self", ",", "features", ",", "logits", ",", "labels", ",", "loss", ",", "losses_dict", ")", ":", "del", "losses_dict", "hparams", "=", "self", ".", "hparams", "if", "not", "hasattr", "(", "hparams", ",", "\"problem\"", "...
272500b6efe353aeb638d2745ed56e519462ca31
train
T2TModel.estimator_spec_predict
Constructs `tf.estimator.EstimatorSpec` for PREDICT (inference) mode.
tensor2tensor/utils/t2t_model.py
def estimator_spec_predict(self, features, use_tpu=False): """Constructs `tf.estimator.EstimatorSpec` for PREDICT (inference) mode.""" decode_hparams = self._decode_hparams top_beams = decode_hparams.beam_size if decode_hparams.return_beams else 1 infer_out = self.infer( features, beam_s...
def estimator_spec_predict(self, features, use_tpu=False): """Constructs `tf.estimator.EstimatorSpec` for PREDICT (inference) mode.""" decode_hparams = self._decode_hparams top_beams = decode_hparams.beam_size if decode_hparams.return_beams else 1 infer_out = self.infer( features, beam_s...
[ "Constructs", "tf", ".", "estimator", ".", "EstimatorSpec", "for", "PREDICT", "(", "inference", ")", "mode", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/t2t_model.py#L1681-L1754
[ "def", "estimator_spec_predict", "(", "self", ",", "features", ",", "use_tpu", "=", "False", ")", ":", "decode_hparams", "=", "self", ".", "_decode_hparams", "top_beams", "=", "decode_hparams", ".", "beam_size", "if", "decode_hparams", ".", "return_beams", "else",...
272500b6efe353aeb638d2745ed56e519462ca31
train
T2TModel._summarize_losses
Adds `tf.summary`s to all terms in the losses dictionary.
tensor2tensor/utils/t2t_model.py
def _summarize_losses(self, losses_dict): """Adds `tf.summary`s to all terms in the losses dictionary.""" if common_layers.should_generate_summaries(): with tf.name_scope("losses"): for loss_name, loss_val in sorted(losses_dict.items()): tf.summary.scalar(loss_name, loss_val)
def _summarize_losses(self, losses_dict): """Adds `tf.summary`s to all terms in the losses dictionary.""" if common_layers.should_generate_summaries(): with tf.name_scope("losses"): for loss_name, loss_val in sorted(losses_dict.items()): tf.summary.scalar(loss_name, loss_val)
[ "Adds", "tf", ".", "summary", "s", "to", "all", "terms", "in", "the", "losses", "dictionary", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/t2t_model.py#L1771-L1776
[ "def", "_summarize_losses", "(", "self", ",", "losses_dict", ")", ":", "if", "common_layers", ".", "should_generate_summaries", "(", ")", ":", "with", "tf", ".", "name_scope", "(", "\"losses\"", ")", ":", "for", "loss_name", ",", "loss_val", "in", "sorted", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
T2TModel.maybe_scheduled_sampling
Scheduled sampling. Performs forward inference again with "targets" feature replaced with values sampled from the model. This is the identity unless self.hparams.scheduled_sampling_prob > 0 (default). **WARNING**: This is not a faithful implementation of scheduled sampling. This implementatio...
tensor2tensor/utils/t2t_model.py
def maybe_scheduled_sampling(self, features, logits, losses): """Scheduled sampling. Performs forward inference again with "targets" feature replaced with values sampled from the model. This is the identity unless self.hparams.scheduled_sampling_prob > 0 (default). **WARNING**: This is not a ...
def maybe_scheduled_sampling(self, features, logits, losses): """Scheduled sampling. Performs forward inference again with "targets" feature replaced with values sampled from the model. This is the identity unless self.hparams.scheduled_sampling_prob > 0 (default). **WARNING**: This is not a ...
[ "Scheduled", "sampling", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/t2t_model.py#L1778-L1901
[ "def", "maybe_scheduled_sampling", "(", "self", ",", "features", ",", "logits", ",", "losses", ")", ":", "hparams", "=", "self", ".", "hparams", "problem_hparams", "=", "self", ".", "_problem_hparams", "# Only do scheduled sampling if requested.", "if", "hparams", "...
272500b6efe353aeb638d2745ed56e519462ca31
train
attention_lm_moe_prepare_decoder
Prepare one shard of the model for the decoder. Args: targets: a Tensor. hparams: run hyperparameters Returns: decoder_input: a Tensor, bottom of decoder stack decoder_self_attention_bias: a Tensor, containing large negative values to implement masked attention and possibly biases for diagonal...
tensor2tensor/models/research/attention_lm_moe.py
def attention_lm_moe_prepare_decoder(targets, hparams): """Prepare one shard of the model for the decoder. Args: targets: a Tensor. hparams: run hyperparameters Returns: decoder_input: a Tensor, bottom of decoder stack decoder_self_attention_bias: a Tensor, containing large negative values t...
def attention_lm_moe_prepare_decoder(targets, hparams): """Prepare one shard of the model for the decoder. Args: targets: a Tensor. hparams: run hyperparameters Returns: decoder_input: a Tensor, bottom of decoder stack decoder_self_attention_bias: a Tensor, containing large negative values t...
[ "Prepare", "one", "shard", "of", "the", "model", "for", "the", "decoder", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/attention_lm_moe.py#L334-L364
[ "def", "attention_lm_moe_prepare_decoder", "(", "targets", ",", "hparams", ")", ":", "targets_pad_mask", "=", "common_attention", ".", "embedding_to_padding", "(", "targets", ")", "with", "tf", ".", "name_scope", "(", "\"pad_remover\"", ")", ":", "# Because of the shi...
272500b6efe353aeb638d2745ed56e519462ca31
train
get_batch_coordinate
Return a flat int32 tensor of shape [1, batch_size*length, 1].
tensor2tensor/models/research/attention_lm_moe.py
def get_batch_coordinate(x, axis=0): """Return a flat int32 tensor of shape [1, batch_size*length, 1].""" # Compute the batch coordinate before flattening all batches batch_coordinate = tf.expand_dims( common_attention.coordinate_tensor(tf.shape(x)[:-1], axis=axis), axis=-1) return batch_coordinate
def get_batch_coordinate(x, axis=0): """Return a flat int32 tensor of shape [1, batch_size*length, 1].""" # Compute the batch coordinate before flattening all batches batch_coordinate = tf.expand_dims( common_attention.coordinate_tensor(tf.shape(x)[:-1], axis=axis), axis=-1) return batch_coordinate
[ "Return", "a", "flat", "int32", "tensor", "of", "shape", "[", "1", "batch_size", "*", "length", "1", "]", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/attention_lm_moe.py#L368-L373
[ "def", "get_batch_coordinate", "(", "x", ",", "axis", "=", "0", ")", ":", "# Compute the batch coordinate before flattening all batches", "batch_coordinate", "=", "tf", ".", "expand_dims", "(", "common_attention", ".", "coordinate_tensor", "(", "tf", ".", "shape", "("...
272500b6efe353aeb638d2745ed56e519462ca31
train
expand_batch_coordinates
Duplicate elements of bc by length_factor. Args: bc (tf.Tensor): int32 tensor of shape [1, length, 1] length_factor (int): Returns: tf.Tensor: of shape [1, length*length_factor, 1] where every elements has been duplicated length_factor times.
tensor2tensor/models/research/attention_lm_moe.py
def expand_batch_coordinates(bc, length_factor): """Duplicate elements of bc by length_factor. Args: bc (tf.Tensor): int32 tensor of shape [1, length, 1] length_factor (int): Returns: tf.Tensor: of shape [1, length*length_factor, 1] where every elements has been duplicated length_factor times....
def expand_batch_coordinates(bc, length_factor): """Duplicate elements of bc by length_factor. Args: bc (tf.Tensor): int32 tensor of shape [1, length, 1] length_factor (int): Returns: tf.Tensor: of shape [1, length*length_factor, 1] where every elements has been duplicated length_factor times....
[ "Duplicate", "elements", "of", "bc", "by", "length_factor", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/attention_lm_moe.py#L377-L394
[ "def", "expand_batch_coordinates", "(", "bc", ",", "length_factor", ")", ":", "assert", "bc", ".", "get_shape", "(", ")", ".", "as_list", "(", ")", "==", "[", "1", ",", "None", ",", "1", "]", "# bc has shape [1, length, 1]", "bc", "*=", "tf", ".", "const...
272500b6efe353aeb638d2745ed56e519462ca31
train
remove_pad
Remove padding by concatenating all dimension into one. Args: x (tf.Tensor): input of shape [batch_size, length, depth] pad_remover (obj): a PadRemover object mode (ModeKeys): infer, train or eval. If inference, the padding remover is not applied Returns: tf.Tensor of shape [1,length_nonpad,...
tensor2tensor/models/research/attention_lm_moe.py
def remove_pad(x, pad_remover, mode): """Remove padding by concatenating all dimension into one. Args: x (tf.Tensor): input of shape [batch_size, length, depth] pad_remover (obj): a PadRemover object mode (ModeKeys): infer, train or eval. If inference, the padding remover is not applied Return...
def remove_pad(x, pad_remover, mode): """Remove padding by concatenating all dimension into one. Args: x (tf.Tensor): input of shape [batch_size, length, depth] pad_remover (obj): a PadRemover object mode (ModeKeys): infer, train or eval. If inference, the padding remover is not applied Return...
[ "Remove", "padding", "by", "concatenating", "all", "dimension", "into", "one", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/attention_lm_moe.py#L398-L422
[ "def", "remove_pad", "(", "x", ",", "pad_remover", ",", "mode", ")", ":", "# Concatenate all tokens (without padding)", "x", "=", "expert_utils", ".", "flatten_all_but_last", "(", "x", ")", "# Remove padding for training and eval", "if", "mode", "!=", "ModeKeys", ".",...
272500b6efe353aeb638d2745ed56e519462ca31
train
attention_lm_moe_base
Set of hyperparameters. suitable for 1 gpu. on lm1b_32k: ~229M params 0.9 steps/sec on [GeForce GTX TITAN X] Returns: a hparams object
tensor2tensor/models/research/attention_lm_moe.py
def attention_lm_moe_base(): """Set of hyperparameters. suitable for 1 gpu. on lm1b_32k: ~229M params 0.9 steps/sec on [GeForce GTX TITAN X] Returns: a hparams object """ hparams = common_hparams.basic_params1() hparams.hidden_size = 1024 hparams.batch_size = 8192 hparams.max_length =...
def attention_lm_moe_base(): """Set of hyperparameters. suitable for 1 gpu. on lm1b_32k: ~229M params 0.9 steps/sec on [GeForce GTX TITAN X] Returns: a hparams object """ hparams = common_hparams.basic_params1() hparams.hidden_size = 1024 hparams.batch_size = 8192 hparams.max_length =...
[ "Set", "of", "hyperparameters", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/attention_lm_moe.py#L435-L515
[ "def", "attention_lm_moe_base", "(", ")", ":", "hparams", "=", "common_hparams", ".", "basic_params1", "(", ")", "hparams", ".", "hidden_size", "=", "1024", "hparams", ".", "batch_size", "=", "8192", "hparams", ".", "max_length", "=", "256", "hparams", ".", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
attention_lm_moe_base_long_seq
Hyper parameters specifics for long sequence generation.
tensor2tensor/models/research/attention_lm_moe.py
def attention_lm_moe_base_long_seq(): """Hyper parameters specifics for long sequence generation.""" hparams = attention_lm_moe_base() hparams.max_length = 0 # max_length == batch_size hparams.eval_drop_long_sequences = True hparams.min_length_bucket = 256 # Avoid cyclic problems for big batches hparams....
def attention_lm_moe_base_long_seq(): """Hyper parameters specifics for long sequence generation.""" hparams = attention_lm_moe_base() hparams.max_length = 0 # max_length == batch_size hparams.eval_drop_long_sequences = True hparams.min_length_bucket = 256 # Avoid cyclic problems for big batches hparams....
[ "Hyper", "parameters", "specifics", "for", "long", "sequence", "generation", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/attention_lm_moe.py#L519-L528
[ "def", "attention_lm_moe_base_long_seq", "(", ")", ":", "hparams", "=", "attention_lm_moe_base", "(", ")", "hparams", ".", "max_length", "=", "0", "# max_length == batch_size", "hparams", ".", "eval_drop_long_sequences", "=", "True", "hparams", ".", "min_length_bucket",...
272500b6efe353aeb638d2745ed56e519462ca31
train
attention_lm_moe_base_ae
Base model with attention expert.
tensor2tensor/models/research/attention_lm_moe.py
def attention_lm_moe_base_ae(): """Base model with attention expert.""" hparams = attention_lm_moe_base_long_seq() hparams.attention_type = AttentionType.LOCAL_EXPERTS hparams.learning_rate = 0.05 hparams.learning_rate_warmup_steps = 10000 # According to noam, ("n", "da") seems better for harder-to-learn m...
def attention_lm_moe_base_ae(): """Base model with attention expert.""" hparams = attention_lm_moe_base_long_seq() hparams.attention_type = AttentionType.LOCAL_EXPERTS hparams.learning_rate = 0.05 hparams.learning_rate_warmup_steps = 10000 # According to noam, ("n", "da") seems better for harder-to-learn m...
[ "Base", "model", "with", "attention", "expert", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/attention_lm_moe.py#L532-L542
[ "def", "attention_lm_moe_base_ae", "(", ")", ":", "hparams", "=", "attention_lm_moe_base_long_seq", "(", ")", "hparams", ".", "attention_type", "=", "AttentionType", ".", "LOCAL_EXPERTS", "hparams", ".", "learning_rate", "=", "0.05", "hparams", ".", "learning_rate_war...
272500b6efe353aeb638d2745ed56e519462ca31
train
attention_lm_ae_extended
Experiment with the exp_factor params.
tensor2tensor/models/research/attention_lm_moe.py
def attention_lm_ae_extended(): """Experiment with the exp_factor params.""" hparams = attention_lm_moe_base_long_seq() hparams.attention_layers = "eeee" hparams.attention_local = True # hparams.factored_logits=1 # Necessary when the number of expert grow bigger hparams.attention_moe_k = 2 hparams.attent...
def attention_lm_ae_extended(): """Experiment with the exp_factor params.""" hparams = attention_lm_moe_base_long_seq() hparams.attention_layers = "eeee" hparams.attention_local = True # hparams.factored_logits=1 # Necessary when the number of expert grow bigger hparams.attention_moe_k = 2 hparams.attent...
[ "Experiment", "with", "the", "exp_factor", "params", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/attention_lm_moe.py#L599-L611
[ "def", "attention_lm_ae_extended", "(", ")", ":", "hparams", "=", "attention_lm_moe_base_long_seq", "(", ")", "hparams", ".", "attention_layers", "=", "\"eeee\"", "hparams", ".", "attention_local", "=", "True", "# hparams.factored_logits=1 # Necessary when the number of expe...
272500b6efe353aeb638d2745ed56e519462ca31
train
attention_lm_moe_base_memeff
Base model with attention expert.
tensor2tensor/models/research/attention_lm_moe.py
def attention_lm_moe_base_memeff(): """Base model with attention expert.""" hparams = attention_lm_moe_base_long_seq() hparams.use_sepconv = False hparams.diet_experts = True hparams.layer_preprocess_sequence = "n" hparams.layer_postprocess_sequence = "da" hparams.layer_prepostprocess_dropout = 0.0 hpa...
def attention_lm_moe_base_memeff(): """Base model with attention expert.""" hparams = attention_lm_moe_base_long_seq() hparams.use_sepconv = False hparams.diet_experts = True hparams.layer_preprocess_sequence = "n" hparams.layer_postprocess_sequence = "da" hparams.layer_prepostprocess_dropout = 0.0 hpa...
[ "Base", "model", "with", "attention", "expert", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/attention_lm_moe.py#L615-L628
[ "def", "attention_lm_moe_base_memeff", "(", ")", ":", "hparams", "=", "attention_lm_moe_base_long_seq", "(", ")", "hparams", ".", "use_sepconv", "=", "False", "hparams", ".", "diet_experts", "=", "True", "hparams", ".", "layer_preprocess_sequence", "=", "\"n\"", "hp...
272500b6efe353aeb638d2745ed56e519462ca31
train
attention_lm_moe_small
Cheap model for single-gpu training. on lm1b_32k: ~312M params 1.6 steps/sec on [GeForce GTX TITAN X] After 50K steps on 8 GPUs (synchronous): eval_log_ppl_per_token = 3.31 Returns: an hparams object.
tensor2tensor/models/research/attention_lm_moe.py
def attention_lm_moe_small(): """Cheap model for single-gpu training. on lm1b_32k: ~312M params 1.6 steps/sec on [GeForce GTX TITAN X] After 50K steps on 8 GPUs (synchronous): eval_log_ppl_per_token = 3.31 Returns: an hparams object. """ hparams = attention_lm_moe_base() hparam...
def attention_lm_moe_small(): """Cheap model for single-gpu training. on lm1b_32k: ~312M params 1.6 steps/sec on [GeForce GTX TITAN X] After 50K steps on 8 GPUs (synchronous): eval_log_ppl_per_token = 3.31 Returns: an hparams object. """ hparams = attention_lm_moe_base() hparam...
[ "Cheap", "model", "for", "single", "-", "gpu", "training", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/attention_lm_moe.py#L632-L650
[ "def", "attention_lm_moe_small", "(", ")", ":", "hparams", "=", "attention_lm_moe_base", "(", ")", "hparams", ".", "num_hidden_layers", "=", "4", "hparams", ".", "hidden_size", "=", "512", "hparams", ".", "filter_size", "=", "2048", "hparams", ".", "moe_num_expe...
272500b6efe353aeb638d2745ed56e519462ca31
train
attention_lm_attention_moe_tiny
Cheap model for debugging. Returns: an hparams object.
tensor2tensor/models/research/attention_lm_moe.py
def attention_lm_attention_moe_tiny(): """Cheap model for debugging. Returns: an hparams object. """ hparams = attention_lm_moe_small() hparams.moe_layers = "" hparams.attention_num_experts = 128 hparams.filter_size = 8192 hparams.attention_type = AttentionType.LOCAL_EXPERTS return hparams
def attention_lm_attention_moe_tiny(): """Cheap model for debugging. Returns: an hparams object. """ hparams = attention_lm_moe_small() hparams.moe_layers = "" hparams.attention_num_experts = 128 hparams.filter_size = 8192 hparams.attention_type = AttentionType.LOCAL_EXPERTS return hparams
[ "Cheap", "model", "for", "debugging", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/attention_lm_moe.py#L666-L677
[ "def", "attention_lm_attention_moe_tiny", "(", ")", ":", "hparams", "=", "attention_lm_moe_small", "(", ")", "hparams", ".", "moe_layers", "=", "\"\"", "hparams", ".", "attention_num_experts", "=", "128", "hparams", ".", "filter_size", "=", "8192", "hparams", ".",...
272500b6efe353aeb638d2745ed56e519462ca31
train
attention_lm_moe_large
Large model for distributed training. Over 1B parameters, so requires multi-gpu training due to memory requirements. on lm1b_32k: After 45K steps on 8 GPUs (synchronous): eval_log_ppl_per_token = 3.18 eval_ppl_per_word = exp(1.107893 * eval_log_ppl_per_token) = 33.9 Returns: an hpar...
tensor2tensor/models/research/attention_lm_moe.py
def attention_lm_moe_large(): """Large model for distributed training. Over 1B parameters, so requires multi-gpu training due to memory requirements. on lm1b_32k: After 45K steps on 8 GPUs (synchronous): eval_log_ppl_per_token = 3.18 eval_ppl_per_word = exp(1.107893 * eval_log_ppl_per_to...
def attention_lm_moe_large(): """Large model for distributed training. Over 1B parameters, so requires multi-gpu training due to memory requirements. on lm1b_32k: After 45K steps on 8 GPUs (synchronous): eval_log_ppl_per_token = 3.18 eval_ppl_per_word = exp(1.107893 * eval_log_ppl_per_to...
[ "Large", "model", "for", "distributed", "training", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/attention_lm_moe.py#L699-L722
[ "def", "attention_lm_moe_large", "(", ")", ":", "hparams", "=", "attention_lm_moe_base", "(", ")", "hparams", ".", "num_hidden_layers", "=", "5", "hparams", ".", "moe_layers", "=", "\"3\"", "hparams", ".", "hidden_size", "=", "1024", "hparams", ".", "num_heads",...
272500b6efe353aeb638d2745ed56e519462ca31
train
attention_lm_moe_memory_efficient
Memory-efficient version.
tensor2tensor/models/research/attention_lm_moe.py
def attention_lm_moe_memory_efficient(): """Memory-efficient version.""" hparams = attention_lm_moe_large() hparams.diet_experts = True hparams.layer_preprocess_sequence = "n" hparams.layer_postprocess_sequence = "da" hparams.layer_prepostprocess_dropout = 0.0 hparams.memory_efficient_ffn = True hparams...
def attention_lm_moe_memory_efficient(): """Memory-efficient version.""" hparams = attention_lm_moe_large() hparams.diet_experts = True hparams.layer_preprocess_sequence = "n" hparams.layer_postprocess_sequence = "da" hparams.layer_prepostprocess_dropout = 0.0 hparams.memory_efficient_ffn = True hparams...
[ "Memory", "-", "efficient", "version", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/attention_lm_moe.py#L733-L744
[ "def", "attention_lm_moe_memory_efficient", "(", ")", ":", "hparams", "=", "attention_lm_moe_large", "(", ")", "hparams", ".", "diet_experts", "=", "True", "hparams", ".", "layer_preprocess_sequence", "=", "\"n\"", "hparams", ".", "layer_postprocess_sequence", "=", "\...
272500b6efe353aeb638d2745ed56e519462ca31
train
attention_lm_moe_24b_diet
Unnecessarily large model with 24B params - because we can.
tensor2tensor/models/research/attention_lm_moe.py
def attention_lm_moe_24b_diet(): """Unnecessarily large model with 24B params - because we can.""" hparams = attention_lm_moe_large_diet() hparams.moe_hidden_sizes = "12288" hparams.moe_num_experts = 1024 hparams.batch_size = 4096 return hparams
def attention_lm_moe_24b_diet(): """Unnecessarily large model with 24B params - because we can.""" hparams = attention_lm_moe_large_diet() hparams.moe_hidden_sizes = "12288" hparams.moe_num_experts = 1024 hparams.batch_size = 4096 return hparams
[ "Unnecessarily", "large", "model", "with", "24B", "params", "-", "because", "we", "can", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/attention_lm_moe.py#L757-L763
[ "def", "attention_lm_moe_24b_diet", "(", ")", ":", "hparams", "=", "attention_lm_moe_large_diet", "(", ")", "hparams", ".", "moe_hidden_sizes", "=", "\"12288\"", "hparams", ".", "moe_num_experts", "=", "1024", "hparams", ".", "batch_size", "=", "4096", "return", "...
272500b6efe353aeb638d2745ed56e519462ca31
train
attention_lm_moe_translation
Version to use for seq2seq.
tensor2tensor/models/research/attention_lm_moe.py
def attention_lm_moe_translation(): """Version to use for seq2seq.""" hparams = attention_lm_moe_base() hparams.layer_preprocess_sequence = "n" hparams.layer_postprocess_sequence = "da" hparams.learning_rate = 0.4 hparams.prepend_mode = "prepend_inputs_masked_attention" hparams.max_length = 512 hparams....
def attention_lm_moe_translation(): """Version to use for seq2seq.""" hparams = attention_lm_moe_base() hparams.layer_preprocess_sequence = "n" hparams.layer_postprocess_sequence = "da" hparams.learning_rate = 0.4 hparams.prepend_mode = "prepend_inputs_masked_attention" hparams.max_length = 512 hparams....
[ "Version", "to", "use", "for", "seq2seq", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/attention_lm_moe.py#L767-L780
[ "def", "attention_lm_moe_translation", "(", ")", ":", "hparams", "=", "attention_lm_moe_base", "(", ")", "hparams", ".", "layer_preprocess_sequence", "=", "\"n\"", "hparams", ".", "layer_postprocess_sequence", "=", "\"da\"", "hparams", ".", "learning_rate", "=", "0.4"...
272500b6efe353aeb638d2745ed56e519462ca31
train
attention_lm_moe_unscramble_base
Version to use with languagemodel_wiki_scramble1k50.
tensor2tensor/models/research/attention_lm_moe.py
def attention_lm_moe_unscramble_base(): """Version to use with languagemodel_wiki_scramble1k50.""" hparams = attention_lm_no_moe_small() hparams.use_inputs = True hparams.min_length_bucket = 1024 hparams.max_length = 1024 hparams.batch_size = 5000 hparams.layer_prepostprocess_dropout = 0.0 hparams.layer...
def attention_lm_moe_unscramble_base(): """Version to use with languagemodel_wiki_scramble1k50.""" hparams = attention_lm_no_moe_small() hparams.use_inputs = True hparams.min_length_bucket = 1024 hparams.max_length = 1024 hparams.batch_size = 5000 hparams.layer_prepostprocess_dropout = 0.0 hparams.layer...
[ "Version", "to", "use", "with", "languagemodel_wiki_scramble1k50", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/attention_lm_moe.py#L784-L794
[ "def", "attention_lm_moe_unscramble_base", "(", ")", ":", "hparams", "=", "attention_lm_no_moe_small", "(", ")", "hparams", ".", "use_inputs", "=", "True", "hparams", ".", "min_length_bucket", "=", "1024", "hparams", ".", "max_length", "=", "1024", "hparams", ".",...
272500b6efe353aeb638d2745ed56e519462ca31
train
audio_bottom
Transform input from data space to model space. Args: x: A Tensor with shape [batch, ...] model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. Returns: body_input: A Tensor with shape [batch, ?, ?, model_hparams.hidden_size].
tensor2tensor/layers/modalities.py
def audio_bottom(x, model_hparams, vocab_size): """Transform input from data space to model space. Args: x: A Tensor with shape [batch, ...] model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. Returns: body_input: A Tensor with shape [batch, ?, ?, model_hparams....
def audio_bottom(x, model_hparams, vocab_size): """Transform input from data space to model space. Args: x: A Tensor with shape [batch, ...] model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. Returns: body_input: A Tensor with shape [batch, ?, ?, model_hparams....
[ "Transform", "input", "from", "data", "space", "to", "model", "space", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L128-L173
[ "def", "audio_bottom", "(", "x", ",", "model_hparams", ",", "vocab_size", ")", ":", "del", "vocab_size", "# unused arg", "inputs", "=", "x", "with", "tf", ".", "variable_scope", "(", "\"audio_modality\"", ")", ":", "# TODO(aidangomez): Will need to sort out a better a...
272500b6efe353aeb638d2745ed56e519462ca31
train
image_targets_bottom
Bottom transformation for target images.
tensor2tensor/layers/modalities.py
def image_targets_bottom(x, model_hparams, vocab_size): """Bottom transformation for target images.""" pixel_embedding_size = 64 inputs = x with tf.variable_scope("image_modality"): if not tf.executing_eagerly(): tf.summary.image( "targets_bottom", common_layers.tpu_safe_image_summ...
def image_targets_bottom(x, model_hparams, vocab_size): """Bottom transformation for target images.""" pixel_embedding_size = 64 inputs = x with tf.variable_scope("image_modality"): if not tf.executing_eagerly(): tf.summary.image( "targets_bottom", common_layers.tpu_safe_image_summ...
[ "Bottom", "transformation", "for", "target", "images", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L260-L288
[ "def", "image_targets_bottom", "(", "x", ",", "model_hparams", ",", "vocab_size", ")", ":", "pixel_embedding_size", "=", "64", "inputs", "=", "x", "with", "tf", ".", "variable_scope", "(", "\"image_modality\"", ")", ":", "if", "not", "tf", ".", "executing_eage...
272500b6efe353aeb638d2745ed56e519462ca31
train
_image_channel_compress_bottom
Compresses channel-wise input pixels into whole pixel representions. Perform conversion of RGB pixel values to a real number in the range -1 to 1. This combines pixel channels to form a representation of shape [img_len, img_len]. Args: inputs: Tensor representing RGB pixel intensities as integers, of shap...
tensor2tensor/layers/modalities.py
def _image_channel_compress_bottom(inputs, model_hparams, name="bottom"): """Compresses channel-wise input pixels into whole pixel representions. Perform conversion of RGB pixel values to a real number in the range -1 to 1. This combines pixel channels to form a representation of shape [img_len, img_len]. A...
def _image_channel_compress_bottom(inputs, model_hparams, name="bottom"): """Compresses channel-wise input pixels into whole pixel representions. Perform conversion of RGB pixel values to a real number in the range -1 to 1. This combines pixel channels to form a representation of shape [img_len, img_len]. A...
[ "Compresses", "channel", "-", "wise", "input", "pixels", "into", "whole", "pixel", "representions", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L291-L333
[ "def", "_image_channel_compress_bottom", "(", "inputs", ",", "model_hparams", ",", "name", "=", "\"bottom\"", ")", ":", "num_channels", "=", "3", "with", "tf", ".", "variable_scope", "(", "name", ")", ":", "inputs", "=", "tf", ".", "to_float", "(", "inputs",...
272500b6efe353aeb638d2745ed56e519462ca31
train
image_channel_embeddings_bottom
Bottom transformation for image targets.
tensor2tensor/layers/modalities.py
def image_channel_embeddings_bottom(x, model_hparams, vocab_size): """Bottom transformation for image targets.""" del vocab_size # unused arg inputs = tf.to_int32(x) io_depth = model_hparams.num_channels tshape = common_layers.shape_list(inputs) hidden_size = model_hparams.hidden_size target_embeddings =...
def image_channel_embeddings_bottom(x, model_hparams, vocab_size): """Bottom transformation for image targets.""" del vocab_size # unused arg inputs = tf.to_int32(x) io_depth = model_hparams.num_channels tshape = common_layers.shape_list(inputs) hidden_size = model_hparams.hidden_size target_embeddings =...
[ "Bottom", "transformation", "for", "image", "targets", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L346-L356
[ "def", "image_channel_embeddings_bottom", "(", "x", ",", "model_hparams", ",", "vocab_size", ")", ":", "del", "vocab_size", "# unused arg", "inputs", "=", "tf", ".", "to_int32", "(", "x", ")", "io_depth", "=", "model_hparams", ".", "num_channels", "tshape", "=",...
272500b6efe353aeb638d2745ed56e519462ca31
train
speech_recognition_bottom
Use batchnorm instead of CMVN and shorten the stft with strided convs. Args: x: float32 tensor with shape [batch_size, len, 1, freqs * channels] model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. Returns: float32 tensor with shape [batch_size, shorter_len, 1, hidden_si...
tensor2tensor/layers/modalities.py
def speech_recognition_bottom(x, model_hparams, vocab_size): """Use batchnorm instead of CMVN and shorten the stft with strided convs. Args: x: float32 tensor with shape [batch_size, len, 1, freqs * channels] model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. Returns: ...
def speech_recognition_bottom(x, model_hparams, vocab_size): """Use batchnorm instead of CMVN and shorten the stft with strided convs. Args: x: float32 tensor with shape [batch_size, len, 1, freqs * channels] model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. Returns: ...
[ "Use", "batchnorm", "instead", "of", "CMVN", "and", "shorten", "the", "stft", "with", "strided", "convs", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L373-L452
[ "def", "speech_recognition_bottom", "(", "x", ",", "model_hparams", ",", "vocab_size", ")", ":", "del", "vocab_size", "# unused arg", "inputs", "=", "x", "p", "=", "model_hparams", "num_mel_bins", "=", "p", ".", "audio_num_mel_bins", "num_channels", "=", "3", "i...
272500b6efe353aeb638d2745ed56e519462ca31
train
get_weights
Create or get concatenated embedding or softmax variable. Args: model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. hidden_dim: dim of the variable. Defaults to _model_hparams' hidden_size Returns: a list of num_shards Tensors.
tensor2tensor/layers/modalities.py
def get_weights(model_hparams, vocab_size, hidden_dim=None): """Create or get concatenated embedding or softmax variable. Args: model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. hidden_dim: dim of the variable. Defaults to _model_hparams' hidden_size Returns: a lis...
def get_weights(model_hparams, vocab_size, hidden_dim=None): """Create or get concatenated embedding or softmax variable. Args: model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. hidden_dim: dim of the variable. Defaults to _model_hparams' hidden_size Returns: a lis...
[ "Create", "or", "get", "concatenated", "embedding", "or", "softmax", "variable", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L455-L485
[ "def", "get_weights", "(", "model_hparams", ",", "vocab_size", ",", "hidden_dim", "=", "None", ")", ":", "if", "hidden_dim", "is", "None", ":", "hidden_dim", "=", "model_hparams", ".", "hidden_size", "num_shards", "=", "model_hparams", ".", "symbol_modality_num_sh...
272500b6efe353aeb638d2745ed56e519462ca31
train
_symbol_bottom_simple
Bottom transformation for symbols.
tensor2tensor/layers/modalities.py
def _symbol_bottom_simple(x, model_hparams, vocab_size, name, reuse): """Bottom transformation for symbols.""" with tf.variable_scope(name, reuse=reuse): # Ensure the inputs are 3-D if len(x.get_shape()) == 4: x = tf.squeeze(x, axis=3) while len(x.get_shape()) < 3: x = tf.expand_dims(x, axis...
def _symbol_bottom_simple(x, model_hparams, vocab_size, name, reuse): """Bottom transformation for symbols.""" with tf.variable_scope(name, reuse=reuse): # Ensure the inputs are 3-D if len(x.get_shape()) == 4: x = tf.squeeze(x, axis=3) while len(x.get_shape()) < 3: x = tf.expand_dims(x, axis...
[ "Bottom", "transformation", "for", "symbols", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L488-L505
[ "def", "_symbol_bottom_simple", "(", "x", ",", "model_hparams", ",", "vocab_size", ",", "name", ",", "reuse", ")", ":", "with", "tf", ".", "variable_scope", "(", "name", ",", "reuse", "=", "reuse", ")", ":", "# Ensure the inputs are 3-D", "if", "len", "(", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
symbol_targets_bottom
Bottom transformation for target symbols.
tensor2tensor/layers/modalities.py
def symbol_targets_bottom(x, model_hparams, vocab_size): """Bottom transformation for target symbols.""" if (model_hparams.shared_embedding_and_softmax_weights or model_hparams.get("shared_embedding")): try: return _symbol_bottom_simple( x, model_hparams, vocab_size, "shared", reuse=True) ...
def symbol_targets_bottom(x, model_hparams, vocab_size): """Bottom transformation for target symbols.""" if (model_hparams.shared_embedding_and_softmax_weights or model_hparams.get("shared_embedding")): try: return _symbol_bottom_simple( x, model_hparams, vocab_size, "shared", reuse=True) ...
[ "Bottom", "transformation", "for", "target", "symbols", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L517-L530
[ "def", "symbol_targets_bottom", "(", "x", ",", "model_hparams", ",", "vocab_size", ")", ":", "if", "(", "model_hparams", ".", "shared_embedding_and_softmax_weights", "or", "model_hparams", ".", "get", "(", "\"shared_embedding\"", ")", ")", ":", "try", ":", "return...
272500b6efe353aeb638d2745ed56e519462ca31
train
video_bitwise_bottom
Bottom transformation for embedding video bitwise.
tensor2tensor/layers/modalities.py
def video_bitwise_bottom(x, model_hparams, vocab_size): """Bottom transformation for embedding video bitwise.""" pixel_embedding_size = 64 inputs = x with tf.variable_scope("video_modality_bitwise", reuse=tf.AUTO_REUSE): common_layers.summarize_video(inputs, "bottom") # Embed bitwise. assert vocab_s...
def video_bitwise_bottom(x, model_hparams, vocab_size): """Bottom transformation for embedding video bitwise.""" pixel_embedding_size = 64 inputs = x with tf.variable_scope("video_modality_bitwise", reuse=tf.AUTO_REUSE): common_layers.summarize_video(inputs, "bottom") # Embed bitwise. assert vocab_s...
[ "Bottom", "transformation", "for", "embedding", "video", "bitwise", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L552-L566
[ "def", "video_bitwise_bottom", "(", "x", ",", "model_hparams", ",", "vocab_size", ")", ":", "pixel_embedding_size", "=", "64", "inputs", "=", "x", "with", "tf", ".", "variable_scope", "(", "\"video_modality_bitwise\"", ",", "reuse", "=", "tf", ".", "AUTO_REUSE",...
272500b6efe353aeb638d2745ed56e519462ca31
train
video_pixel_noise_bottom
Bottom transformation for video.
tensor2tensor/layers/modalities.py
def video_pixel_noise_bottom(x, model_hparams, vocab_size): """Bottom transformation for video.""" input_noise = getattr(model_hparams, "video_modality_input_noise", 0.25) inputs = x if model_hparams.mode == tf.estimator.ModeKeys.TRAIN: background = tfp.stats.percentile(inputs, 50., axis=[0, 1, 2, 3]) i...
def video_pixel_noise_bottom(x, model_hparams, vocab_size): """Bottom transformation for video.""" input_noise = getattr(model_hparams, "video_modality_input_noise", 0.25) inputs = x if model_hparams.mode == tf.estimator.ModeKeys.TRAIN: background = tfp.stats.percentile(inputs, 50., axis=[0, 1, 2, 3]) i...
[ "Bottom", "transformation", "for", "video", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L599-L612
[ "def", "video_pixel_noise_bottom", "(", "x", ",", "model_hparams", ",", "vocab_size", ")", ":", "input_noise", "=", "getattr", "(", "model_hparams", ",", "\"video_modality_input_noise\"", ",", "0.25", ")", "inputs", "=", "x", "if", "model_hparams", ".", "mode", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
convert_rgb_to_real
Convert prediction and target from rgb to real.
tensor2tensor/layers/modalities.py
def convert_rgb_to_real(prediction, targets): """Convert prediction and target from rgb to real.""" prediction = tf.squeeze(prediction, axis=-1) prediction = common_layers.convert_rgb_to_real(prediction) targets = common_layers.convert_rgb_to_real(targets) return prediction, targets
def convert_rgb_to_real(prediction, targets): """Convert prediction and target from rgb to real.""" prediction = tf.squeeze(prediction, axis=-1) prediction = common_layers.convert_rgb_to_real(prediction) targets = common_layers.convert_rgb_to_real(targets) return prediction, targets
[ "Convert", "prediction", "and", "target", "from", "rgb", "to", "real", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L615-L620
[ "def", "convert_rgb_to_real", "(", "prediction", ",", "targets", ")", ":", "prediction", "=", "tf", ".", "squeeze", "(", "prediction", ",", "axis", "=", "-", "1", ")", "prediction", "=", "common_layers", ".", "convert_rgb_to_real", "(", "prediction", ")", "t...
272500b6efe353aeb638d2745ed56e519462ca31
train
ctc_symbol_loss
Compute the CTC loss.
tensor2tensor/layers/modalities.py
def ctc_symbol_loss(top_out, targets, model_hparams, vocab_size, weight_fn): """Compute the CTC loss.""" del model_hparams, vocab_size # unused arg logits = top_out with tf.name_scope("ctc_loss", values=[logits, targets]): # For CTC we assume targets are 1d, [batch, length, 1, 1] here. targets_shape = ...
def ctc_symbol_loss(top_out, targets, model_hparams, vocab_size, weight_fn): """Compute the CTC loss.""" del model_hparams, vocab_size # unused arg logits = top_out with tf.name_scope("ctc_loss", values=[logits, targets]): # For CTC we assume targets are 1d, [batch, length, 1, 1] here. targets_shape = ...
[ "Compute", "the", "CTC", "loss", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L638-L662
[ "def", "ctc_symbol_loss", "(", "top_out", ",", "targets", ",", "model_hparams", ",", "vocab_size", ",", "weight_fn", ")", ":", "del", "model_hparams", ",", "vocab_size", "# unused arg", "logits", "=", "top_out", "with", "tf", ".", "name_scope", "(", "\"ctc_loss\...
272500b6efe353aeb638d2745ed56e519462ca31
train
generic_loss
Compute loss numerator and denominator for one shard of output.
tensor2tensor/layers/modalities.py
def generic_loss(top_out, targets, model_hparams, vocab_size, weights_fn): """Compute loss numerator and denominator for one shard of output.""" del vocab_size # unused arg logits = top_out logits = common_attention.maybe_upcast(logits, hparams=model_hparams) cutoff = getattr(model_hparams, "video_modality_l...
def generic_loss(top_out, targets, model_hparams, vocab_size, weights_fn): """Compute loss numerator and denominator for one shard of output.""" del vocab_size # unused arg logits = top_out logits = common_attention.maybe_upcast(logits, hparams=model_hparams) cutoff = getattr(model_hparams, "video_modality_l...
[ "Compute", "loss", "numerator", "and", "denominator", "for", "one", "shard", "of", "output", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L665-L676
[ "def", "generic_loss", "(", "top_out", ",", "targets", ",", "model_hparams", ",", "vocab_size", ",", "weights_fn", ")", ":", "del", "vocab_size", "# unused arg", "logits", "=", "top_out", "logits", "=", "common_attention", ".", "maybe_upcast", "(", "logits", ","...
272500b6efe353aeb638d2745ed56e519462ca31
train
multi_label_loss
Average loss over the labels.
tensor2tensor/layers/modalities.py
def multi_label_loss(top_out, targets, model_hparams, vocab_size, weights_fn): """Average loss over the labels.""" del vocab_size # unused arg logits = top_out num_labels = tf.shape(targets)[1] logits = tf.tile(logits, [1, num_labels, 1, 1, 1]) xent, weights = common_layers.padded_cross_entropy( log...
def multi_label_loss(top_out, targets, model_hparams, vocab_size, weights_fn): """Average loss over the labels.""" del vocab_size # unused arg logits = top_out num_labels = tf.shape(targets)[1] logits = tf.tile(logits, [1, num_labels, 1, 1, 1]) xent, weights = common_layers.padded_cross_entropy( log...
[ "Average", "loss", "over", "the", "labels", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L689-L711
[ "def", "multi_label_loss", "(", "top_out", ",", "targets", ",", "model_hparams", ",", "vocab_size", ",", "weights_fn", ")", ":", "del", "vocab_size", "# unused arg", "logits", "=", "top_out", "num_labels", "=", "tf", ".", "shape", "(", "targets", ")", "[", "...
272500b6efe353aeb638d2745ed56e519462ca31
train
one_hot_class_label_loss
Apply softmax cross-entropy between outputs and targets. Args: top_out: logits Tensor with shape [batch, ?, ?, num_classes] targets: one-hot encoding Tensor with shape [batch, ?, ?, num_classes] model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. weights_fn: Returns...
tensor2tensor/layers/modalities.py
def one_hot_class_label_loss(top_out, targets, model_hparams, vocab_size, weights_fn): """Apply softmax cross-entropy between outputs and targets. Args: top_out: logits Tensor with shape [batch, ...
def one_hot_class_label_loss(top_out, targets, model_hparams, vocab_size, weights_fn): """Apply softmax cross-entropy between outputs and targets. Args: top_out: logits Tensor with shape [batch, ...
[ "Apply", "softmax", "cross", "-", "entropy", "between", "outputs", "and", "targets", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L714-L736
[ "def", "one_hot_class_label_loss", "(", "top_out", ",", "targets", ",", "model_hparams", ",", "vocab_size", ",", "weights_fn", ")", ":", "del", "model_hparams", ",", "vocab_size", "# unused arg", "loss_scale", "=", "tf", ".", "losses", ".", "softmax_cross_entropy", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
real_log_poisson_loss
Poisson loss for real.
tensor2tensor/layers/modalities.py
def real_log_poisson_loss(top_out, targets, model_hparams, vocab_size, weights_fn): """Poisson loss for real.""" del model_hparams, vocab_size # unused arg predictions = top_out if (len(common_layers.shape_l...
def real_log_poisson_loss(top_out, targets, model_hparams, vocab_size, weights_fn): """Poisson loss for real.""" del model_hparams, vocab_size # unused arg predictions = top_out if (len(common_layers.shape_l...
[ "Poisson", "loss", "for", "real", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L751-L765
[ "def", "real_log_poisson_loss", "(", "top_out", ",", "targets", ",", "model_hparams", ",", "vocab_size", ",", "weights_fn", ")", ":", "del", "model_hparams", ",", "vocab_size", "# unused arg", "predictions", "=", "top_out", "if", "(", "len", "(", "common_layers", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
sigmoid_class_label_loss
Loss for class label.
tensor2tensor/layers/modalities.py
def sigmoid_class_label_loss(top_out, targets, model_hparams, vocab_size, weights_fn): """Loss for class label.""" # Expect inputs of size [batch-size, timesteps, 1, num-classes], where the # last d...
def sigmoid_class_label_loss(top_out, targets, model_hparams, vocab_size, weights_fn): """Loss for class label.""" # Expect inputs of size [batch-size, timesteps, 1, num-classes], where the # last d...
[ "Loss", "for", "class", "label", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L768-L781
[ "def", "sigmoid_class_label_loss", "(", "top_out", ",", "targets", ",", "model_hparams", ",", "vocab_size", ",", "weights_fn", ")", ":", "# Expect inputs of size [batch-size, timesteps, 1, num-classes], where the", "# last dimension of num-classes represents logits for binary labels", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
video_loss
Compute loss numerator and denominator for one shard of output.
tensor2tensor/layers/modalities.py
def video_loss(top_out, targets, model_hparams, vocab_size, weights_fn): """Compute loss numerator and denominator for one shard of output.""" del vocab_size # unused arg logits = top_out logits = tf.reshape(logits, [-1] + common_layers.shape_list(logits)[2:]) targets = tf.reshape(targets, [-1] + common_laye...
def video_loss(top_out, targets, model_hparams, vocab_size, weights_fn): """Compute loss numerator and denominator for one shard of output.""" del vocab_size # unused arg logits = top_out logits = tf.reshape(logits, [-1] + common_layers.shape_list(logits)[2:]) targets = tf.reshape(targets, [-1] + common_laye...
[ "Compute", "loss", "numerator", "and", "denominator", "for", "one", "shard", "of", "output", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L812-L824
[ "def", "video_loss", "(", "top_out", ",", "targets", ",", "model_hparams", ",", "vocab_size", ",", "weights_fn", ")", ":", "del", "vocab_size", "# unused arg", "logits", "=", "top_out", "logits", "=", "tf", ".", "reshape", "(", "logits", ",", "[", "-", "1"...
272500b6efe353aeb638d2745ed56e519462ca31
train
video_l1_loss
Compute loss numerator and denominator for one shard of output.
tensor2tensor/layers/modalities.py
def video_l1_loss(top_out, targets, model_hparams, vocab_size, weights_fn): """Compute loss numerator and denominator for one shard of output.""" del vocab_size # unused arg logits = top_out logits = tf.reshape(logits, [-1] + common_layers.shape_list(logits)[2:-1]) targets = tf.reshape(targets, [-1] + common...
def video_l1_loss(top_out, targets, model_hparams, vocab_size, weights_fn): """Compute loss numerator and denominator for one shard of output.""" del vocab_size # unused arg logits = top_out logits = tf.reshape(logits, [-1] + common_layers.shape_list(logits)[2:-1]) targets = tf.reshape(targets, [-1] + common...
[ "Compute", "loss", "numerator", "and", "denominator", "for", "one", "shard", "of", "output", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L852-L865
[ "def", "video_l1_loss", "(", "top_out", ",", "targets", ",", "model_hparams", ",", "vocab_size", ",", "weights_fn", ")", ":", "del", "vocab_size", "# unused arg", "logits", "=", "top_out", "logits", "=", "tf", ".", "reshape", "(", "logits", ",", "[", "-", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
video_l2_loss
Compute loss numerator and denominator for one shard of output.
tensor2tensor/layers/modalities.py
def video_l2_loss(top_out, targets, model_hparams, vocab_size, weights_fn): """Compute loss numerator and denominator for one shard of output.""" del vocab_size # unused arg logits = top_out logits = tf.reshape(logits, [-1] + common_layers.shape_list(logits)[2:-1]) targets = tf.reshape(targets, [-1] + common...
def video_l2_loss(top_out, targets, model_hparams, vocab_size, weights_fn): """Compute loss numerator and denominator for one shard of output.""" del vocab_size # unused arg logits = top_out logits = tf.reshape(logits, [-1] + common_layers.shape_list(logits)[2:-1]) targets = tf.reshape(targets, [-1] + common...
[ "Compute", "loss", "numerator", "and", "denominator", "for", "one", "shard", "of", "output", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L874-L887
[ "def", "video_l2_loss", "(", "top_out", ",", "targets", ",", "model_hparams", ",", "vocab_size", ",", "weights_fn", ")", ":", "del", "vocab_size", "# unused arg", "logits", "=", "top_out", "logits", "=", "tf", ".", "reshape", "(", "logits", ",", "[", "-", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
class_label_top
Transform inputs from model space to target space. Average over inner dims and a linear layer to logits. Args: body_output: A Tensor with shape [batch, ?, ?, body_output_size]. targets: model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. Returns: a Tensors, each ...
tensor2tensor/layers/modalities.py
def class_label_top(body_output, targets, model_hparams, vocab_size): """Transform inputs from model space to target space. Average over inner dims and a linear layer to logits. Args: body_output: A Tensor with shape [batch, ?, ?, body_output_size]. targets: model_hparams: HParams, model hyperparmet...
def class_label_top(body_output, targets, model_hparams, vocab_size): """Transform inputs from model space to target space. Average over inner dims and a linear layer to logits. Args: body_output: A Tensor with shape [batch, ?, ?, body_output_size]. targets: model_hparams: HParams, model hyperparmet...
[ "Transform", "inputs", "from", "model", "space", "to", "target", "space", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L927-L947
[ "def", "class_label_top", "(", "body_output", ",", "targets", ",", "model_hparams", ",", "vocab_size", ")", ":", "del", "targets", "# unused arg", "with", "tf", ".", "variable_scope", "(", "\"class_label_modality_%d_%d\"", "%", "(", "vocab_size", ",", "model_hparams...
272500b6efe353aeb638d2745ed56e519462ca31
train
image_top
Top transformation for images.
tensor2tensor/layers/modalities.py
def image_top(body_output, targets, model_hparams, vocab_size): """Top transformation for images.""" del targets # unused arg # TODO(lukaszkaiser): is this a universal enough way to get channels? num_channels = model_hparams.problem.num_channels with tf.variable_scope("rgb_softmax"): body_output_shape = ...
def image_top(body_output, targets, model_hparams, vocab_size): """Top transformation for images.""" del targets # unused arg # TODO(lukaszkaiser): is this a universal enough way to get channels? num_channels = model_hparams.problem.num_channels with tf.variable_scope("rgb_softmax"): body_output_shape = ...
[ "Top", "transformation", "for", "images", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L955-L972
[ "def", "image_top", "(", "body_output", ",", "targets", ",", "model_hparams", ",", "vocab_size", ")", ":", "del", "targets", "# unused arg", "# TODO(lukaszkaiser): is this a universal enough way to get channels?", "num_channels", "=", "model_hparams", ".", "problem", ".", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
image_channel_compress_top
Transforms body output to return logits. Args: body_output: Tensor of shape [batch, img_len, img_len, depth]. targets: model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. Returns: Tensor of shape [batch, img_len, img_len, channels, vocab_size].
tensor2tensor/layers/modalities.py
def image_channel_compress_top(body_output, targets, model_hparams, vocab_size): """Transforms body output to return logits. Args: body_output: Tensor of shape [batch, img_len, img_len, depth]. targets: model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. Returns: ...
def image_channel_compress_top(body_output, targets, model_hparams, vocab_size): """Transforms body output to return logits. Args: body_output: Tensor of shape [batch, img_len, img_len, depth]. targets: model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. Returns: ...
[ "Transforms", "body", "output", "to", "return", "logits", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L975-L1010
[ "def", "image_channel_compress_top", "(", "body_output", ",", "targets", ",", "model_hparams", ",", "vocab_size", ")", ":", "del", "targets", "# unused arg", "with", "tf", ".", "variable_scope", "(", "\"image_channel_compress_modality\"", ")", ":", "hidden_size", "=",...
272500b6efe353aeb638d2745ed56e519462ca31
train
image_channel_embeddings_top
Top transformation for images.
tensor2tensor/layers/modalities.py
def image_channel_embeddings_top(body_output, targets, model_hparams, vocab_size): """Top transformation for images.""" del targets # unused arg with tf.variable_scope("image_channel_embeddings_bottom"): img_le...
def image_channel_embeddings_top(body_output, targets, model_hparams, vocab_size): """Top transformation for images.""" del targets # unused arg with tf.variable_scope("image_channel_embeddings_bottom"): img_le...
[ "Top", "transformation", "for", "images", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L1013-L1026
[ "def", "image_channel_embeddings_top", "(", "body_output", ",", "targets", ",", "model_hparams", ",", "vocab_size", ")", ":", "del", "targets", "# unused arg", "with", "tf", ".", "variable_scope", "(", "\"image_channel_embeddings_bottom\"", ")", ":", "img_len", "=", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
softmax_average_pooling_class_label_top
Loss for class label.
tensor2tensor/layers/modalities.py
def softmax_average_pooling_class_label_top(body_output, targets, model_hparams, vocab_size): """Loss for class label.""" del targets # unused arg with tf.variable_scope( "sof...
def softmax_average_pooling_class_label_top(body_output, targets, model_hparams, vocab_size): """Loss for class label.""" del targets # unused arg with tf.variable_scope( "sof...
[ "Loss", "for", "class", "label", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L1062-L1073
[ "def", "softmax_average_pooling_class_label_top", "(", "body_output", ",", "targets", ",", "model_hparams", ",", "vocab_size", ")", ":", "del", "targets", "# unused arg", "with", "tf", ".", "variable_scope", "(", "\"softmax_average_pooling_onehot_class_label_modality_%d_%d\""...
272500b6efe353aeb638d2745ed56e519462ca31
train
softmax_last_timestep_class_label_top
Loss for class label.
tensor2tensor/layers/modalities.py
def softmax_last_timestep_class_label_top(body_output, targets, model_hparams, vocab_size): """Loss for class label.""" del targets # unused arg with tf.variable_scope( "softmax_las...
def softmax_last_timestep_class_label_top(body_output, targets, model_hparams, vocab_size): """Loss for class label.""" del targets # unused arg with tf.variable_scope( "softmax_las...
[ "Loss", "for", "class", "label", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L1076-L1087
[ "def", "softmax_last_timestep_class_label_top", "(", "body_output", ",", "targets", ",", "model_hparams", ",", "vocab_size", ")", ":", "del", "targets", "# unused arg", "with", "tf", ".", "variable_scope", "(", "\"softmax_last_timestep_onehot_class_label_modality_%d_%d\"", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
softmax_max_pooling_class_label_top
Loss for class label.
tensor2tensor/layers/modalities.py
def softmax_max_pooling_class_label_top(body_output, targets, model_hparams, vocab_size): """Loss for class label.""" del targets # unused arg with tf.variable_scope( "softmax_max_pooling...
def softmax_max_pooling_class_label_top(body_output, targets, model_hparams, vocab_size): """Loss for class label.""" del targets # unused arg with tf.variable_scope( "softmax_max_pooling...
[ "Loss", "for", "class", "label", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L1090-L1101
[ "def", "softmax_max_pooling_class_label_top", "(", "body_output", ",", "targets", ",", "model_hparams", ",", "vocab_size", ")", ":", "del", "targets", "# unused arg", "with", "tf", ".", "variable_scope", "(", "\"softmax_max_pooling_onehot_class_label_modality_%d_%d\"", "%",...
272500b6efe353aeb638d2745ed56e519462ca31
train
symbol_top
Generate logits. Args: body_output: A Tensor with shape [batch, p0, p1, model_hparams.hidden_size]. targets: Unused. model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. Returns: logits: A Tensor with shape [batch, p0, p1, ?, vocab_size].
tensor2tensor/layers/modalities.py
def symbol_top(body_output, targets, model_hparams, vocab_size): """Generate logits. Args: body_output: A Tensor with shape [batch, p0, p1, model_hparams.hidden_size]. targets: Unused. model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. Returns: logits: A Te...
def symbol_top(body_output, targets, model_hparams, vocab_size): """Generate logits. Args: body_output: A Tensor with shape [batch, p0, p1, model_hparams.hidden_size]. targets: Unused. model_hparams: HParams, model hyperparmeters. vocab_size: int, vocabulary size. Returns: logits: A Te...
[ "Generate", "logits", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L1105-L1137
[ "def", "symbol_top", "(", "body_output", ",", "targets", ",", "model_hparams", ",", "vocab_size", ")", ":", "del", "targets", "# unused arg", "if", "model_hparams", ".", "shared_embedding_and_softmax_weights", ":", "scope_name", "=", "\"shared\"", "reuse", "=", "tf"...
272500b6efe353aeb638d2745ed56e519462ca31
train
video_top
Top transformation for video.
tensor2tensor/layers/modalities.py
def video_top(body_output, targets, model_hparams, vocab_size): """Top transformation for video.""" del targets # unused arg num_channels = model_hparams.problem.num_channels shape = common_layers.shape_list(body_output) reshape_shape = shape[:-1] + [num_channels, vocab_size] res = tf.reshape(body_output, ...
def video_top(body_output, targets, model_hparams, vocab_size): """Top transformation for video.""" del targets # unused arg num_channels = model_hparams.problem.num_channels shape = common_layers.shape_list(body_output) reshape_shape = shape[:-1] + [num_channels, vocab_size] res = tf.reshape(body_output, ...
[ "Top", "transformation", "for", "video", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L1146-L1157
[ "def", "video_top", "(", "body_output", ",", "targets", ",", "model_hparams", ",", "vocab_size", ")", ":", "del", "targets", "# unused arg", "num_channels", "=", "model_hparams", ".", "problem", ".", "num_channels", "shape", "=", "common_layers", ".", "shape_list"...
272500b6efe353aeb638d2745ed56e519462ca31
train
video_l1_top
Top transformation for video.
tensor2tensor/layers/modalities.py
def video_l1_top(body_output, targets, model_hparams, vocab_size): """Top transformation for video.""" del targets, vocab_size # unused arg num_channels = model_hparams.problem.num_channels num_frames = model_hparams.video_num_target_frames with tf.variable_scope("rgb"): body_output_shape = common_layers...
def video_l1_top(body_output, targets, model_hparams, vocab_size): """Top transformation for video.""" del targets, vocab_size # unused arg num_channels = model_hparams.problem.num_channels num_frames = model_hparams.video_num_target_frames with tf.variable_scope("rgb"): body_output_shape = common_layers...
[ "Top", "transformation", "for", "video", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L1160-L1176
[ "def", "video_l1_top", "(", "body_output", ",", "targets", ",", "model_hparams", ",", "vocab_size", ")", ":", "del", "targets", ",", "vocab_size", "# unused arg", "num_channels", "=", "model_hparams", ".", "problem", ".", "num_channels", "num_frames", "=", "model_...
272500b6efe353aeb638d2745ed56e519462ca31
train
get_bottom
Gets default bottom transformation; if none available, return value.
tensor2tensor/layers/modalities.py
def get_bottom(modality_type, value=None): """Gets default bottom transformation; if none available, return value.""" if modality_type == ModalityType.AUDIO: return audio_bottom elif modality_type == ModalityType.AUDIO_SPECTRAL: return audio_spectral_bottom elif modality_type in (ModalityType.CLASS_LABE...
def get_bottom(modality_type, value=None): """Gets default bottom transformation; if none available, return value.""" if modality_type == ModalityType.AUDIO: return audio_bottom elif modality_type == ModalityType.AUDIO_SPECTRAL: return audio_spectral_bottom elif modality_type in (ModalityType.CLASS_LABE...
[ "Gets", "default", "bottom", "transformation", ";", "if", "none", "available", "return", "value", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L1192-L1242
[ "def", "get_bottom", "(", "modality_type", ",", "value", "=", "None", ")", ":", "if", "modality_type", "==", "ModalityType", ".", "AUDIO", ":", "return", "audio_bottom", "elif", "modality_type", "==", "ModalityType", ".", "AUDIO_SPECTRAL", ":", "return", "audio_...
272500b6efe353aeb638d2745ed56e519462ca31
train
get_loss
Gets default loss transformation; if none available, return value.
tensor2tensor/layers/modalities.py
def get_loss(modality_type, value=None): """Gets default loss transformation; if none available, return value.""" if modality_type in (ModalityType.AUDIO, ModalityType.AUDIO_SPECTRAL, ModalityType.CLASS_LABEL, ModalityType.IDENTITY, ...
def get_loss(modality_type, value=None): """Gets default loss transformation; if none available, return value.""" if modality_type in (ModalityType.AUDIO, ModalityType.AUDIO_SPECTRAL, ModalityType.CLASS_LABEL, ModalityType.IDENTITY, ...
[ "Gets", "default", "loss", "transformation", ";", "if", "none", "available", "return", "value", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L1245-L1296
[ "def", "get_loss", "(", "modality_type", ",", "value", "=", "None", ")", ":", "if", "modality_type", "in", "(", "ModalityType", ".", "AUDIO", ",", "ModalityType", ".", "AUDIO_SPECTRAL", ",", "ModalityType", ".", "CLASS_LABEL", ",", "ModalityType", ".", "IDENTI...
272500b6efe353aeb638d2745ed56e519462ca31
train
get_name
Gets default name for transformations; if none available, return value.
tensor2tensor/layers/modalities.py
def get_name(modality_type, value=None): """Gets default name for transformations; if none available, return value.""" # For legacy reasons, modalities vary in their naming scheme. Future plans are # to remove any need for get_name. We do not recommend using it. if modality_type == ModalityType.AUDIO: retur...
def get_name(modality_type, value=None): """Gets default name for transformations; if none available, return value.""" # For legacy reasons, modalities vary in their naming scheme. Future plans are # to remove any need for get_name. We do not recommend using it. if modality_type == ModalityType.AUDIO: retur...
[ "Gets", "default", "name", "for", "transformations", ";", "if", "none", "available", "return", "value", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L1299-L1384
[ "def", "get_name", "(", "modality_type", ",", "value", "=", "None", ")", ":", "# For legacy reasons, modalities vary in their naming scheme. Future plans are", "# to remove any need for get_name. We do not recommend using it.", "if", "modality_type", "==", "ModalityType", ".", "AUD...
272500b6efe353aeb638d2745ed56e519462ca31
train
get_targets_bottom
Gets default bottom transformation for targets; if none, return value.
tensor2tensor/layers/modalities.py
def get_targets_bottom(modality_type, value=None): """Gets default bottom transformation for targets; if none, return value.""" if modality_type == ModalityType.AUDIO: return make_targets_bottom(audio_bottom) elif modality_type == ModalityType.AUDIO_SPECTRAL: return make_targets_bottom(audio_spectral_bott...
def get_targets_bottom(modality_type, value=None): """Gets default bottom transformation for targets; if none, return value.""" if modality_type == ModalityType.AUDIO: return make_targets_bottom(audio_bottom) elif modality_type == ModalityType.AUDIO_SPECTRAL: return make_targets_bottom(audio_spectral_bott...
[ "Gets", "default", "bottom", "transformation", "for", "targets", ";", "if", "none", "return", "value", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L1387-L1439
[ "def", "get_targets_bottom", "(", "modality_type", ",", "value", "=", "None", ")", ":", "if", "modality_type", "==", "ModalityType", ".", "AUDIO", ":", "return", "make_targets_bottom", "(", "audio_bottom", ")", "elif", "modality_type", "==", "ModalityType", ".", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
get_top
Gets default top transformation; if none available, return value.
tensor2tensor/layers/modalities.py
def get_top(modality_type, value=None): """Gets default top transformation; if none available, return value.""" if modality_type in (ModalityType.AUDIO, ModalityType.AUDIO_SPECTRAL, ModalityType.GENERIC_L2_LOSS, ModalityType.IDENTITY, ...
def get_top(modality_type, value=None): """Gets default top transformation; if none available, return value.""" if modality_type in (ModalityType.AUDIO, ModalityType.AUDIO_SPECTRAL, ModalityType.GENERIC_L2_LOSS, ModalityType.IDENTITY, ...
[ "Gets", "default", "top", "transformation", ";", "if", "none", "available", "return", "value", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L1442-L1492
[ "def", "get_top", "(", "modality_type", ",", "value", "=", "None", ")", ":", "if", "modality_type", "in", "(", "ModalityType", ".", "AUDIO", ",", "ModalityType", ".", "AUDIO_SPECTRAL", ",", "ModalityType", ".", "GENERIC_L2_LOSS", ",", "ModalityType", ".", "IDE...
272500b6efe353aeb638d2745ed56e519462ca31
train
get_weights_fn
Gets default weights function; if none available, return value.
tensor2tensor/layers/modalities.py
def get_weights_fn(modality_type, value=None): """Gets default weights function; if none available, return value.""" if modality_type in (ModalityType.CTC_SYMBOL, ModalityType.IDENTITY_SYMBOL, ModalityType.MULTI_LABEL, ModalityType.SYMBOL, ...
def get_weights_fn(modality_type, value=None): """Gets default weights function; if none available, return value.""" if modality_type in (ModalityType.CTC_SYMBOL, ModalityType.IDENTITY_SYMBOL, ModalityType.MULTI_LABEL, ModalityType.SYMBOL, ...
[ "Gets", "default", "weights", "function", ";", "if", "none", "available", "return", "value", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/modalities.py#L1495-L1505
[ "def", "get_weights_fn", "(", "modality_type", ",", "value", "=", "None", ")", ":", "if", "modality_type", "in", "(", "ModalityType", ".", "CTC_SYMBOL", ",", "ModalityType", ".", "IDENTITY_SYMBOL", ",", "ModalityType", ".", "MULTI_LABEL", ",", "ModalityType", "....
272500b6efe353aeb638d2745ed56e519462ca31
train
create_combination
Generates all possible pair combinations for the input list of sentences. For example: input = ["paraphrase1", "paraphrase2", "paraphrase3"] output = [("paraphrase1", "paraphrase2"), ("paraphrase1", "paraphrase3"), ("paraphrase2", "paraphrase3")] Args: list_of_sentences: the list...
tensor2tensor/data_generators/paraphrase_ms_coco.py
def create_combination(list_of_sentences): """Generates all possible pair combinations for the input list of sentences. For example: input = ["paraphrase1", "paraphrase2", "paraphrase3"] output = [("paraphrase1", "paraphrase2"), ("paraphrase1", "paraphrase3"), ("paraphrase2", "paraphr...
def create_combination(list_of_sentences): """Generates all possible pair combinations for the input list of sentences. For example: input = ["paraphrase1", "paraphrase2", "paraphrase3"] output = [("paraphrase1", "paraphrase2"), ("paraphrase1", "paraphrase3"), ("paraphrase2", "paraphr...
[ "Generates", "all", "possible", "pair", "combinations", "for", "the", "input", "list", "of", "sentences", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/paraphrase_ms_coco.py#L42-L67
[ "def", "create_combination", "(", "list_of_sentences", ")", ":", "num_sentences", "=", "len", "(", "list_of_sentences", ")", "-", "1", "combinations", "=", "[", "]", "for", "i", ",", "_", "in", "enumerate", "(", "list_of_sentences", ")", ":", "if", "i", "=...
272500b6efe353aeb638d2745ed56e519462ca31
train
image_transformer2d_base
Set of hyperparameters.
tensor2tensor/models/image_transformer_2d.py
def image_transformer2d_base(): """Set of hyperparameters.""" hparams = common_hparams.basic_params1() hparams.hidden_size = 512 hparams.batch_size = 1 hparams.max_length = 256 hparams.dropout = 0.0 hparams.clip_grad_norm = 0. # i.e. no gradient clipping hparams.optimizer_adam_epsilon = 1e-9 hparams....
def image_transformer2d_base(): """Set of hyperparameters.""" hparams = common_hparams.basic_params1() hparams.hidden_size = 512 hparams.batch_size = 1 hparams.max_length = 256 hparams.dropout = 0.0 hparams.clip_grad_norm = 0. # i.e. no gradient clipping hparams.optimizer_adam_epsilon = 1e-9 hparams....
[ "Set", "of", "hyperparameters", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer_2d.py#L367-L432
[ "def", "image_transformer2d_base", "(", ")", ":", "hparams", "=", "common_hparams", ".", "basic_params1", "(", ")", "hparams", ".", "hidden_size", "=", "512", "hparams", ".", "batch_size", "=", "1", "hparams", ".", "max_length", "=", "256", "hparams", ".", "...
272500b6efe353aeb638d2745ed56e519462ca31
train
imagetransformer2d_base_8l_8_32_big
hparams fo 8 layer big 2d model for cifar 10.
tensor2tensor/models/image_transformer_2d.py
def imagetransformer2d_base_8l_8_32_big(): """hparams fo 8 layer big 2d model for cifar 10.""" hparams = image_transformer2d_base() hparams.num_heads = 16 hparams.hidden_size = 1024 hparams.filter_size = 2048 hparams.num_decoder_layers = 8 hparams.batch_size = 1 hparams.layer_prepostprocess_dropout = 0....
def imagetransformer2d_base_8l_8_32_big(): """hparams fo 8 layer big 2d model for cifar 10.""" hparams = image_transformer2d_base() hparams.num_heads = 16 hparams.hidden_size = 1024 hparams.filter_size = 2048 hparams.num_decoder_layers = 8 hparams.batch_size = 1 hparams.layer_prepostprocess_dropout = 0....
[ "hparams", "fo", "8", "layer", "big", "2d", "model", "for", "cifar", "10", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer_2d.py#L485-L497
[ "def", "imagetransformer2d_base_8l_8_32_big", "(", ")", ":", "hparams", "=", "image_transformer2d_base", "(", ")", "hparams", ".", "num_heads", "=", "16", "hparams", ".", "hidden_size", "=", "1024", "hparams", ".", "filter_size", "=", "2048", "hparams", ".", "nu...
272500b6efe353aeb638d2745ed56e519462ca31
train
imagetransformer_base_10l_8h_big_uncond_dr03_dan_64_2d
big 1d model for unconditional generation on imagenet.
tensor2tensor/models/image_transformer_2d.py
def imagetransformer_base_10l_8h_big_uncond_dr03_dan_64_2d(): """big 1d model for unconditional generation on imagenet.""" hparams = image_transformer2d_base() hparams.unconditional = True hparams.hidden_size = 512 hparams.batch_size = 1 hparams.img_len = 64 hparams.num_heads = 8 hparams.filter_size = 2...
def imagetransformer_base_10l_8h_big_uncond_dr03_dan_64_2d(): """big 1d model for unconditional generation on imagenet.""" hparams = image_transformer2d_base() hparams.unconditional = True hparams.hidden_size = 512 hparams.batch_size = 1 hparams.img_len = 64 hparams.num_heads = 8 hparams.filter_size = 2...
[ "big", "1d", "model", "for", "unconditional", "generation", "on", "imagenet", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer_2d.py#L501-L519
[ "def", "imagetransformer_base_10l_8h_big_uncond_dr03_dan_64_2d", "(", ")", ":", "hparams", "=", "image_transformer2d_base", "(", ")", "hparams", ".", "unconditional", "=", "True", "hparams", ".", "hidden_size", "=", "512", "hparams", ".", "batch_size", "=", "1", "hp...
272500b6efe353aeb638d2745ed56e519462ca31
train
img2img_transformer2d_base
Base params for img2img 2d attention.
tensor2tensor/models/image_transformer_2d.py
def img2img_transformer2d_base(): """Base params for img2img 2d attention.""" hparams = image_transformer2d_base() # learning related flags hparams.layer_preprocess_sequence = "n" hparams.layer_postprocess_sequence = "da" # This version seems to benefit from a higher learning rate. hparams.learning_rate =...
def img2img_transformer2d_base(): """Base params for img2img 2d attention.""" hparams = image_transformer2d_base() # learning related flags hparams.layer_preprocess_sequence = "n" hparams.layer_postprocess_sequence = "da" # This version seems to benefit from a higher learning rate. hparams.learning_rate =...
[ "Base", "params", "for", "img2img", "2d", "attention", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer_2d.py#L585-L601
[ "def", "img2img_transformer2d_base", "(", ")", ":", "hparams", "=", "image_transformer2d_base", "(", ")", "# learning related flags", "hparams", ".", "layer_preprocess_sequence", "=", "\"n\"", "hparams", ".", "layer_postprocess_sequence", "=", "\"da\"", "# This version seem...
272500b6efe353aeb638d2745ed56e519462ca31
train
img2img_transformer2d_q3
Current best hparams for local 2d.
tensor2tensor/models/image_transformer_2d.py
def img2img_transformer2d_q3(): """Current best hparams for local 2d.""" hparams = img2img_transformer2d_q1() hparams.batch_size = 2 hparams.query_shape = (8, 16) hparams.memory_flange = (8, 32) return hparams
def img2img_transformer2d_q3(): """Current best hparams for local 2d.""" hparams = img2img_transformer2d_q1() hparams.batch_size = 2 hparams.query_shape = (8, 16) hparams.memory_flange = (8, 32) return hparams
[ "Current", "best", "hparams", "for", "local", "2d", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer_2d.py#L627-L633
[ "def", "img2img_transformer2d_q3", "(", ")", ":", "hparams", "=", "img2img_transformer2d_q1", "(", ")", "hparams", ".", "batch_size", "=", "2", "hparams", ".", "query_shape", "=", "(", "8", ",", "16", ")", "hparams", ".", "memory_flange", "=", "(", "8", ",...
272500b6efe353aeb638d2745ed56e519462ca31
train
img2img_transformer_base
Base params for local1d attention.
tensor2tensor/models/image_transformer_2d.py
def img2img_transformer_base(): """Base params for local1d attention.""" hparams = image_transformer2d_base() # learning related flags hparams.layer_preprocess_sequence = "n" hparams.layer_postprocess_sequence = "da" # This version seems to benefit from a higher learning rate. hparams.learning_rate = 0.2 ...
def img2img_transformer_base(): """Base params for local1d attention.""" hparams = image_transformer2d_base() # learning related flags hparams.layer_preprocess_sequence = "n" hparams.layer_postprocess_sequence = "da" # This version seems to benefit from a higher learning rate. hparams.learning_rate = 0.2 ...
[ "Base", "params", "for", "local1d", "attention", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer_2d.py#L637-L654
[ "def", "img2img_transformer_base", "(", ")", ":", "hparams", "=", "image_transformer2d_base", "(", ")", "# learning related flags", "hparams", ".", "layer_preprocess_sequence", "=", "\"n\"", "hparams", ".", "layer_postprocess_sequence", "=", "\"da\"", "# This version seems ...
272500b6efe353aeb638d2745ed56e519462ca31
train
img2img_transformer_b3
Current best hparams for local 1d.
tensor2tensor/models/image_transformer_2d.py
def img2img_transformer_b3(): """Current best hparams for local 1d.""" hparams = img2img_transformer_base() hparams.batch_size = 2 hparams.layer_preprocess_sequence = "none" hparams.layer_postprocess_sequence = "dan" hparams.block_length = 128 hparams.sampling_temp = 0.9 return hparams
def img2img_transformer_b3(): """Current best hparams for local 1d.""" hparams = img2img_transformer_base() hparams.batch_size = 2 hparams.layer_preprocess_sequence = "none" hparams.layer_postprocess_sequence = "dan" hparams.block_length = 128 hparams.sampling_temp = 0.9 return hparams
[ "Current", "best", "hparams", "for", "local", "1d", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer_2d.py#L678-L686
[ "def", "img2img_transformer_b3", "(", ")", ":", "hparams", "=", "img2img_transformer_base", "(", ")", "hparams", ".", "batch_size", "=", "2", "hparams", ".", "layer_preprocess_sequence", "=", "\"none\"", "hparams", ".", "layer_postprocess_sequence", "=", "\"dan\"", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
img2img_transformer_dilated
Try dilated.
tensor2tensor/models/image_transformer_2d.py
def img2img_transformer_dilated(): """Try dilated.""" hparams = img2img_transformer_base() hparams.add_hparam("num_memory_blocks", 1) hparams.num_heads = 8 hparams.attention_key_channels = hparams.attention_value_channels = 0 hparams.hidden_size = 512 hparams.filter_size = 2048 hparams.num_decoder_layer...
def img2img_transformer_dilated(): """Try dilated.""" hparams = img2img_transformer_base() hparams.add_hparam("num_memory_blocks", 1) hparams.num_heads = 8 hparams.attention_key_channels = hparams.attention_value_channels = 0 hparams.hidden_size = 512 hparams.filter_size = 2048 hparams.num_decoder_layer...
[ "Try", "dilated", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer_2d.py#L760-L775
[ "def", "img2img_transformer_dilated", "(", ")", ":", "hparams", "=", "img2img_transformer_base", "(", ")", "hparams", ".", "add_hparam", "(", "\"num_memory_blocks\"", ",", "1", ")", "hparams", ".", "num_heads", "=", "8", "hparams", ".", "attention_key_channels", "...
272500b6efe353aeb638d2745ed56e519462ca31
train
img2img_transformer_base_tpu
Hparams for training img2img_transformer on tpu.
tensor2tensor/models/image_transformer_2d.py
def img2img_transformer_base_tpu(): """Hparams for training img2img_transformer on tpu.""" hparams = img2img_transformer_base() update_hparams_for_tpu(hparams) hparams.batch_size = 2 hparams.num_heads = 4 # heads are expensive on tpu hparams.num_decoder_layers = 8 hparams.num_encoder_layers = 4 hparam...
def img2img_transformer_base_tpu(): """Hparams for training img2img_transformer on tpu.""" hparams = img2img_transformer_base() update_hparams_for_tpu(hparams) hparams.batch_size = 2 hparams.num_heads = 4 # heads are expensive on tpu hparams.num_decoder_layers = 8 hparams.num_encoder_layers = 4 hparam...
[ "Hparams", "for", "training", "img2img_transformer", "on", "tpu", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer_2d.py#L794-L803
[ "def", "img2img_transformer_base_tpu", "(", ")", ":", "hparams", "=", "img2img_transformer_base", "(", ")", "update_hparams_for_tpu", "(", "hparams", ")", "hparams", ".", "batch_size", "=", "2", "hparams", ".", "num_heads", "=", "4", "# heads are expensive on tpu", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
img2img_transformer2d_n31
Set of hyperparameters.
tensor2tensor/models/image_transformer_2d.py
def img2img_transformer2d_n31(): """Set of hyperparameters.""" hparams = img2img_transformer2d_base() hparams.batch_size = 1 hparams.num_encoder_layers = 6 hparams.num_decoder_layers = 12 hparams.num_heads = 8 hparams.query_shape = (16, 32) hparams.memory_flange = (16, 32) return hparams
def img2img_transformer2d_n31(): """Set of hyperparameters.""" hparams = img2img_transformer2d_base() hparams.batch_size = 1 hparams.num_encoder_layers = 6 hparams.num_decoder_layers = 12 hparams.num_heads = 8 hparams.query_shape = (16, 32) hparams.memory_flange = (16, 32) return hparams
[ "Set", "of", "hyperparameters", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer_2d.py#L829-L838
[ "def", "img2img_transformer2d_n31", "(", ")", ":", "hparams", "=", "img2img_transformer2d_base", "(", ")", "hparams", ".", "batch_size", "=", "1", "hparams", ".", "num_encoder_layers", "=", "6", "hparams", ".", "num_decoder_layers", "=", "12", "hparams", ".", "n...
272500b6efe353aeb638d2745ed56e519462ca31
train
img2img_transformer2d_n24
Set of hyperparameters.
tensor2tensor/models/image_transformer_2d.py
def img2img_transformer2d_n24(): """Set of hyperparameters.""" hparams = img2img_transformer2d_base() hparams.batch_size = 1 hparams.hidden_size = 1024 hparams.filter_size = 2048 hparams.layer_prepostprocess_dropout = 0.2 hparams.num_decoder_layers = 8 hparams.query_shape = (8, 16) hparams.memory_flan...
def img2img_transformer2d_n24(): """Set of hyperparameters.""" hparams = img2img_transformer2d_base() hparams.batch_size = 1 hparams.hidden_size = 1024 hparams.filter_size = 2048 hparams.layer_prepostprocess_dropout = 0.2 hparams.num_decoder_layers = 8 hparams.query_shape = (8, 16) hparams.memory_flan...
[ "Set", "of", "hyperparameters", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer_2d.py#L842-L852
[ "def", "img2img_transformer2d_n24", "(", ")", ":", "hparams", "=", "img2img_transformer2d_base", "(", ")", "hparams", ".", "batch_size", "=", "1", "hparams", ".", "hidden_size", "=", "1024", "hparams", ".", "filter_size", "=", "2048", "hparams", ".", "layer_prep...
272500b6efe353aeb638d2745ed56e519462ca31
train
img2img_transformer2d_tiny
Tiny params.
tensor2tensor/models/image_transformer_2d.py
def img2img_transformer2d_tiny(): """Tiny params.""" hparams = img2img_transformer2d_base() hparams.num_decoder_layers = 2 hparams.hidden_size = 128 hparams.batch_size = 4 hparams.max_length = 128 hparams.attention_key_channels = hparams.attention_value_channels = 0 hparams.filter_size = 128 hparams.n...
def img2img_transformer2d_tiny(): """Tiny params.""" hparams = img2img_transformer2d_base() hparams.num_decoder_layers = 2 hparams.hidden_size = 128 hparams.batch_size = 4 hparams.max_length = 128 hparams.attention_key_channels = hparams.attention_value_channels = 0 hparams.filter_size = 128 hparams.n...
[ "Tiny", "params", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer_2d.py#L880-L892
[ "def", "img2img_transformer2d_tiny", "(", ")", ":", "hparams", "=", "img2img_transformer2d_base", "(", ")", "hparams", ".", "num_decoder_layers", "=", "2", "hparams", ".", "hidden_size", "=", "128", "hparams", ".", "batch_size", "=", "4", "hparams", ".", "max_le...
272500b6efe353aeb638d2745ed56e519462ca31
train
img2img_transformer_tiny
Tiny params.
tensor2tensor/models/image_transformer_2d.py
def img2img_transformer_tiny(): """Tiny params.""" hparams = img2img_transformer2d_base() hparams.num_hidden_layers = 2 hparams.hidden_size = 128 hparams.batch_size = 4 hparams.max_length = 128 hparams.attention_key_channels = hparams.attention_value_channels = 0 hparams.filter_size = 128 hparams.num_...
def img2img_transformer_tiny(): """Tiny params.""" hparams = img2img_transformer2d_base() hparams.num_hidden_layers = 2 hparams.hidden_size = 128 hparams.batch_size = 4 hparams.max_length = 128 hparams.attention_key_channels = hparams.attention_value_channels = 0 hparams.filter_size = 128 hparams.num_...
[ "Tiny", "params", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/image_transformer_2d.py#L896-L907
[ "def", "img2img_transformer_tiny", "(", ")", ":", "hparams", "=", "img2img_transformer2d_base", "(", ")", "hparams", ".", "num_hidden_layers", "=", "2", "hparams", ".", "hidden_size", "=", "128", "hparams", ".", "batch_size", "=", "4", "hparams", ".", "max_lengt...
272500b6efe353aeb638d2745ed56e519462ca31
train
ResidualFeedForward
Residual feed-forward layer with normalization at start.
tensor2tensor/trax/models/transformer.py
def ResidualFeedForward(feature_depth, feedforward_depth, dropout, mode): """Residual feed-forward layer with normalization at start.""" return layers.Residual( layers.LayerNorm(), layers.Dense(feedforward_depth), layers.Relu(...
def ResidualFeedForward(feature_depth, feedforward_depth, dropout, mode): """Residual feed-forward layer with normalization at start.""" return layers.Residual( layers.LayerNorm(), layers.Dense(feedforward_depth), layers.Relu(...
[ "Residual", "feed", "-", "forward", "layer", "with", "normalization", "at", "start", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/models/transformer.py#L24-L36
[ "def", "ResidualFeedForward", "(", "feature_depth", ",", "feedforward_depth", ",", "dropout", ",", "mode", ")", ":", "return", "layers", ".", "Residual", "(", "layers", ".", "LayerNorm", "(", ")", ",", "layers", ".", "Dense", "(", "feedforward_depth", ")", "...
272500b6efe353aeb638d2745ed56e519462ca31
train
EncoderLayer
Transformer encoder layer. The input to the encoder is a pair (embedded source, mask) where the mask is created from the original source to prevent attending to the padding part of the input. Args: feature_depth: int: depth of embedding feedforward_depth: int: depth of feed-forward layer num_head...
tensor2tensor/trax/models/transformer.py
def EncoderLayer(feature_depth, feedforward_depth, num_heads, dropout, mode): """Transformer encoder layer. The input to the encoder is a pair (embedded source, mask) where the mask is created from the original source to prevent attending to t...
def EncoderLayer(feature_depth, feedforward_depth, num_heads, dropout, mode): """Transformer encoder layer. The input to the encoder is a pair (embedded source, mask) where the mask is created from the original source to prevent attending to t...
[ "Transformer", "encoder", "layer", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/models/transformer.py#L39-L76
[ "def", "EncoderLayer", "(", "feature_depth", ",", "feedforward_depth", ",", "num_heads", ",", "dropout", ",", "mode", ")", ":", "# The encoder block expects (activation, mask) as input and returns", "# the new activations only, we add the mask back to output next.", "encoder_block", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
TransformerEncoder
Transformer encoder. Args: vocab_size: int: vocab size num_classes: how many classes on output feature_depth: int: depth of embedding feedforward_depth: int: depth of feed-forward layer num_layers: int: number of encoder/decoder layers num_heads: int: number of attention heads dropout: f...
tensor2tensor/trax/models/transformer.py
def TransformerEncoder(vocab_size, num_classes=10, feature_depth=512, feedforward_depth=2048, num_layers=6, num_heads=8, dropout=0.1, max_len=2048, ...
def TransformerEncoder(vocab_size, num_classes=10, feature_depth=512, feedforward_depth=2048, num_layers=6, num_heads=8, dropout=0.1, max_len=2048, ...
[ "Transformer", "encoder", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/models/transformer.py#L79-L120
[ "def", "TransformerEncoder", "(", "vocab_size", ",", "num_classes", "=", "10", ",", "feature_depth", "=", "512", ",", "feedforward_depth", "=", "2048", ",", "num_layers", "=", "6", ",", "num_heads", "=", "8", ",", "dropout", "=", "0.1", ",", "max_len", "="...
272500b6efe353aeb638d2745ed56e519462ca31
train
DecoderLayer
Transformer decoder layer. Args: feature_depth: int: depth of embedding feedforward_depth: int: depth of feed-forward layer num_heads: int: number of attention heads dropout: float: dropout rate (how much to drop out) mode: str: 'train' or 'eval' Returns: the layer.
tensor2tensor/trax/models/transformer.py
def DecoderLayer(feature_depth, feedforward_depth, num_heads, dropout, mode): """Transformer decoder layer. Args: feature_depth: int: depth of embedding feedforward_depth: int: depth of feed-forward layer num_heads: int: number of att...
def DecoderLayer(feature_depth, feedforward_depth, num_heads, dropout, mode): """Transformer decoder layer. Args: feature_depth: int: depth of embedding feedforward_depth: int: depth of feed-forward layer num_heads: int: number of att...
[ "Transformer", "decoder", "layer", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/models/transformer.py#L123-L151
[ "def", "DecoderLayer", "(", "feature_depth", ",", "feedforward_depth", ",", "num_heads", ",", "dropout", ",", "mode", ")", ":", "return", "layers", ".", "Serial", "(", "layers", ".", "Residual", "(", "# Self-attention block.", "layers", ".", "LayerNorm", "(", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
TransformerLM
Transformer language model (only uses the decoder part of Transformer). Args: vocab_size: int: vocab size feature_depth: int: depth of embedding feedforward_depth: int: depth of feed-forward layer num_layers: int: number of encoder/decoder layers num_heads: int: number of attention heads dro...
tensor2tensor/trax/models/transformer.py
def TransformerLM(vocab_size, feature_depth=512, feedforward_depth=2048, num_layers=6, num_heads=8, dropout=0.1, max_len=2048, mode='train'): """Transformer language model (only uses the decod...
def TransformerLM(vocab_size, feature_depth=512, feedforward_depth=2048, num_layers=6, num_heads=8, dropout=0.1, max_len=2048, mode='train'): """Transformer language model (only uses the decod...
[ "Transformer", "language", "model", "(", "only", "uses", "the", "decoder", "part", "of", "Transformer", ")", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/models/transformer.py#L154-L188
[ "def", "TransformerLM", "(", "vocab_size", ",", "feature_depth", "=", "512", ",", "feedforward_depth", "=", "2048", ",", "num_layers", "=", "6", ",", "num_heads", "=", "8", ",", "dropout", "=", "0.1", ",", "max_len", "=", "2048", ",", "mode", "=", "'trai...
272500b6efe353aeb638d2745ed56e519462ca31
train
ChunkedDecoderLayer
Transformer decoder layer operating on chunks. Args: feature_depth: int: depth of embedding feedforward_depth: int: depth of feed-forward layer num_heads: int: number of attention heads dropout: float: dropout rate (how much to drop out) chunk_selector: a function from chunk number to list of ch...
tensor2tensor/trax/models/transformer.py
def ChunkedDecoderLayer(feature_depth, feedforward_depth, num_heads, dropout, chunk_selector, mode): """Transformer decoder layer operating on chunks. Args: feature_depth: int: depth of embe...
def ChunkedDecoderLayer(feature_depth, feedforward_depth, num_heads, dropout, chunk_selector, mode): """Transformer decoder layer operating on chunks. Args: feature_depth: int: depth of embe...
[ "Transformer", "decoder", "layer", "operating", "on", "chunks", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/models/transformer.py#L191-L220
[ "def", "ChunkedDecoderLayer", "(", "feature_depth", ",", "feedforward_depth", ",", "num_heads", ",", "dropout", ",", "chunk_selector", ",", "mode", ")", ":", "return", "layers", ".", "Serial", "(", "layers", ".", "Residual", "(", "# Self-attention block.", "layers...
272500b6efe353aeb638d2745ed56e519462ca31
train
ChunkedTransformerLM
Transformer language model operating on chunks. The input to this model is a sequence presented as a list or tuple of chunks: (chunk1, chunk2, chunks3, ..., chunkN). Each chunk should have the same shape (batch, chunk-length) and together they represent a long sequence that's a concatenation chunk1,chunk2,....
tensor2tensor/trax/models/transformer.py
def ChunkedTransformerLM(vocab_size, feature_depth=512, feedforward_depth=2048, num_layers=6, num_heads=8, dropout=0.1, chunk_selector=None, max_...
def ChunkedTransformerLM(vocab_size, feature_depth=512, feedforward_depth=2048, num_layers=6, num_heads=8, dropout=0.1, chunk_selector=None, max_...
[ "Transformer", "language", "model", "operating", "on", "chunks", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/models/transformer.py#L223-L273
[ "def", "ChunkedTransformerLM", "(", "vocab_size", ",", "feature_depth", "=", "512", ",", "feedforward_depth", "=", "2048", ",", "num_layers", "=", "6", ",", "num_heads", "=", "8", ",", "dropout", "=", "0.1", ",", "chunk_selector", "=", "None", ",", "max_len"...
272500b6efe353aeb638d2745ed56e519462ca31
train
Transformer
Transformer model. Args: source_vocab_size: int: source vocab size target_vocab_size: int: target vocab size mode: str: 'train' or 'eval' num_layers: int: number of encoder/decoder layers feature_depth: int: depth of embedding feedforward_depth: int: depth of feed-forward layer num_heads...
tensor2tensor/trax/models/transformer.py
def Transformer(source_vocab_size, target_vocab_size, mode='train', num_layers=6, feature_depth=512, feedforward_depth=2048, num_heads=8, dropout=0.1, shared_embedding=True, ma...
def Transformer(source_vocab_size, target_vocab_size, mode='train', num_layers=6, feature_depth=512, feedforward_depth=2048, num_heads=8, dropout=0.1, shared_embedding=True, ma...
[ "Transformer", "model", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/models/transformer.py#L279-L431
[ "def", "Transformer", "(", "source_vocab_size", ",", "target_vocab_size", ",", "mode", "=", "'train'", ",", "num_layers", "=", "6", ",", "feature_depth", "=", "512", ",", "feedforward_depth", "=", "2048", ",", "num_heads", "=", "8", ",", "dropout", "=", "0.1...
272500b6efe353aeb638d2745ed56e519462ca31
train
mtf_transformer_base
Set of hyperparameters.
tensor2tensor/models/mtf_transformer.py
def mtf_transformer_base(): """Set of hyperparameters.""" hparams = common_hparams.basic_params1() hparams.no_data_parallelism = True hparams.use_fixed_batch_size = True hparams.add_hparam("mtf_mode", True) hparams.batch_size = 64 hparams.max_length = 256 hparams.add_hparam("d_model", 512) hparams.add...
def mtf_transformer_base(): """Set of hyperparameters.""" hparams = common_hparams.basic_params1() hparams.no_data_parallelism = True hparams.use_fixed_batch_size = True hparams.add_hparam("mtf_mode", True) hparams.batch_size = 64 hparams.max_length = 256 hparams.add_hparam("d_model", 512) hparams.add...
[ "Set", "of", "hyperparameters", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_transformer.py#L791-L883
[ "def", "mtf_transformer_base", "(", ")", ":", "hparams", "=", "common_hparams", ".", "basic_params1", "(", ")", "hparams", ".", "no_data_parallelism", "=", "True", "hparams", ".", "use_fixed_batch_size", "=", "True", "hparams", ".", "add_hparam", "(", "\"mtf_mode\...
272500b6efe353aeb638d2745ed56e519462ca31
train
mtf_transformer_tiny
Catch bugs locally...
tensor2tensor/models/mtf_transformer.py
def mtf_transformer_tiny(): """Catch bugs locally...""" hparams = mtf_transformer_base() hparams.d_model = 128 hparams.d_ff = 512 hparams.batch_size = 8 hparams.encoder_layers = ["att", "drd"] * 2 hparams.decoder_layers = ["att", "enc_att", "drd"] * 2 hparams.num_heads = 8 # data parallelism and model...
def mtf_transformer_tiny(): """Catch bugs locally...""" hparams = mtf_transformer_base() hparams.d_model = 128 hparams.d_ff = 512 hparams.batch_size = 8 hparams.encoder_layers = ["att", "drd"] * 2 hparams.decoder_layers = ["att", "enc_att", "drd"] * 2 hparams.num_heads = 8 # data parallelism and model...
[ "Catch", "bugs", "locally", "..." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_transformer.py#L897-L909
[ "def", "mtf_transformer_tiny", "(", ")", ":", "hparams", "=", "mtf_transformer_base", "(", ")", "hparams", ".", "d_model", "=", "128", "hparams", ".", "d_ff", "=", "512", "hparams", ".", "batch_size", "=", "8", "hparams", ".", "encoder_layers", "=", "[", "...
272500b6efe353aeb638d2745ed56e519462ca31
train
mtf_transformer_paper_lm
Config for language-model experiments. Train these on languagemodel_lm1b32k_packed for 136000 steps (10 epochs) The size parameter is an integer that controls the number of heads and the size of the size of the feedforward hidden layers. Increasing size by 1 doubles each of these. Results: size params...
tensor2tensor/models/mtf_transformer.py
def mtf_transformer_paper_lm(size): """Config for language-model experiments. Train these on languagemodel_lm1b32k_packed for 136000 steps (10 epochs) The size parameter is an integer that controls the number of heads and the size of the size of the feedforward hidden layers. Increasing size by 1 doubles e...
def mtf_transformer_paper_lm(size): """Config for language-model experiments. Train these on languagemodel_lm1b32k_packed for 136000 steps (10 epochs) The size parameter is an integer that controls the number of heads and the size of the size of the feedforward hidden layers. Increasing size by 1 doubles e...
[ "Config", "for", "language", "-", "model", "experiments", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_transformer.py#L953-L989
[ "def", "mtf_transformer_paper_lm", "(", "size", ")", ":", "n", "=", "2", "**", "size", "hparams", "=", "mtf_transformer_base_lm", "(", ")", "hparams", ".", "batch_size", "=", "256", "hparams", ".", "d_model", "=", "1024", "hparams", ".", "d_ff", "=", "int"...
272500b6efe353aeb638d2745ed56e519462ca31
train
mtf_transformer_paper_tr
Config for translation experiments. Train these on translate_enfr_wmt32k_packed for 154000 steps (3 epochs) The size parameter is an integer that controls the number of heads and the size of the size of the feedforward hidden layers. Increasing size by 1 doubles each of these. Args: size: an integer ...
tensor2tensor/models/mtf_transformer.py
def mtf_transformer_paper_tr(size): """Config for translation experiments. Train these on translate_enfr_wmt32k_packed for 154000 steps (3 epochs) The size parameter is an integer that controls the number of heads and the size of the size of the feedforward hidden layers. Increasing size by 1 doubles each ...
def mtf_transformer_paper_tr(size): """Config for translation experiments. Train these on translate_enfr_wmt32k_packed for 154000 steps (3 epochs) The size parameter is an integer that controls the number of heads and the size of the size of the feedforward hidden layers. Increasing size by 1 doubles each ...
[ "Config", "for", "translation", "experiments", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_transformer.py#L1041-L1065
[ "def", "mtf_transformer_paper_tr", "(", "size", ")", ":", "n", "=", "2", "**", "size", "hparams", "=", "mtf_transformer_base", "(", ")", "hparams", ".", "label_smoothing", "=", "0.1", "hparams", ".", "batch_size", "=", "128", "hparams", ".", "d_model", "=", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
mtf_transformer_lm_baseline
Small language model to run on 1 TPU. Run this on 2x2 on languagemodel_lm1b32k_packed for 272000 steps (10 epochs) Results: params/10^9 log-ppl(per-token) 0.14 3.202 Returns: a hparams
tensor2tensor/models/mtf_transformer.py
def mtf_transformer_lm_baseline(): """Small language model to run on 1 TPU. Run this on 2x2 on languagemodel_lm1b32k_packed for 272000 steps (10 epochs) Results: params/10^9 log-ppl(per-token) 0.14 3.202 Returns: a hparams """ hparams = mtf_transformer_paper_lm(-1) hparams...
def mtf_transformer_lm_baseline(): """Small language model to run on 1 TPU. Run this on 2x2 on languagemodel_lm1b32k_packed for 272000 steps (10 epochs) Results: params/10^9 log-ppl(per-token) 0.14 3.202 Returns: a hparams """ hparams = mtf_transformer_paper_lm(-1) hparams...
[ "Small", "language", "model", "to", "run", "on", "1", "TPU", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_transformer.py#L1171-L1186
[ "def", "mtf_transformer_lm_baseline", "(", ")", ":", "hparams", "=", "mtf_transformer_paper_lm", "(", "-", "1", ")", "hparams", ".", "batch_size", "=", "128", "hparams", ".", "learning_rate_decay_steps", "=", "27200", "# one epoch on lm1b", "hparams", ".", "mesh_sha...
272500b6efe353aeb638d2745ed56e519462ca31
train
multihead_graph_attention
Multihead scaled-dot-product attention with input/output transformations. Args: query_antecedent: a Tensor with shape [batch, length_q, channels] memory_antecedent: a Tensor with shape [batch, length_m, channels] or None bias: bias Tensor (see attention_bias()) total_key_depth: an integer total_v...
tensor2tensor/layers/message_passing_attention.py
def multihead_graph_attention(query_antecedent, memory_antecedent, bias, total_key_depth, total_value_depth, output_depth, num_heads, ...
def multihead_graph_attention(query_antecedent, memory_antecedent, bias, total_key_depth, total_value_depth, output_depth, num_heads, ...
[ "Multihead", "scaled", "-", "dot", "-", "product", "attention", "with", "input", "/", "output", "transformations", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/message_passing_attention.py#L28-L146
[ "def", "multihead_graph_attention", "(", "query_antecedent", ",", "memory_antecedent", ",", "bias", ",", "total_key_depth", ",", "total_value_depth", ",", "output_depth", ",", "num_heads", ",", "dropout_rate", ",", "image_shapes", "=", "None", ",", "attention_type", "...
272500b6efe353aeb638d2745ed56e519462ca31
train
graph_attention
graph attention. Args: q: a Tensor with shape [batch, heads, length_q, depth_k] k: a Tensor with shape [batch, heads, length_kv, depth_k] v: a Tensor with shape [batch, heads, length_kv, depth_v] bias: bias Tensor (see attention_bias()) dropout_rate: a floating point number image_shapes: opti...
tensor2tensor/layers/message_passing_attention.py
def graph_attention(q, k, v, bias, dropout_rate=0.0, image_shapes=None, name=None, make_image_summary=True, save_weights_to=None, dropout_br...
def graph_attention(q, k, v, bias, dropout_rate=0.0, image_shapes=None, name=None, make_image_summary=True, save_weights_to=None, dropout_br...
[ "graph", "attention", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/message_passing_attention.py#L185-L248
[ "def", "graph_attention", "(", "q", ",", "k", ",", "v", ",", "bias", ",", "dropout_rate", "=", "0.0", ",", "image_shapes", "=", "None", ",", "name", "=", "None", ",", "make_image_summary", "=", "True", ",", "save_weights_to", "=", "None", ",", "dropout_b...
272500b6efe353aeb638d2745ed56e519462ca31
train
_compute_edge_transforms
Helper function that computes transformation for keys and values. Let B be the number of batches. Let N be the number of nodes in the graph. Let D be the size of the node hidden states. Let K be the size of the attention keys/queries (total_key_depth). Let V be the size of the attention values (total_value_d...
tensor2tensor/layers/message_passing_attention.py
def _compute_edge_transforms(node_states, depth, num_transforms, name="transform"): """Helper function that computes transformation for keys and values. Let B be the number of batches. Let N be the number of nodes in the graph...
def _compute_edge_transforms(node_states, depth, num_transforms, name="transform"): """Helper function that computes transformation for keys and values. Let B be the number of batches. Let N be the number of nodes in the graph...
[ "Helper", "function", "that", "computes", "transformation", "for", "keys", "and", "values", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/message_passing_attention.py#L251-L301
[ "def", "_compute_edge_transforms", "(", "node_states", ",", "depth", ",", "num_transforms", ",", "name", "=", "\"transform\"", ")", ":", "node_shapes", "=", "common_layers", ".", "shape_list", "(", "node_states", ")", "x", "=", "common_layers", ".", "dense", "("...
272500b6efe353aeb638d2745ed56e519462ca31
train
compute_mpnn_qkv
Computes query, key and value for edge matrices. Let B be the number of batches. Let N be the number of nodes in the graph. Let D be the size of the node hidden states. Let K be the size of the attention keys/queries (total_key_depth). Let V be the size of the attention values (total_value_depth). Let T be...
tensor2tensor/layers/message_passing_attention.py
def compute_mpnn_qkv(node_states, total_key_depth, total_value_depth, num_transforms): """Computes query, key and value for edge matrices. Let B be the number of batches. Let N be the number of nodes in the graph. Let D be the size of the node hidd...
def compute_mpnn_qkv(node_states, total_key_depth, total_value_depth, num_transforms): """Computes query, key and value for edge matrices. Let B be the number of batches. Let N be the number of nodes in the graph. Let D be the size of the node hidd...
[ "Computes", "query", "key", "and", "value", "for", "edge", "matrices", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/message_passing_attention.py#L304-L364
[ "def", "compute_mpnn_qkv", "(", "node_states", ",", "total_key_depth", ",", "total_value_depth", ",", "num_transforms", ")", ":", "# node_states is initially a tensor with shape [B, N, D]. The call to dense", "# creates a D x K kernel that serves as a fully-connected layer.", "#", "# F...
272500b6efe353aeb638d2745ed56e519462ca31
train
sparse_message_pass_batched
Identical to sparse_ggnn except that each input has a batch dimension. B = The batch size. N = The number of nodes in each batch. H = The size of the hidden states. T = The number of edge types. Args: node_states: Initial states of each node in the graph. Shape: [B, N, H] adjacency_matrices: Adjacen...
tensor2tensor/layers/message_passing_attention.py
def sparse_message_pass_batched(node_states, adjacency_matrices, num_edge_types, hidden_size, use_bias=True, average_aggregation=False, ...
def sparse_message_pass_batched(node_states, adjacency_matrices, num_edge_types, hidden_size, use_bias=True, average_aggregation=False, ...
[ "Identical", "to", "sparse_ggnn", "except", "that", "each", "input", "has", "a", "batch", "dimension", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/message_passing_attention.py#L367-L428
[ "def", "sparse_message_pass_batched", "(", "node_states", ",", "adjacency_matrices", ",", "num_edge_types", ",", "hidden_size", ",", "use_bias", "=", "True", ",", "average_aggregation", "=", "False", ",", "name", "=", "\"sparse_ggnn_batched\"", ")", ":", "b", ",", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
sparse_message_pass
One message-passing step for a GNN with a sparse adjacency matrix. Implements equation 2 (the message passing step) in [Li et al. 2015](https://arxiv.org/abs/1511.05493). N = The number of nodes in each batch. H = The size of the hidden states. T = The number of edge types. Args: node_states: Initial...
tensor2tensor/layers/message_passing_attention.py
def sparse_message_pass(node_states, adjacency_matrices, num_edge_types, hidden_size, use_bias=True, average_aggregation=False, name="sparse_ggnn"): """One message-passing st...
def sparse_message_pass(node_states, adjacency_matrices, num_edge_types, hidden_size, use_bias=True, average_aggregation=False, name="sparse_ggnn"): """One message-passing st...
[ "One", "message", "-", "passing", "step", "for", "a", "GNN", "with", "a", "sparse", "adjacency", "matrix", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/message_passing_attention.py#L431-L511
[ "def", "sparse_message_pass", "(", "node_states", ",", "adjacency_matrices", ",", "num_edge_types", ",", "hidden_size", ",", "use_bias", "=", "True", ",", "average_aggregation", "=", "False", ",", "name", "=", "\"sparse_ggnn\"", ")", ":", "n", "=", "tf", ".", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
multihead_mpnn_attention
Multihead scaled-dot-product attention with input/output transformations. Let B be the number of batches. Let N be the number of nodes in the graph. Let D be the size of the node hidden states. Let K be the size of the attention keys/queries (total_key_depth). Let V be the size of the attention values (total...
tensor2tensor/layers/message_passing_attention.py
def multihead_mpnn_attention(node_states, total_key_depth, total_value_depth, output_depth, num_heads, adjacency_matrix=None, num_edge_types=5, ...
def multihead_mpnn_attention(node_states, total_key_depth, total_value_depth, output_depth, num_heads, adjacency_matrix=None, num_edge_types=5, ...
[ "Multihead", "scaled", "-", "dot", "-", "product", "attention", "with", "input", "/", "output", "transformations", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/message_passing_attention.py#L514-L649
[ "def", "multihead_mpnn_attention", "(", "node_states", ",", "total_key_depth", ",", "total_value_depth", ",", "output_depth", ",", "num_heads", ",", "adjacency_matrix", "=", "None", ",", "num_edge_types", "=", "5", ",", "num_transforms", "=", "None", ",", "use_weigh...
272500b6efe353aeb638d2745ed56e519462ca31
train
dot_product_mpnn_attention
Dot product attention with edge vectors. Let B be the number of batches. Let N be the number of nodes in the graph. Let K be the size of the attention keys/queries. Let V be the size of the attention values. Let T be the total number of transforms (num_transforms). Args: q: The query Tensor of shape [...
tensor2tensor/layers/message_passing_attention.py
def dot_product_mpnn_attention(q, k, v, adjacency_matrix, num_edge_types, num_transforms=None, use_weighted_sum=False, ...
def dot_product_mpnn_attention(q, k, v, adjacency_matrix, num_edge_types, num_transforms=None, use_weighted_sum=False, ...
[ "Dot", "product", "attention", "with", "edge", "vectors", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/message_passing_attention.py#L652-L783
[ "def", "dot_product_mpnn_attention", "(", "q", ",", "k", ",", "v", ",", "adjacency_matrix", ",", "num_edge_types", ",", "num_transforms", "=", "None", ",", "use_weighted_sum", "=", "False", ",", "name", "=", "None", ")", ":", "with", "tf", ".", "variable_sco...
272500b6efe353aeb638d2745ed56e519462ca31
train
ggnn_fast_dense
ggnn version of the MPNN from Gilmer et al. Let B be the number of batches. Let D be the size of the node hidden states. Let K be the size of the attention keys/queries. Let V be the size of the output of the ggnn. Let T be the number of transforms / edge types. Args: node_states: The value Tensor of ...
tensor2tensor/layers/message_passing_attention.py
def ggnn_fast_dense(node_states, adjacency_matrix, num_edge_types, total_value_depth, name=None): """ggnn version of the MPNN from Gilmer et al. Let B be the number of batches. Let D be the size of the node hidden states. Let K be ...
def ggnn_fast_dense(node_states, adjacency_matrix, num_edge_types, total_value_depth, name=None): """ggnn version of the MPNN from Gilmer et al. Let B be the number of batches. Let D be the size of the node hidden states. Let K be ...
[ "ggnn", "version", "of", "the", "MPNN", "from", "Gilmer", "et", "al", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/message_passing_attention.py#L786-L837
[ "def", "ggnn_fast_dense", "(", "node_states", ",", "adjacency_matrix", ",", "num_edge_types", ",", "total_value_depth", ",", "name", "=", "None", ")", ":", "# between the same nodes (with only one edge of each type. adjacency_matrix", "# will need to be converted to shape [B, T, N,...
272500b6efe353aeb638d2745ed56e519462ca31
train
compute_values
Compute values. If edge compatibilities is just adjacency, we get ggnn. Args: edge_compatibility: A tensor of shape [batch, num_transforms, length, depth] v: A tensor of shape [batch, num_transforms, length, depth] Returns: output: A [batch, length, depth] tensor
tensor2tensor/layers/message_passing_attention.py
def compute_values(edge_compatibility, v): """Compute values. If edge compatibilities is just adjacency, we get ggnn. Args: edge_compatibility: A tensor of shape [batch, num_transforms, length, depth] v: A tensor of shape [batch, num_transforms, length, depth] Returns: output: A [batch, length, dept...
def compute_values(edge_compatibility, v): """Compute values. If edge compatibilities is just adjacency, we get ggnn. Args: edge_compatibility: A tensor of shape [batch, num_transforms, length, depth] v: A tensor of shape [batch, num_transforms, length, depth] Returns: output: A [batch, length, dept...
[ "Compute", "values", ".", "If", "edge", "compatibilities", "is", "just", "adjacency", "we", "get", "ggnn", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/message_passing_attention.py#L840-L860
[ "def", "compute_values", "(", "edge_compatibility", ",", "v", ")", ":", "# Computes the incoming value vectors for each node by weighting them", "# according to the attention weights. These values are still segregated by", "# edge type.", "# Shape = [B, T, N, V].", "all_edge_values", "=", ...
272500b6efe353aeb638d2745ed56e519462ca31
train
precompute_edge_matrices
Precompute the a_in and a_out tensors. (we don't want to add to the graph everytime _fprop is called) Args: adjacency: placeholder of real valued vectors of shape [B, L, L, E] hparams: HParams object Returns: edge_matrices: [batch, L * D, L * D] the dense matrix for message passing viewed as a bl...
tensor2tensor/layers/message_passing_attention.py
def precompute_edge_matrices(adjacency, hparams): """Precompute the a_in and a_out tensors. (we don't want to add to the graph everytime _fprop is called) Args: adjacency: placeholder of real valued vectors of shape [B, L, L, E] hparams: HParams object Returns: edge_matrices: [batch, L * D, L * D] ...
def precompute_edge_matrices(adjacency, hparams): """Precompute the a_in and a_out tensors. (we don't want to add to the graph everytime _fprop is called) Args: adjacency: placeholder of real valued vectors of shape [B, L, L, E] hparams: HParams object Returns: edge_matrices: [batch, L * D, L * D] ...
[ "Precompute", "the", "a_in", "and", "a_out", "tensors", "." ]
tensorflow/tensor2tensor
python
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/message_passing_attention.py#L863-L907
[ "def", "precompute_edge_matrices", "(", "adjacency", ",", "hparams", ")", ":", "batch_size", ",", "num_nodes", ",", "_", ",", "edge_dim", "=", "common_layers", ".", "shape_list", "(", "adjacency", ")", "# build the edge_network for incoming edges", "with", "tf", "."...
272500b6efe353aeb638d2745ed56e519462ca31