MCPcopy Create free account

hub / github.com/ant-louis/belgpt2 / functions

Functions256 in github.com/ant-louis/belgpt2

↓ 55 callersMethodformat
(self, record)
scripts/tools/xlm/logger.py:18
↓ 18 callersMethodindex
Returns the index of the specified word.
scripts/tools/xlm/data/dictionary.py:89
↓ 17 callersMethodcuda
(self)
scripts/tools/xlm/model/embedder.py:78
↓ 14 callersFunctionto_cuda
Move tensors to CUDA.
scripts/tools/xlm/utils.py:122
↓ 13 callersMethodtrain
Finetune for one epoch on the training set.
scripts/tools/xlm/evaluation/glue.py:117
↓ 12 callersMethodstep
Step.
scripts/tools/xlm/optim.py:45
↓ 11 callersFunctionconcat_batches
Concat batches with different languages.
scripts/tools/xlm/utils.py:213
↓ 11 callersFunctiontruncate
Truncate long sentences.
scripts/tools/xlm/utils.py:240
↓ 10 callersMethodeval
Evaluate on XNLI validation and test sets, for all languages.
scripts/tools/xlm/evaluation/glue.py:187
↓ 9 callersFunctionload_binarized
Load a binarized dataset.
scripts/tools/xlm/data/loader.py:54
↓ 9 callersFunctionset_dico_parameters
Update dictionary parameters.
scripts/tools/xlm/data/loader.py:74
↓ 8 callersFunctionget_optimizer
Parse optimizer parameters. Input should be of the form: - "sgd,lr=0.01" - "adagrad,lr=0.1,lr_decay=0.05"
scripts/tools/xlm/optim.py:211
↓ 7 callersFunctionLinear
(in_features, out_features, bias=True)
scripts/tools/xlm/model/transformer.py:54
↓ 7 callersMethodget_batch
Return a batch of sentences from a dataset.
scripts/tools/xlm/trainer.py:335
↓ 6 callersMethodget_embeddings
Inputs: `x` : LongTensor of shape (slen, bs) `lengths` : LongTensor of shape (bs,) Outputs:
scripts/tools/xlm/model/embedder.py:126
↓ 5 callersMethodcheck_valid
Check that the dictionary is valid.
scripts/tools/xlm/data/dictionary.py:70
↓ 5 callersFunctioncleaner
Clean up an input text
scripts/tools/clean_text.py:73
↓ 5 callersMethodoptimize
Optimize.
scripts/tools/xlm/trainer.py:217
↓ 4 callersMethod__init__
( self, input_dim, heads, k_dim, product_quantization, multi_query_net, sizes, bias=True, batc
scripts/tools/xlm/model/memory/query.py:155
↓ 4 callersMethodcheck
Sanity checks.
scripts/tools/xlm/data/dataset.py:109
↓ 4 callersMethodcheck
Sanity checks.
scripts/tools/xlm/data/dataset.py:277
↓ 4 callersFunctiondir2ids
Get a list of valid book ids from an input directory Returns: list of book ids
scripts/tools/gutenberg_downloader.py:27
↓ 4 callersMethodgenerate
Decode a sentence given initial start. `x`: - LongTensor(bs, slen) <EOS> W1 W2 W3 <EOS> <PAD>
scripts/tools/xlm/model/transformer.py:477
↓ 4 callersMethodget_iterator
Create a new iterator for a dataset.
scripts/tools/xlm/evaluation/evaluator.py:113
↓ 3 callersFunctionEmbedding
(num_embeddings, embedding_dim, padding_idx=None)
scripts/tools/xlm/model/transformer.py:46
↓ 3 callersMethod__init__
(self, params)
scripts/tools/xlm/model/transformer.py:110
↓ 3 callersMethod__init__
(self, input_dim, output_dim, params)
scripts/tools/xlm/model/memory/memory.py:25
↓ 3 callersMethodbatch_sentences
Take as input a list of n sentences (torch.LongTensor vectors) and return a tensor of size (slen, n) where slen is the length of the
scripts/tools/xlm/data/dataset.py:117
↓ 3 callersFunctionconvert_to_text
Convert a batch of sentences to a list of text sentences.
scripts/tools/xlm/evaluation/evaluator.py:580
↓ 3 callersFunctionconvs
Generate a convolutional neural network.
scripts/tools/xlm/model/memory/query.py:28
↓ 3 callersFunctioneval_memory_usage
Evaluate memory usage (HashingMemory / FFN).
scripts/tools/xlm/evaluation/evaluator.py:46
↓ 3 callersMethodget_parameters
(self, layer_range)
scripts/tools/xlm/model/embedder.py:81
↓ 3 callersFunctionmlp
Generate a feedforward neural network.
scripts/tools/xlm/model/memory/query.py:7
↓ 3 callersFunctionrestore_segmentation
Take a file segmented with BPE and restore it to its original segmentation.
scripts/tools/xlm/utils.py:129
↓ 3 callersMethodround_batch
For float16 only. Sub-sample sentences in a batch, and add padding, so that each dimension is a multiple of 8.
scripts/tools/xlm/trainer.py:673
↓ 3 callersMethodsave_checkpoint
Save the model / checkpoints.
scripts/tools/xlm/trainer.py:518
↓ 3 callersFunctionset_pretrain_emb
Pretrain word embeddings.
scripts/tools/xlm/model/__init__.py:89
↓ 3 callersFunctionswig_ptr_from_FloatTensor
(x)
scripts/tools/xlm/model/memory/utils.py:72
↓ 2 callersMethod__init__
(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-8, weight_decay=0)
scripts/tools/xlm/optim.py:23
↓ 2 callersMethod__init__
Initialize trainer.
scripts/tools/xlm/trainer.py:34
↓ 2 callersMethod__init__
Initialize evaluator.
scripts/tools/xlm/evaluation/evaluator.py:86
↓ 2 callersMethod_get_indices
Generate scores and indices given keys and unnormalized queries.
scripts/tools/xlm/model/memory/memory.py:480
↓ 2 callersMethod_get_indices
Generate scores and indices given keys and unnormalized queries.
scripts/tools/xlm/model/memory/memory.py:570
↓ 2 callersFunction_sorted_checkpoints
(args, checkpoint_prefix="checkpoint", use_mtime=False)
scripts/tools/run_language_modeling.py:167
↓ 2 callersMethodadd_noise
Add noise to the encoder input.
scripts/tools/xlm/trainer.py:437
↓ 2 callersFunctioncartesian_product
Compute the batched cartesian product between two matrices. Input: a: Tensor(n, d1) b: Tensor(n, d2) Output: outp
scripts/tools/xlm/model/memory/utils.py:54
↓ 2 callersFunctioncreate_logger
Create a logger. Use a different log file for each process.
scripts/tools/xlm/logger.py:31
↓ 2 callersMethodeval
Evaluate on XNLI validation and test sets, for all languages.
scripts/tools/xlm/evaluation/flue.py:234
↓ 2 callersFunctionevaluate
(args, model: PreTrainedModel, tokenizer: PreTrainedTokenizer, prefix="")
scripts/tools/run_language_modeling.py:439
↓ 2 callersFunctionfind_modules
Recursively find all instances of a specific module inside a module.
scripts/tools/xlm/utils.py:285
↓ 2 callersMethodforward
Forward function with different forward modes. ### Small hack to handle PyTorch distributed.
scripts/tools/xlm/model/transformer.py:328
↓ 2 callersMethodgenerate_batch
Prepare a batch (for causal or non-causal mode).
scripts/tools/xlm/trainer.py:495
↓ 2 callersMethodget_iterator
Create a new iterator for a dataset.
scripts/tools/xlm/trainer.py:308
↓ 2 callersMethodget_iterator
Build data iterator.
scripts/tools/xlm/evaluation/glue.py:58
↓ 2 callersMethodget_iterator
Get a monolingual data iterator.
scripts/tools/xlm/evaluation/xnli.py:42
↓ 2 callersMethodget_iterator
Build data iterator.
scripts/tools/xlm/evaluation/flue.py:47
↓ 2 callersFunctionget_knn_faiss
`metric` can be faiss.METRIC_INNER_PRODUCT or faiss.METRIC_L2 https://github.com/facebookresearch/faiss/blob/master/gpu/test/test_pytorch_fai
scripts/tools/xlm/model/memory/utils.py:124
↓ 2 callersMethodget_lr_for_step
(self, num_updates)
scripts/tools/xlm/optim.py:186
↓ 2 callersMethodget_scores
Compute scores.
scripts/tools/xlm/model/transformer.py:143
↓ 2 callersFunctiongini_score
(x)
scripts/tools/xlm/evaluation/evaluator.py:33
↓ 2 callersFunctionid2url
Returns corresponding url to download from an input book id Args: ::book_id:: book ID number ::encoding:: encoding type pre
scripts/tools/gutenberg_downloader.py:42
↓ 2 callersFunctionkl_score
(x)
scripts/tools/xlm/evaluation/evaluator.py:26
↓ 2 callersFunctionload_and_cache_examples
(args, tokenizer, evaluate=False)
scripts/tools/run_language_modeling.py:137
↓ 2 callersFunctionload_embeddings
Reload pretrained embeddings.
scripts/tools/xlm/model/pretrain.py:88
↓ 2 callersFunctionmask_tokens
Prepare masked tokens inputs/labels for masked language modeling: 80% MASK, 10% random, 10% original.
scripts/tools/run_language_modeling.py:203
↓ 2 callersMethodremove_empty_sentences
Remove empty sentences.
scripts/tools/xlm/data/dataset.py:290
↓ 2 callersMethodselect_data
Only select a subset of the dataset.
scripts/tools/xlm/data/dataset.py:162
↓ 2 callersFunctionset_seed
(args)
scripts/tools/run_language_modeling.py:159
↓ 2 callersFunctionstrip_headers
Remove lines that are part of the Project Gutenberg header or footer. Note: this function is a port of the C++ utility by Johannes Krugel. Th
scripts/tools/gutenberg_cleaner.py:123
↓ 2 callersFunctiontops
(x)
scripts/tools/xlm/evaluation/evaluator.py:39
↓ 1 callersFunction_rotate_checkpoints
(args, checkpoint_prefix="checkpoint", use_mtime=False)
scripts/tools/run_language_modeling.py:185
↓ 1 callersMethodadd
Add a new hypothesis to the list.
scripts/tools/xlm/model/transformer.py:759
↓ 1 callersMethodbuild
(input_dim, output_dim, params)
scripts/tools/xlm/model/memory/memory.py:320
↓ 1 callersMethodcheck_params
Check and initialize memory parameters.
scripts/tools/xlm/model/memory/memory.py:332
↓ 1 callersFunctioncheck_url
Check if an url exists
scripts/tools/gutenberg_downloader.py:15
↓ 1 callersFunctionconvert_to_unicode
Converts `text` to Unicode (if it's not already), assuming UTF-8 input.
scripts/tools/clean_text.py:12
↓ 1 callersMethodcreate_keys
This function creates keys and returns them. I guess you could see that from the name of the function and the fact that is has a retu
scripts/tools/xlm/model/memory/memory.py:525
↓ 1 callersMethodcreate_reference_files
Create reference files for BLEU evaluation.
scripts/tools/xlm/evaluation/evaluator.py:162
↓ 1 callersFunctioncreate_sinusoidal_embeddings
(n_pos, dim, out)
scripts/tools/xlm/model/transformer.py:62
↓ 1 callersFunctiondownload_books
Download books from a list of book ids and save all to output_dir
scripts/tools/gutenberg_downloader.py:180
↓ 1 callersMethodeval
(self)
scripts/tools/xlm/model/embedder.py:75
↓ 1 callersMethodeval
Evaluate on XNLI validation and test sets, for all languages.
scripts/tools/xlm/evaluation/xnli.py:162
↓ 1 callersFunctioneval_moses_bleu
Given a file of hypothesis and reference files, evaluate the BLEU score using Moses scripts.
scripts/tools/xlm/evaluation/evaluator.py:603
↓ 1 callersMethodevaluate_clm
Evaluate perplexity and next word prediction accuracy.
scripts/tools/xlm/evaluation/evaluator.py:284
↓ 1 callersMethodevaluate_mlm
Evaluate perplexity and next word prediction accuracy.
scripts/tools/xlm/evaluation/evaluator.py:358
↓ 1 callersMethodevaluate_mt
Evaluate perplexity and next word prediction accuracy.
scripts/tools/xlm/evaluation/evaluator.py:471
↓ 1 callersMethodfwd
Inputs: `x` LongTensor(slen, bs), containing word indices `lengths` LongTensor(bs), containing the length of each sen
scripts/tools/xlm/model/transformer.py:340
↓ 1 callersFunctiongenerate
scripts/tools/generate_text.py:32
↓ 1 callersMethodgenerate_beam
Decode a sentence given initial start. `x`: - LongTensor(bs, slen) <EOS> W1 W2 W3 <EOS> <PAD>
scripts/tools/xlm/model/transformer.py:564
↓ 1 callersMethodget_batches_iterator
Return a sentences iterator, given the associated sentence batches.
scripts/tools/xlm/data/dataset.py:182
↓ 1 callersMethodget_batches_iterator
Return a sentences iterator, given the associated sentence batches.
scripts/tools/xlm/data/dataset.py:349
↓ 1 callersFunctionget_book_ids
Return a list of unique book ids from a list of book urls
scripts/tools/gutenberg_downloader.py:154
↓ 1 callersFunctionget_book_urls
Returns a list of unique book ids
scripts/tools/gutenberg_downloader.py:90
↓ 1 callersFunctionget_dump_path
Create a directory to store the experiment.
scripts/tools/xlm/utils.py:86
↓ 1 callersMethodget_indices
(self, query, knn)
scripts/tools/xlm/model/memory/memory.py:225
↓ 1 callersFunctionget_lambda_value
Compute a lambda value according to its schedule configuration.
scripts/tools/xlm/utils.py:160
↓ 1 callersMethodget_lr_for_step
(self, num_updates)
scripts/tools/xlm/optim.py:129
↓ 1 callersFunctionget_masks
Generate hidden states mask, and optionally an attention mask.
scripts/tools/xlm/model/transformer.py:84
↓ 1 callersFunctionget_slices
Generate slices of hidden dimensions. Used when there are multiple heads and/or different set of keys, and that there is no query network
scripts/tools/xlm/model/memory/utils.py:39
↓ 1 callersFunctionid2subdir
Returns subdirectory that a book_id will be found in a gutenberg mirror.
scripts/tools/gutenberg_downloader.py:77
next →1–100 of 256, ranked by callers