MCPcopy Create free account

hub / github.com/425776024/lasertagger-chinese / functions

Functions142 in github.com/425776024/lasertagger-chinese

↓ 6 callersFunctioncurLine
()
src/curLine_file.py:3
↓ 5 callersMethodbuild_bert_example
Constructs a BERT Example. Args: sources: List of source texts. target: Target text or None when building an example during inference
src/bert_example.py:130
↓ 4 callersFunction_shape_list
Return a list of the tensor's shape, and ensure no None values in list.
src/official_transformer/beam_search.py:567
↓ 4 callersFunctioninf
Returns a value close to infinity, but is still finite in `dtype`. This is useful to get a very large value that is still zero when multiplied by
src/official_transformer/beam_search.py:27
↓ 3 callersMethod__init__
Initialize layers to build Transformer model. Args: params: hyperparameter object defining layer sizes, dropout values, etc. train: b
src/official_transformer/transformer.py:47
↓ 3 callersFunction_get_fbeta_score
Compute Fbeta score. Args: true_positives: Number of true positive ngrams. selected: Number of selected ngrams. relevant: Number of rel
src/sari_hook.py:70
↓ 3 callersFunction_get_ngram_counter
Get a Counter with the ngrams of the given ID list. Args: ids: np.array or a list corresponding to a single sentence n: n-gram size Retu
src/sari_hook.py:50
↓ 3 callersMethodcompute_tags
Computes tags needed for converting the source into the target. Args: task: tagging.EditingTask that specifies the input.
src/tagging_converter.py:55
↓ 3 callersMethodget_token_labels
Returns labels/tags for the original tokens, not for wordpieces.
src/bert_example.py:92
↓ 3 callersMethodlinear
Computes logits by running x through a linear layer. Args: x: A float32 tensor with shape [batch_size, length, hidden_size] Returns:
src/official_transformer/embedding_layer.py:94
↓ 3 callersMethodsplit_heads
Split x into different heads, and transpose the resulting value. The tensor is transposed to insure the inner dimensions hold the correct val
src/official_transformer/attention_layer.py:47
↓ 2 callersMethod_compute_tags_fixed_order
Computes tags when the order of sources is fixed. Args: source_tokens: List of source tokens. target_tokens: List of toke
src/tagging_converter.py:83
↓ 2 callersFunction_expand_to_beam_size
Tiles a given tensor by beam_size. Args: tensor: tensor to tile [batch_size, ...] beam_size: How much to tile the tensor by. Returns:
src/official_transformer/beam_search.py:550
↓ 2 callersMethod_find_first_deletion_idx
Finds the start index of a span of deleted tokens. If `source_token_idx` is preceded by a span of deleted tokens, finds the start ind
src/tagging_converter.py:168
↓ 2 callersFunction_gather_beams
Gather beams from nested structure of tensors. Each tensor in nested represents a batch of beams, where beam refers to a single search state (bea
src/official_transformer/beam_search.py:628
↓ 2 callersFunction_gather_topk_beams
Gather top beams from nested structure.
src/official_transformer/beam_search.py:665
↓ 2 callersFunction_get_added_phrases
Computes the phrases that need to be added to the source to get the target. 计算需要被加入进去的短句,且尽可能长 英文是分成word sep=' ',中文是分成 字 sep=''
phrase_vocabulary_optimization.py:54
↓ 2 callersFunction_length_normalization
Return length normalization factor.
src/official_transformer/beam_search.py:545
↓ 2 callersMethod_truncate_list
Returns truncated version of x according to the self._max_seq_length.
src/bert_example.py:217
↓ 2 callersFunction_unflatten_beam_dim
Reshapes first dimension back to [batch_size, beam_size]. Args: tensor: Tensor to reshape of shape [batch_size*beam_size, ...] batch_size:
src/official_transformer/beam_search.py:612
↓ 2 callersMethoddecode
Generate logits for each value in the target sequence. Args: targets: target values for the output sequence. int tensor with shape
src/official_transformer/transformer.py:128
↓ 2 callersMethodpredict
Return predicted sequence.
src/official_transformer/transformer.py:205
↓ 2 callersFunctiontags_to_str
(tags)
src/test/tagging_converter_test.py:26
↓ 1 callersMethod__init__
Initializes an instance of a LaserTagger model. Args: config: LaserTagger model configuration. num_tags: Number of differ
src/utils/run_lasertagger_utils.py:69
↓ 1 callersFunction_added_token_counts
Computes how many times different phrases have to be added. 计算不同的短句,被添加多少次,以这些来建立优化的词汇表 Args: data_iterator: 迭代器,yield source lists
phrase_vocabulary_optimization.py:83
↓ 1 callersFunction_backtrack
Backtracks the Longest Common Subsequence table to reconstruct the LCS. Args: table: Precomputed LCS table. source: List of source tokens.
src/compute_lcs.py:24
↓ 1 callersFunction_compute_lcs
(source, target)
src/compute_lcs.py:4
↓ 1 callersMethod_compute_single_tag
Computes a single tag. The tag may match multiple target tokens (via tag.added_phrase) so we return the next unmatched target token.
src/tagging_converter.py:133
↓ 1 callersFunction_construct_added_phrases_matrix
Constructs a sparse phrase occurrence matrix. Examples are on rows and phrases on columns. Args: all_added_phrases: List of lists of a
phrase_vocabulary_optimization.py:123
↓ 1 callersFunction_count_covered_examples
Returns the number of examples whose added phrases are in the vocabulary. This assumes the vocabulary is created simply by selecting the `voc
phrase_vocabulary_optimization.py:149
↓ 1 callersMethod_create_initial_state
Return initial state dictionary and its shape invariants. Args: initial_ids: initial ids to pass into the symbols_to_logits_fn. int
src/official_transformer/beam_search.py:152
↓ 1 callersMethod_create_model
Creates a LaserTagger model.
src/utils/run_lasertagger_utils.py:98
↓ 1 callersFunction_decode_record
Decodes a record to a TensorFlow example.
run_lasertagger.py:132
↓ 1 callersMethod_first_char_to_lower
Lowcases the first character of the text.
src/tagging.py:144
↓ 1 callersMethod_first_char_to_upper
Upcases the first character of the text.
src/tagging.py:137
↓ 1 callersFunction_flatten_beam_dim
Reshapes first two dimensions in to single dimension. Args: tensor: Tensor to reshape of shape [A, B, ...] Returns: Reshaped tensor of s
src/official_transformer/beam_search.py:597
↓ 1 callersFunction_get_decoder_params
Returns hyperparameters for TransformerDecoder. Args: config: LaserTagger model configuration. use_tpu: Whether to train on TPUs.
src/utils/run_lasertagger_utils.py:255
↓ 1 callersMethod_get_new_alive_state
Gather the top k sequences that are still alive. Args: new_seq: New sequences generated by growing the current alive sequences int3
src/official_transformer/beam_search.py:413
↓ 1 callersMethod_get_new_finished_state
Combine new and old finished sequences, and gather the top k sequences. Args: state: A dictionary with the current loop state. new_se
src/official_transformer/beam_search.py:443
↓ 1 callersMethod_get_pad_id
Returns the ID of the [PAD] token (or 0 if it's not in the vocab).
src/bert_example.py:222
↓ 1 callersMethod_get_symbols_to_logits_fn
Returns a decoding function that calculates logits of the next tokens.
src/official_transformer/transformer.py:166
↓ 1 callersMethod_grow_alive_seq
Grow alive sequences by one token, and collect top 2*beam_size sequences. 2*beam_size sequences are collected because some sequences may have rea
src/official_transformer/beam_search.py:341
↓ 1 callersFunction_lcs_table
Returns the Longest Common Subsequence dynamic programming table.
src/compute_lcs.py:10
↓ 1 callersFunction_log_prob_from_logits
(logits)
src/official_transformer/beam_search.py:541
↓ 1 callersMethod_realize_sequence
Realizes output text corresponding to a single source text. Args: tokens: Tokens of the source text. tags: Tags indicating the edit o
src/tagging.py:115
↓ 1 callersMethod_split_to_wordpieces
Splits tokens (and the labels accordingly) to WordPieces. Args: tokens: Tokens to be split. labels: Labels (one per token) to be spli
src/bert_example.py:194
↓ 1 callersFunction_write_example_count
(count: int)
preprocess_main.py:59
↓ 1 callersFunction_yield_wikisplit_examples
( input_file)
src/utils/utils.py:46
↓ 1 callersMethodbuild
Returns `model_fn` closure for TPUEstimator.
src/utils/run_lasertagger_utils.py:158
↓ 1 callersMethodcall
Apply attention mechanism to x and y. Args: x: a tensor with shape [batch_size, length_x, hidden_size] y: a tensor with shape [batch_
src/official_transformer/attention_layer.py:87
↓ 1 callersMethodcombine_heads
Combine tensor that has been split. Args: x: A tensor [batch_size, num_heads, length, hidden_size/num_heads] Returns: A tensor w
src/official_transformer/attention_layer.py:72
↓ 1 callersMethodencode
Generate continuous representation for inputs. Args: inputs: int tensor with shape [batch_size, input_length]. attention_bias: float
src/official_transformer/transformer.py:100
↓ 1 callersFunctionfile_based_input_fn_builder
Creates an `input_fn` closure to be passed to TPUEstimator. 输入函数
run_lasertagger.py:117
↓ 1 callersFunctionget_addition_score
Compute the addition score (Equation 4 in the paper).
src/sari_hook.py:97
↓ 1 callersFunctionget_deletion_score
Compute the deletion score (Equation 6 in the paper).
src/sari_hook.py:121
↓ 1 callersFunctionget_keep_score
Compute the keep score (Equation 5 in the paper).
src/sari_hook.py:110
↓ 1 callersFunctionget_padding
Return float tensor representing the padding values in x. Args: x: int tensor with any shape padding_value: int value that dtype: The d
src/official_transformer/model_utils.py:88
↓ 1 callersFunctionget_sari
Computes the SARI scores from the given source, prediction and targets. Args: source_ids: A 2D tf.Tensor of size (batch_size , sequence_length)
src/sari_hook.py:182
↓ 1 callersFunctionget_sari_score
Compute the SARI score for a single prediction and one or more targets. Args: source_ids: a list / np.array of SentencePiece IDs prediction
src/sari_hook.py:132
↓ 1 callersMethodpad_to_max_length
Pad the feature vectors so that they all have max_seq_length. Args: max_seq_length: The length that features will have after padding.
src/bert_example.py:65
↓ 1 callersMethodpredict_batch
Returns realized prediction for given sources.
src/utils/predict_utils.py:49
↓ 1 callersMethodrealize_output
Realize output text based on the source tokens and predicted tags. Args: tags: Predicted tags (one for each token in `self.source_tokens`).
src/tagging.py:151
↓ 1 callersMethodsearch
Beam search for sequences with highest scores.
src/official_transformer/beam_search.py:128
↓ 1 callersFunctionserving_input_fn
()
run_lasertagger.py:244
↓ 1 callersMethodsymbols_to_logits_fn
Generate logits for next potential IDs. Args: ids: Current decoded sequences. int tensor with shape [batch_size * beam_size,
src/official_transformer/transformer.py:174
↓ 1 callersMethodto_tf_example
Returns this object as a tf.Example.
src/bert_example.py:81
Method__call__
Calculates target logits or inferred target sequences. Args: inputs: int tensor with shape [batch_size, input_length]. encoder_output
src/transformer_decoder.py:58
Method__call__
Calculate target logits or inferred target sequences. Args: inputs: int tensor with shape [batch_size, input_length]. targets: None o
src/official_transformer/transformer.py:64
Method__call__
(self, x, *args, **kwargs)
src/official_transformer/transformer.py:277
Method__init__
Constructs a Tag object by parsing tag to tag_type and added_phrase. Args: tag: String representation for the tag which should have the fol
src/tagging.py:54
Method__init__
Initializes an instance of EditingTask. Args: sources: A list of source strings. Typically contains only one string but for sentenc
src/tagging.py:94
Method__init__
phrase_vocabulary: Iterable of phrase vocabulary items (strings). do_swap: Whether to enable the SWAP tag.
src/tagging_converter.py:35
Method__init__
Initializes layers to build Transformer model. Args: params: hyperparameter object defining layer sizes, dropout values, etc. train:
src/transformer_decoder.py:39
Method__init__
(self, params, train)
src/transformer_decoder.py:145
Method__init__
(self, input_ids, input_mask, segment_ids, labels, labels_mask,
src/bert_example.py:41
Method__init__
Initializes an instance of BertExampleBuilder. Args: label_map: Mapping from tags to tag IDs. vocab_file: Path to BERT vocabulary fil
src/bert_example.py:109
Method__init__
Initializes an instance of LaserTaggerPredictor. Args: tf_predictor: Loaded Tensorflow model. example_builder: BERT example builder.
src/utils/predict_utils.py:33
Method__init__
Initializes an instance of LaserTagger configuration. This initializer expects both the BERT specific arguments and the Transformer d
src/utils/run_lasertagger_utils.py:33
Method__init__
(self, hidden_size, filter_size, relu_dropout, train, allow_pad)
src/official_transformer/ffn_layer.py:28
Method__init__
Initialize sequence beam search. Args: symbols_to_logits_fn: A function to provide logits, which is the interface to the Transforme
src/official_transformer/beam_search.py:83
Method__init__
(self, hidden_size)
src/official_transformer/transformer.py:248
Method__init__
(self, layer, params, train)
src/official_transformer/transformer.py:269
Method__init__
(self, params, train)
src/official_transformer/transformer.py:299
Method__init__
(self, params, train)
src/official_transformer/transformer.py:356
Method__init__
(self, hidden_size, num_heads, attention_dropout, train)
src/official_transformer/attention_layer.py:28
Method__init__
Specify characteristic parameters of embedding layer. Args: vocab_size: Number of tokens in the embedding. (Typically ~32,000) hidden
src/official_transformer/embedding_layer.py:30
Method__str__
(self)
src/tagging.py:78
Function_calculate_steps
Calculates the number of steps. warmup_proportion: Proportion of warmup steps. Returns: Tuple (number of steps, number of warmup steps
src/utils/utils.py:22
Method_continue_search
Return whether to continue the search loop. The loops should terminate when 1) when decode length has been reached, or 2) when the wo
src/official_transformer/beam_search.py:259
Function_get_shape
Return the shape of the input tensor.
src/official_transformer/beam_search.py:592
Function_get_shape_keep_last_dim
(tensor)
src/official_transformer/beam_search.py:580
Method_get_symbols_to_logits_fn
Returns a decoding function that calculates logits of the next tokens.
src/transformer_decoder.py:92
Function_input_fn
()
run_lasertagger.py:245
Method_search_step
Beam search loop body. Grow alive sequences by a single ID. Sequences that have reached the EOS token are marked as finished. The alive and f
src/official_transformer/beam_search.py:309
Methodbuild
(self, _)
src/official_transformer/transformer.py:252
Methodbuild
(self, _)
src/official_transformer/embedding_layer.py:50
Methodcall
Returns the output of the decoder layer stacks. Args: decoder_inputs: tensor with shape [batch_size, target_length, hidden_size] enco
src/transformer_decoder.py:170
Methodcall
Return outputs of the feedforward network. Args: x: tensor with shape [batch_size, length, hidden_size] padding: (optional) If set, t
src/official_transformer/ffn_layer.py:41
Methodcall
(self, x, epsilon=1e-6)
src/official_transformer/transformer.py:259
Methodcall
Return the output of the encoder layer stacks. Args: encoder_inputs: tensor with shape [batch_size, input_length, hidden_size] attent
src/official_transformer/transformer.py:318
next →1–100 of 142, ranked by callers