Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/YunwenTechnology/QueryGeneration
/ functions
Functions
82 in github.com/YunwenTechnology/QueryGeneration
⨍
Functions
82
◇
Types & classes
7
↓ 16 callers
Function
get_shape_list
Returns a list of the shape of tensor, preferring static dimensions. Args: tensor: A tf.Tensor object to find the shape of. expected_
train/utils.py:48
↓ 6 callers
Function
create_initializer
Creates a `truncated_normal_initializer` with the given range.
train/modeling.py:101
↓ 4 callers
Function
convert_by_vocab
Converts a sequence of [tokens|ids] using the vocab.
tokenization/tokenization.py:123
↓ 3 callers
Function
_attention_projection_and_transpose
:param x_flat: [batch_size*seq_length, width] :return: A fixed up tensor of size [batch_size, num_attention_heads, seq_length, size_per_head]
train/modeling.py:106
↓ 3 callers
Method
close
(self)
dataset/prepare_data.py:99
↓ 3 callers
Function
convert_to_unicode
Converts `text` to Unicode (if it's not already), assuming utf-8 input.
tokenization/tokenization.py:65
↓ 3 callers
Function
layer_norm
Run layer normalization on the last dimension of the tensor.
train/utils.py:101
↓ 3 callers
Method
tokenize
(self, text)
tokenization/tokenization.py:157
↓ 3 callers
Function
whitespace_tokenize
Runs basic whitespace cleaning and splitting on a piece of text.
tokenization/tokenization.py:139
↓ 3 callers
Method
write
(self, x)
dataset/prepare_data.py:96
↓ 2 callers
Function
_decode_record
Decodes a record to a TensorFlow example.
train/dataloader.py:8
↓ 2 callers
Function
_top_p_sample
Does top-p sampling. if ignore_ids is on, then we will zero out those logits. :param logits: [batch_size, vocab_size] tensor :param ignor
train/modeling.py:312
↓ 2 callers
Method
convert_ids_to_tokens
(self, ids)
tokenization/tokenization.py:168
↓ 2 callers
Method
convert_tokens_to_ids
(self, tokens)
tokenization/tokenization.py:165
↓ 2 callers
Function
dropout
Perform dropout. Args: input_tensor: float Tensor. dropout_prob: Python float. The probability of dropping out a value (NOT of
train/utils.py:115
↓ 2 callers
Method
from_json_file
Constructs a `NewsConfig` from a json file of parameters.
train/modeling.py:71
↓ 2 callers
Function
reduce_rms
(x)
train/optimization_adafactor.py:231
↓ 2 callers
Function
sample_step
Helper function that samples from grover for a single step :param tokens: [batch_size, n_ctx_b] tokens that we will predict from :param i
train/modeling.py:655
↓ 1 callers
Method
_clean_text
Performs invalid character removal and whitespace cleanup on text.
tokenization/tokenization.py:273
↓ 1 callers
Method
_do_use_weight_decay
Whether to use L2 weight decay for `param_name`.
train/optimization_adafactor.py:213
↓ 1 callers
Method
_get_variable_name
Get the variable name from the tensor name.
train/optimization_adafactor.py:223
↓ 1 callers
Method
_is_chinese_char
Checks whether CP is the codepoint of a CJK character.
tokenization/tokenization.py:251
↓ 1 callers
Function
_is_control
Checks whether `chars` is a control character.
tokenization/tokenization.py:361
↓ 1 callers
Function
_is_punctuation
Checks whether `chars` is a punctuation character.
tokenization/tokenization.py:373
↓ 1 callers
Function
_is_whitespace
Checks whether `chars` is a whitespace character.
tokenization/tokenization.py:349
↓ 1 callers
Method
_run_split_on_punc
Splits punctuation on a piece of text.
tokenization/tokenization.py:218
↓ 1 callers
Method
_run_strip_accents
Strips accents from a piece of text.
tokenization/tokenization.py:207
↓ 1 callers
Method
_tokenize_chinese_chars
Adds whitespace around any CJK character.
tokenization/tokenization.py:238
↓ 1 callers
Function
_top_k_sample
Does top-k sampling. if ignore_ids is on, then we will zero out those logits. :param logits: [batch_size, vocab_size] tensor :param ignor
train/modeling.py:366
↓ 1 callers
Method
_use_factored
(self, shape)
train/optimization_adafactor.py:112
↓ 1 callers
Method
apply_gradients
See base class.
train/optimization_adafactor.py:128
↓ 1 callers
Function
article_iterator
Iterate through the provided filename + tokenize
dataset/prepare_data.py:131
↓ 1 callers
Function
assert_rank
Raises an exception if the tensor rank is not of the expected rank. Args: tensor: A tf.Tensor to check the rank of. expected_rank: Py
train/utils.py:18
↓ 1 callers
Function
attention_layer
:param x_flat: Tensor input, should be [batch_size*seq_length, dim] :param attention_mask: Attention mask to use of size [seq_length, seq_le
train/modeling.py:131
↓ 1 callers
Function
buffered_and_sliding_window_article_iterator
We apply a sliding window to fix long sequences, and use a buffer that combines short sequences.
dataset/prepare_data.py:172
↓ 1 callers
Function
create_int_feature
(values)
dataset/prepare_data.py:166
↓ 1 callers
Function
embed
reur and position embeddings :param input_ids: int Tensor of shape [batch_size, seq_length]. :param vocab_size: number of words in vocab :
train/modeling.py:243
↓ 1 callers
Function
extract_generated_target
Given some tokens that were generated, extract the target :param output_tokens: [num_tokens] thing that was generated :param encoder: how
scripts/interactive_conditional_samples.py:99
↓ 1 callers
Method
from_dict
Constructs a `NewsConfig` from a Python dictionary of parameters.
train/modeling.py:63
↓ 1 callers
Function
get_assignment_map_from_checkpoint
Compute the union of the current variables and checkpoint variables.
train/utils.py:143
↓ 1 callers
Function
get_attention_mask
this is a TPU compatible version of tf.matrix_band_part(tf.ones([nd, ns]), -1, ns-nd) where the lower right triangle contains 1s
train/utils.py:132
↓ 1 callers
Function
initialize_from_context
same signature as sample_step
train/modeling.py:700
↓ 1 callers
Function
input_fn_builder
Creates an `input_fn` closure to be passed to TPUEstimator.
train/dataloader.py:22
↓ 1 callers
Method
lm_loss
:return: stuff
train/modeling.py:513
↓ 1 callers
Function
load_vocab
Loads a vocabulary file into a dictionary.
tokenization/tokenization.py:108
↓ 1 callers
Function
mask_attention_for_ltr
Mask attention so that we're only predicting going forward :param attention_scores: [batch, heads, dst_sequence, src_sequence], where informa
train/modeling.py:87
↓ 1 callers
Function
model_fn_builder
Returns `model_fn` closure for TPUEstimator.
train/modeling.py:549
↓ 1 callers
Function
residual_mlp_layer
:param x: The attention output. It should be [batch_size*seq_length, dim] :param intermediate_size: the hidden projection. By default this is
train/modeling.py:212
↓ 1 callers
Function
sample
V1 version of: sample outputs from a model, and do it all at once :param news_config: Configuration used to construct the model :param in
train/modeling.py:713
↓ 1 callers
Method
to_dict
Serializes this instance to a Python dictionary.
train/modeling.py:77
Method
__enter__
(self)
dataset/prepare_data.py:120
Method
__exit__
(self, *_)
dataset/prepare_data.py:124
Method
__init__
(self, vocab_file, do_lower_case=True)
tokenization/tokenization.py:151
Method
__init__
Constructs a BasicTokenizer. Args: do_lower_case: Whether to lower case the input.
tokenization/tokenization.py:175
Method
__init__
(self, vocab, unk_token="[UNK]", max_input_chars_per_word=200)
tokenization/tokenization.py:290
Method
__init__
(self, fn)
dataset/prepare_data.py:65
Method
__init__
Constructs NewsConfig. Args: vocab_size: Vocabulary size of `inputs_ids` in `GroverModel`. hidden_size: Size of the layer
train/modeling.py:17
Method
__init__
:param config: :param is_training: :param input_ids: Tensor thats of size [batch_size, seq_length] :param cache: Opti
train/modeling.py:402
Method
__init__
Constructs a AdaFactorOptimizer.
train/optimization_adafactor.py:89
Method
_parameter_scale
Estimate the scale of the parameters from the current values. We include a minimum value of 0.001 to give it a chance to escape 0 if i
train/optimization_adafactor.py:115
Function
_save_np
(absolute_fn, array)
train/utils.py:10
Function
body
for whatever reason this didn't work when I ran it on more than one at once... ugh.
train/modeling.py:738
Function
classification_convert_examples_to_features
Convert a set of `InputExample`s to a TFRecord file.
train/dataloader.py:78
Function
classification_input_fn_builder
Creates an `input_fn` closure to be passed to TPUEstimator.
train/dataloader.py:120
Function
cond
(ctx, cache, probs)
train/modeling.py:751
Function
construct_scalar_host_call
Construct a host call to log scalars when training on TPU. Args: metric_dict: A dict of the tensors to be logged. model_dir: The loca
train/utils.py:169
Function
convert_ids_to_tokens
(inv_vocab, ids)
tokenization/tokenization.py:135
Function
convert_tokens_to_ids
(vocab, tokens)
tokenization/tokenization.py:131
Function
create_optimizer
Creates an optimizer training op.
train/optimization_adafactor.py:20
Function
gelu
Gaussian Error Linear Unit. This is a smoother version of the RELU. Original paper: https://arxiv.org/abs/1606.08415 Args: input_t
train/utils.py:85
Function
host_call_fn
Training host call. Creates scalar summaries for training metrics. This function is executed on the CPU and should not directly reference
train/utils.py:182
Function
input_fn
The actual input function.
train/dataloader.py:30
Method
log_probs
(self)
train/modeling.py:509
Function
main
(_)
train/train_run_query2query_mega.py:52
Function
metric_fn
(total_loss)
train/modeling.py:615
Function
model_fn
The `model_fn` for TPUEstimator.
train/modeling.py:553
Method
pooled_output
Extract pooled output given a token that says where we should look :param clf_token: :return:
train/modeling.py:539
Function
printable_text
Returns text encoded in a way suitable for print or `tf.logging`.
tokenization/tokenization.py:85
Method
to_json_string
Serializes this instance to a JSON string.
train/modeling.py:82
Method
tokenize
Tokenizes a piece of text.
tokenization/tokenization.py:183
Method
tokenize
Tokenizes a piece of text into its word pieces. This uses a greedy longest-match-first algorithm to perform tokenization using the given voca
tokenization/tokenization.py:295
Function
validate_case_matches_checkpoint
Checks whether the casing config is consistent with the checkpoint name.
tokenization/tokenization.py:15