Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/THUDM/GLM
/ functions
Functions
1,117 in github.com/THUDM/GLM
⨍
Functions
1,117
◇
Types & classes
200
↓ 353 callers
Method
append
(self, other)
data_utils/tokenization.py:113
↓ 107 callers
Function
print_rank_0
(message)
utils.py:44
↓ 92 callers
Method
get_command
get command token corresponding to `name`
data_utils/tokenization.py:277
↓ 80 callers
Method
extend
(self, other)
data_utils/tokenization.py:126
↓ 63 callers
Method
shortenable
Return an instance of this string that is marked as shortenable
tasks/superglue/pvp.py:100
↓ 59 callers
Method
EncodeAsIds
encode text using text tokenizer and shift Id values for command tokens
data_utils/tokenization.py:325
↓ 40 callers
Method
write
given a generator of metrics for each of the data points X_i, write the metrics, text, and labels to a csv file
data_utils/datasets.py:333
↓ 37 callers
Function
punctuation_standardization
(string: str)
data_utils/corpora.py:31
↓ 36 callers
Method
DecodeIds
convert Ids to tokens accounting for command and type tokens, tokens are joined and returned as a string.
data_utils/tokenization.py:427
↓ 26 callers
Method
exists
check if the filepath for a text tokenizer exists
data_utils/tokenization.py:507
↓ 26 callers
Method
load
(module, prefix='')
model/modeling_bert.py:831
↓ 24 callers
Method
process_sample
(cls, text, tokenizer, tokenize)
data_utils/corpora.py:169
↓ 23 callers
Method
__init__
(self, config)
model/modeling_bert.py:513
↓ 22 callers
Method
encode
Encode an input example using this pattern-verbalizer pair. :param example: the input example to encode :param priming: whet
tasks/superglue/pvp.py:166
↓ 19 callers
Method
start
Start the timer.
utils.py:125
↓ 15 callers
Method
apply
(self, args, tokenizer)
configure_data.py:103
↓ 14 callers
Function
divide
Ensure that numerator is divisible by the denominator and return the division value.
mpu/utils.py:26
↓ 14 callers
Function
set_random_seed
Set random seed for reproducability.
mpu/tests/commons.py:33
↓ 14 callers
Method
stop
Stop the timer.
utils.py:132
↓ 13 callers
Function
get_model_parallel_group
Get the model parallel group the caller rank belongs to.
mpu/initialize.py:88
↓ 13 callers
Function
print_separator
(message)
mpu/tests/commons.py:75
↓ 13 callers
Method
remove_final_punc
Remove the final punctuation mark
tasks/superglue/pvp.py:105
↓ 11 callers
Function
build_input_from_ids
(text_a_ids, text_b_ids, answer_ids, max_seq_length, tokenizer, args=None, add_cls=True,
tasks/data_utils.py:144
↓ 11 callers
Function
build_sample
Convert to numpy and return a sample consumed by the batch producer.
tasks/data_utils.py:266
↓ 11 callers
Function
get_model_parallel_world_size
Return world size for the model parallel group.
mpu/initialize.py:102
↓ 10 callers
Method
IdToToken
convert Id to token accounting for command and type tokens
data_utils/tokenization.py:407
↓ 10 callers
Method
encode
(self, text)
data_utils/sp_tokenizer.py:82
↓ 10 callers
Method
lowercase_first
Lowercase the first character
tasks/superglue/pvp.py:112
↓ 9 callers
Method
backward
(ctx, *args)
mpu/random.py:332
↓ 9 callers
Method
decode
(self, tokens)
data_utils/sp_tokenizer.py:85
↓ 9 callers
Function
get_model_parallel_rank
Return my rank for the model parallel group.
mpu/initialize.py:107
↓ 9 callers
Function
load_weights
Loads weights from src to dst via in place copy. src is a huggingface gpt2model, while dst is one of our models. dst2src=True loads param
utils.py:414
↓ 9 callers
Method
replace_prompt_tokens
(self, parts_a, parts_b)
tasks/superglue/pvp.py:129
↓ 9 callers
Method
state_dict
(self, destination=None, prefix='', keep_vars=False)
fp16/fp16.py:78
↓ 8 callers
Method
_create_examples
(self, path: str, set_type: str, hypothesis_name: str = "hypothesis", premise_name: s
tasks/superglue/dataset.py:325
↓ 8 callers
Method
close
(self)
data_utils/lazy_loader.py:91
↓ 7 callers
Method
add
Add a new hypothesis to the list.
generation_utils.py:362
↓ 7 callers
Method
get_labels
(self)
tasks/superglue/dataset.py:375
↓ 7 callers
Function
get_verbalization_ids
Get the token ids corresponding to a verbalization :param word: the verbalization :param tokenizer: the tokenizer to use :param forc
tasks/superglue/pvp.py:1369
↓ 7 callers
Method
load_state_dict
(self, state_dict, strict=True)
fp16/fp16.py:81
↓ 7 callers
Function
make_data_loader
(dataset, tokenizer, batch_size, num_iters, args, shuffle=False, block_collate=False)
configure_data.py:154
↓ 7 callers
Function
read_tsv
(path, **kwargs)
tasks/superglue/dataset.py:60
↓ 6 callers
Method
__init__
(self, hidden_size, output_dropout_prob, init_method, output_layer_init_method=None)
mpu/transformer.py:362
↓ 6 callers
Method
_create_examples
(self, *args, **kwargs)
tasks/superglue/dataset.py:315
↓ 6 callers
Function
exists_scatter
(path, scatter_num=64, data_type='data')
data_utils/lazy_loader.py:54
↓ 6 callers
Method
fork
Fork the cuda rng state, perform operations, and exit with the original state.
mpu/random.py:169
↓ 6 callers
Method
from_pretrained
Instantiate a PreTrainedBertModel from a pre-trained model file. Download and cache the pre-trained model file if needed.
data_utils/wordpiece.py:138
↓ 6 callers
Function
get_cuda_rng_tracker
Get cuda rng tracker.
mpu/random.py:193
↓ 6 callers
Function
num_special_tokens_to_add
(text_a_ids, text_b_ids, answer_ids, add_cls, add_sep, add_piece, add_eos=True)
tasks/data_utils.py:93
↓ 6 callers
Method
step
If no closure is supplied, :attr:`step` should be called after ``fp16_optimizer_obj.backward(loss)``. :attr:`step` updates t
fp16/fp16.py:411
↓ 6 callers
Method
truncate
Truncate two sequences of text to a predefined total maximum length
tasks/superglue/pvp.py:338
↓ 5 callers
Function
_set_cuda_rng_state
Sets the random number generator state of the current GPU. Argumentss: new_state (torch.ByteTensor): The desired state This function
mpu/random.py:85
↓ 5 callers
Function
exists_lazy
Check if we've already made a lazy version of this file for the `data_type` field.
data_utils/lazy_loader.py:34
↓ 5 callers
Function
get_lazy_path
Gets directory path where lazy files are stored.
data_utils/lazy_loader.py:27
↓ 5 callers
Function
initialize_distributed
Initialize torch.distributed.
mpu/tests/commons.py:41
↓ 5 callers
Method
log
Log a group of timers.
utils.py:168
↓ 5 callers
Method
maybe_print
(self, msg)
fp16/fp16.py:254
↓ 5 callers
Function
save_checkpoint
Save a model checkpoint.
utils.py:224
↓ 5 callers
Method
set_command_tokens
(self, command_tokens)
data_utils/tokenization.py:80
↓ 5 callers
Method
verbalize
Return all verbalizations for a given label. :param label: the label :return: the list of verbalizations
tasks/superglue/pvp.py:381
↓ 4 callers
Method
SetTokenizer
(self, tokenizer)
data_utils/datasets.py:297
↓ 4 callers
Function
_initialize_affine_weight
Initialize affine weight for model parallel. Build the master weight on all processes and scatter the relevant chunk.
mpu/layers.py:36
↓ 4 callers
Method
_seq_length
(parts: List[Tuple[List[int], bool]], only_shortenable: bool = False)
tasks/superglue/pvp.py:330
↓ 4 callers
Method
_transpose_for_scores
Transpose a 3D tensor [b, s, np*hn] into a 4D tensor with size [b, np, s, hn].
mpu/transformer.py:224
↓ 4 callers
Function
build_data_loader
Data loader. Note that batch-size is the local (per GPU) batch-size.
tasks/data_utils.py:362
↓ 4 callers
Function
evaluate_and_print_results
Helper function to evaluate and dump results on screen.
pretrain_glm.py:441
↓ 4 callers
Function
finetune
Main finetune function used across all tasks.
finetune_glm.py:282
↓ 4 callers
Function
get_checkpoint_name
(checkpoints_path, iteration, release=False, zero=False)
utils.py:194
↓ 4 callers
Function
get_masks_and_position_ids
(data, eod_token, reset_position_ids,
pretrain_glm.py:47
↓ 4 callers
Method
get_states
Get rng states. Copy the dictionary so we have direct pointers to the states, not just a pointer to the dictionary.
mpu/random.py:138
↓ 4 callers
Method
get_text_len
(self, idx)
data_utils/datasets.py:164
↓ 4 callers
Function
load_checkpoint
Load a model checkpoint.
utils.py:327
↓ 4 callers
Function
normalize_answer
Lower text and remove punctuation, articles and extra whitespace.
tasks/superglue/evaluate.py:17
↓ 4 callers
Function
split_tensor_along_last_dim
Split a tensor along its last dimension. Arguments: tensor: input tensor. num_partitions: number of partitions to split the tensor
mpu/utils.py:33
↓ 4 callers
Method
tokenize
(self, text)
data_utils/sp_tokenizer.py:89
↓ 3 callers
Method
GetTokenizer
(self)
data_utils/datasets.py:306
↓ 3 callers
Method
__init__
(self, language_model: GLMModel, take_softmax=True, length_penalty=0.0)
model/downstream.py:9
↓ 3 callers
Method
__init__
(self, args)
tasks/superglue/dataset.py:227
↓ 3 callers
Method
__init__
(self, num_embeddings, embedding_dim, init_method=init.xavier_normal_, keep_
mpu/layers.py:140
↓ 3 callers
Method
_create_examples
(path, set_type, for_train=False)
tasks/superglue/dataset.py:708
↓ 3 callers
Method
_create_examples
(path: str, set_type: str)
tasks/superglue/dataset.py:903
↓ 3 callers
Method
_create_examples
(path: str, set_type: str)
tasks/superglue/dataset.py:1175
↓ 3 callers
Method
_create_examples
(self, path: str, set_type: str)
tasks/superglue/dataset.py:1342
↓ 3 callers
Method
_create_examples
(self, path: str, set_type: str, cloze_eval=True)
tasks/superglue/dataset.py:1370
↓ 3 callers
Method
_create_examples
(path: str, set_type: str)
tasks/superglue/dataset.py:1412
↓ 3 callers
Method
_model_params_to_master_params
(self)
fp16/fp16.py:307
↓ 3 callers
Method
_transpose_for_scores
Transpose a 3D tensor [b, s, np*hn] into a 4D tensor with size [b, np, s, hn].
mpu/transformer.py:98
↓ 3 callers
Method
backward
:attr:`backward` performs the following conceptual steps: 1. fp32_loss = loss.float() (see first Note below) 2. scaled_loss
fp16/fp16.py:506
↓ 3 callers
Method
contains_sentence_end
(self, tok)
blocklm_utils.py:76
↓ 3 callers
Method
contains_sentence_end
(self, tok)
data_utils/datasets.py:698
↓ 3 callers
Method
cumsum
(sequence)
data_utils/datasets.py:68
↓ 3 callers
Method
elapsed
Calculate the elapsed time.
utils.py:144
↓ 3 callers
Method
encode
(self, example: InputExample, tokenizer, seq_length, args)
tasks/superglue/dataset.py:268
↓ 3 callers
Function
get_args
Parse all the args.
arguments.py:398
↓ 3 callers
Function
get_batch
get_batch subdivides the source data into chunks of length args.seq_length. If source is equal to the example output of the data loading exam
pretrain_glm.py:144
↓ 3 callers
Method
get_lr
(self)
learning_rates.py:40
↓ 3 callers
Function
get_scatter_path
(path, scatter_rank)
data_utils/lazy_loader.py:48
↓ 3 callers
Function
initialize_distributed
Initialize torch.distributed.
pretrain_glm.py:476
↓ 3 callers
Function
lm_forward_step
Forward step.
tasks/language_model/finetune.py:33
↓ 3 callers
Method
pad_seq
(self, seq, pad_id=None)
data_utils/datasets.py:563
next →
1–100 of 1,117, ranked by callers