SYMBOL INDEX (925 symbols across 48 files) FILE: examples/bertology.py function entropy (line 23) | def entropy(p): function print_1d_tensor (line 29) | def print_1d_tensor(tensor, prefix=""): function print_2d_tensor (line 36) | def print_2d_tensor(tensor): function compute_heads_importance (line 42) | def compute_heads_importance(args, model, eval_dataloader, compute_entro... function run_model (line 110) | def run_model(): FILE: examples/extract_features.py class InputExample (line 40) | class InputExample(object): method __init__ (line 42) | def __init__(self, unique_id, text_a, text_b): class InputFeatures (line 48) | class InputFeatures(object): method __init__ (line 51) | def __init__(self, unique_id, tokens, input_ids, input_mask, input_typ... function convert_examples_to_features (line 59) | def convert_examples_to_features(examples, seq_length, tokenizer): function _truncate_seq_pair (line 150) | def _truncate_seq_pair(tokens_a, tokens_b, max_length): function read_examples (line 167) | def read_examples(input_file): function main (line 191) | def main(): FILE: examples/lm_finetuning/finetune_on_pregenerated.py function convert_example_to_features (line 27) | def convert_example_to_features(example, tokenizer, max_seq_length): class PregeneratedDataset (line 58) | class PregeneratedDataset(Dataset): method __init__ (line 59) | def __init__(self, training_path, epoch, tokenizer, num_data_epochs, r... method __len__ (line 113) | def __len__(self): method __getitem__ (line 116) | def __getitem__(self, item): function main (line 124) | def main(): FILE: examples/lm_finetuning/pregenerate_training_data.py class DocumentDatabase (line 14) | class DocumentDatabase: method __init__ (line 15) | def __init__(self, reduce_memory=False): method add_document (line 33) | def add_document(self, document): method _precalculate_doc_weights (line 43) | def _precalculate_doc_weights(self): method sample_doc (line 47) | def sample_doc(self, current_idx, sentence_weighted=True): method __len__ (line 66) | def __len__(self): method __getitem__ (line 69) | def __getitem__(self, item): method __enter__ (line 75) | def __enter__(self): method __exit__ (line 78) | def __exit__(self, exc_type, exc_val, traceback): function truncate_seq_pair (line 85) | def truncate_seq_pair(tokens_a, tokens_b, max_num_tokens): function create_masked_lm_predictions (line 105) | def create_masked_lm_predictions(tokens, masked_lm_prob, max_predictions... function create_instances_from_document (line 170) | def create_instances_from_document( function create_training_file (line 268) | def create_training_file(docs, vocab_list, args, epoch_num): function main (line 290) | def main(): FILE: examples/lm_finetuning/simple_lm_finetuning.py class BERTDataset (line 43) | class BERTDataset(Dataset): method __init__ (line 44) | def __init__(self, corpus_path, tokenizer, seq_len, encoding="utf-8", ... method __len__ (line 109) | def __len__(self): method __getitem__ (line 113) | def __getitem__(self, item): method random_sent (line 142) | def random_sent(self, index): method get_corpus_line (line 160) | def get_corpus_line(self, item): method get_random_line (line 197) | def get_random_line(self): method get_next_line (line 220) | def get_next_line(self): class InputExample (line 235) | class InputExample(object): method __init__ (line 238) | def __init__(self, guid, tokens_a, tokens_b=None, is_next=None, lm_lab... class InputFeatures (line 257) | class InputFeatures(object): method __init__ (line 260) | def __init__(self, input_ids, input_mask, segment_ids, is_next, lm_lab... function random_word (line 268) | def random_word(tokens, tokenizer): function convert_example_to_features (line 307) | def convert_example_to_features(example, max_seq_length, tokenizer): function main (line 401) | def main(): function _truncate_seq_pair (line 626) | def _truncate_seq_pair(tokens_a, tokens_b, max_length): function accuracy (line 643) | def accuracy(out, labels): FILE: examples/run_classifier.py class InputExample (line 51) | class InputExample(object): method __init__ (line 54) | def __init__(self, guid, text_a, text_b=None, label=None, entity_pos=N... class InputFeatures (line 72) | class InputFeatures(object): method __init__ (line 75) | def __init__(self, input_ids, input_mask, segment_ids, label_id, entit... class DataProcessor (line 86) | class DataProcessor(object): method get_train_examples (line 89) | def get_train_examples(self, data_dir): method get_dev_examples (line 93) | def get_dev_examples(self, data_dir): method get_labels (line 97) | def get_labels(self): method _read_tsv (line 102) | def _read_tsv(cls, input_file, quotechar=None): class MrpcProcessor (line 114) | class MrpcProcessor(DataProcessor): method get_train_examples (line 117) | def get_train_examples(self, data_dir): method get_dev_examples (line 123) | def get_dev_examples(self, data_dir): method get_labels (line 128) | def get_labels(self): method _create_examples (line 132) | def _create_examples(self, lines, set_type): class SemProcessor (line 146) | class SemProcessor(DataProcessor): method get_train_examples (line 149) | def get_train_examples(self, data_dir): method get_dev_examples (line 155) | def get_dev_examples(self, data_dir): method get_labels (line 160) | def get_labels(self): method _create_examples (line 164) | def _create_examples(self, lines, set_type): class MnliProcessor (line 179) | class MnliProcessor(DataProcessor): method get_train_examples (line 182) | def get_train_examples(self, data_dir): method get_dev_examples (line 187) | def get_dev_examples(self, data_dir): method get_labels (line 193) | def get_labels(self): method _create_examples (line 197) | def _create_examples(self, lines, set_type): class MnliMismatchedProcessor (line 212) | class MnliMismatchedProcessor(MnliProcessor): method get_dev_examples (line 215) | def get_dev_examples(self, data_dir): class ColaProcessor (line 222) | class ColaProcessor(DataProcessor): method get_train_examples (line 225) | def get_train_examples(self, data_dir): method get_dev_examples (line 230) | def get_dev_examples(self, data_dir): method get_labels (line 235) | def get_labels(self): method _create_examples (line 239) | def _create_examples(self, lines, set_type): class Sst2Processor (line 251) | class Sst2Processor(DataProcessor): method get_train_examples (line 254) | def get_train_examples(self, data_dir): method get_dev_examples (line 259) | def get_dev_examples(self, data_dir): method get_labels (line 264) | def get_labels(self): method _create_examples (line 268) | def _create_examples(self, lines, set_type): class StsbProcessor (line 282) | class StsbProcessor(DataProcessor): method get_train_examples (line 285) | def get_train_examples(self, data_dir): method get_dev_examples (line 290) | def get_dev_examples(self, data_dir): method get_labels (line 295) | def get_labels(self): method _create_examples (line 299) | def _create_examples(self, lines, set_type): class QqpProcessor (line 314) | class QqpProcessor(DataProcessor): method get_train_examples (line 317) | def get_train_examples(self, data_dir): method get_dev_examples (line 322) | def get_dev_examples(self, data_dir): method get_labels (line 327) | def get_labels(self): method _create_examples (line 331) | def _create_examples(self, lines, set_type): class QnliProcessor (line 349) | class QnliProcessor(DataProcessor): method get_train_examples (line 352) | def get_train_examples(self, data_dir): method get_dev_examples (line 357) | def get_dev_examples(self, data_dir): method get_labels (line 363) | def get_labels(self): method _create_examples (line 367) | def _create_examples(self, lines, set_type): class RteProcessor (line 382) | class RteProcessor(DataProcessor): method get_train_examples (line 385) | def get_train_examples(self, data_dir): method get_dev_examples (line 390) | def get_dev_examples(self, data_dir): method get_labels (line 395) | def get_labels(self): method _create_examples (line 399) | def _create_examples(self, lines, set_type): class WnliProcessor (line 414) | class WnliProcessor(DataProcessor): method get_train_examples (line 417) | def get_train_examples(self, data_dir): method get_dev_examples (line 422) | def get_dev_examples(self, data_dir): method get_labels (line 427) | def get_labels(self): method _create_examples (line 431) | def _create_examples(self, lines, set_type): function convert_examples_to_features (line 446) | def convert_examples_to_features(examples, label_list, max_seq_length, function _truncate_seq_pair (line 650) | def _truncate_seq_pair(tokens_a, tokens_b, max_length): function simple_accuracy (line 667) | def simple_accuracy(preds, labels): function acc_and_f1 (line 671) | def acc_and_f1(preds, labels): function pearson_and_spearman (line 683) | def pearson_and_spearman(preds, labels): function compute_metrics (line 693) | def compute_metrics(task_name, preds, labels): function main (line 721) | def main(): FILE: examples/run_classifier_dataset_utils.py class InputExample (line 31) | class InputExample(object): method __init__ (line 34) | def __init__(self, guid, text_a, text_b=None, label=None): class InputFeatures (line 52) | class InputFeatures(object): method __init__ (line 55) | def __init__(self, input_ids, input_mask, segment_ids, label_id): class DataProcessor (line 62) | class DataProcessor(object): method get_train_examples (line 65) | def get_train_examples(self, data_dir): method get_dev_examples (line 69) | def get_dev_examples(self, data_dir): method get_labels (line 73) | def get_labels(self): method _read_tsv (line 78) | def _read_tsv(cls, input_file, quotechar=None): class MrpcProcessor (line 90) | class MrpcProcessor(DataProcessor): method get_train_examples (line 93) | def get_train_examples(self, data_dir): method get_dev_examples (line 99) | def get_dev_examples(self, data_dir): method get_labels (line 104) | def get_labels(self): method _create_examples (line 108) | def _create_examples(self, lines, set_type): class MnliProcessor (line 123) | class MnliProcessor(DataProcessor): method get_train_examples (line 126) | def get_train_examples(self, data_dir): method get_dev_examples (line 131) | def get_dev_examples(self, data_dir): method get_labels (line 137) | def get_labels(self): method _create_examples (line 141) | def _create_examples(self, lines, set_type): class MnliMismatchedProcessor (line 156) | class MnliMismatchedProcessor(MnliProcessor): method get_dev_examples (line 159) | def get_dev_examples(self, data_dir): class ColaProcessor (line 166) | class ColaProcessor(DataProcessor): method get_train_examples (line 169) | def get_train_examples(self, data_dir): method get_dev_examples (line 174) | def get_dev_examples(self, data_dir): method get_labels (line 179) | def get_labels(self): method _create_examples (line 183) | def _create_examples(self, lines, set_type): class Sst2Processor (line 195) | class Sst2Processor(DataProcessor): method get_train_examples (line 198) | def get_train_examples(self, data_dir): method get_dev_examples (line 203) | def get_dev_examples(self, data_dir): method get_labels (line 208) | def get_labels(self): method _create_examples (line 212) | def _create_examples(self, lines, set_type): class StsbProcessor (line 226) | class StsbProcessor(DataProcessor): method get_train_examples (line 229) | def get_train_examples(self, data_dir): method get_dev_examples (line 234) | def get_dev_examples(self, data_dir): method get_labels (line 239) | def get_labels(self): method _create_examples (line 243) | def _create_examples(self, lines, set_type): class QqpProcessor (line 258) | class QqpProcessor(DataProcessor): method get_train_examples (line 261) | def get_train_examples(self, data_dir): method get_dev_examples (line 266) | def get_dev_examples(self, data_dir): method get_labels (line 271) | def get_labels(self): method _create_examples (line 275) | def _create_examples(self, lines, set_type): class QnliProcessor (line 293) | class QnliProcessor(DataProcessor): method get_train_examples (line 296) | def get_train_examples(self, data_dir): method get_dev_examples (line 301) | def get_dev_examples(self, data_dir): method get_labels (line 307) | def get_labels(self): method _create_examples (line 311) | def _create_examples(self, lines, set_type): class RteProcessor (line 326) | class RteProcessor(DataProcessor): method get_train_examples (line 329) | def get_train_examples(self, data_dir): method get_dev_examples (line 334) | def get_dev_examples(self, data_dir): method get_labels (line 339) | def get_labels(self): method _create_examples (line 343) | def _create_examples(self, lines, set_type): class WnliProcessor (line 358) | class WnliProcessor(DataProcessor): method get_train_examples (line 361) | def get_train_examples(self, data_dir): method get_dev_examples (line 366) | def get_dev_examples(self, data_dir): method get_labels (line 371) | def get_labels(self): method _create_examples (line 375) | def _create_examples(self, lines, set_type): function convert_examples_to_features (line 390) | def convert_examples_to_features(examples, label_list, max_seq_length, function _truncate_seq_pair (line 482) | def _truncate_seq_pair(tokens_a, tokens_b, max_length): function simple_accuracy (line 499) | def simple_accuracy(preds, labels): function acc_and_f1 (line 503) | def acc_and_f1(preds, labels): function pearson_and_spearman (line 513) | def pearson_and_spearman(preds, labels): function compute_metrics (line 523) | def compute_metrics(task_name, preds, labels): FILE: examples/run_gpt2.py function top_k_logits (line 18) | def top_k_logits(logits, k): function sample_sequence (line 31) | def sample_sequence(model, length, start_token=None, batch_size=None, co... function run_model (line 54) | def run_model(): FILE: examples/run_openai_gpt.py function accuracy (line 52) | def accuracy(out, labels): function load_rocstories_dataset (line 56) | def load_rocstories_dataset(dataset_path): function pre_process_datasets (line 66) | def pre_process_datasets(encoded_datasets, input_len, cap_length, start_... function main (line 93) | def main(): FILE: examples/run_squad.py function main (line 51) | def main(): FILE: examples/run_squad_dataset_utils.py class SquadExample (line 31) | class SquadExample(object): method __init__ (line 37) | def __init__(self, method __str__ (line 53) | def __str__(self): method __repr__ (line 56) | def __repr__(self): class InputFeatures (line 71) | class InputFeatures(object): method __init__ (line 74) | def __init__(self, function read_squad_examples (line 101) | def read_squad_examples(input_file, is_training, version_2_with_negative): function convert_examples_to_features (line 179) | def convert_examples_to_features(examples, tokenizer, max_seq_length, function _improve_answer_span (line 342) | def _improve_answer_span(doc_tokens, input_start, input_end, tokenizer, function _check_is_max_context (line 379) | def _check_is_max_context(doc_spans, cur_span_index, position): function write_predictions (line 420) | def write_predictions(all_examples, all_features, all_results, n_best_size, function get_final_text (line 612) | def get_final_text(pred_text, orig_text, do_lower_case, verbose_logging=... function _get_best_indexes (line 708) | def _get_best_indexes(logits, n_best_size): function _compute_softmax (line 720) | def _compute_softmax(scores): FILE: examples/run_swag.py class SwagExample (line 46) | class SwagExample(object): method __init__ (line 48) | def __init__(self, method __str__ (line 68) | def __str__(self): method __repr__ (line 71) | def __repr__(self): class InputFeatures (line 88) | class InputFeatures(object): method __init__ (line 89) | def __init__(self, function read_swag_examples (line 107) | def read_swag_examples(input_file, is_training): function convert_examples_to_features (line 138) | def convert_examples_to_features(examples, tokenizer, max_seq_length, function _truncate_seq_pair (line 216) | def _truncate_seq_pair(tokens_a, tokens_b, max_length): function accuracy (line 232) | def accuracy(out, labels): function select_field (line 236) | def select_field(features, field): function main (line 245) | def main(): FILE: examples/run_transfo_xl.py function main (line 38) | def main(): FILE: examples/sem_run_classifier.py class InputExample (line 51) | class InputExample(object): method __init__ (line 54) | def __init__(self, guid, text_a, text_b=None, label=None, entity_pos=N... class InputFeatures (line 72) | class InputFeatures(object): method __init__ (line 75) | def __init__(self, input_ids, input_mask, segment_ids, label_id, entit... class DataProcessor (line 86) | class DataProcessor(object): method get_train_examples (line 89) | def get_train_examples(self, data_dir): method get_dev_examples (line 93) | def get_dev_examples(self, data_dir): method get_labels (line 97) | def get_labels(self): method _read_tsv (line 102) | def _read_tsv(cls, input_file, quotechar=None): class MrpcProcessor (line 114) | class MrpcProcessor(DataProcessor): method get_train_examples (line 117) | def get_train_examples(self, data_dir): method get_dev_examples (line 123) | def get_dev_examples(self, data_dir): method get_labels (line 128) | def get_labels(self): method _create_examples (line 132) | def _create_examples(self, lines, set_type): class SemProcessor (line 146) | class SemProcessor(DataProcessor): method get_train_examples (line 149) | def get_train_examples(self, data_dir): method get_dev_examples (line 155) | def get_dev_examples(self, data_dir): method get_labels (line 160) | def get_labels(self): method _create_examples (line 164) | def _create_examples(self, lines, set_type): class MnliProcessor (line 179) | class MnliProcessor(DataProcessor): method get_train_examples (line 182) | def get_train_examples(self, data_dir): method get_dev_examples (line 187) | def get_dev_examples(self, data_dir): method get_labels (line 193) | def get_labels(self): method _create_examples (line 197) | def _create_examples(self, lines, set_type): class MnliMismatchedProcessor (line 212) | class MnliMismatchedProcessor(MnliProcessor): method get_dev_examples (line 215) | def get_dev_examples(self, data_dir): class ColaProcessor (line 222) | class ColaProcessor(DataProcessor): method get_train_examples (line 225) | def get_train_examples(self, data_dir): method get_dev_examples (line 230) | def get_dev_examples(self, data_dir): method get_labels (line 235) | def get_labels(self): method _create_examples (line 239) | def _create_examples(self, lines, set_type): class Sst2Processor (line 251) | class Sst2Processor(DataProcessor): method get_train_examples (line 254) | def get_train_examples(self, data_dir): method get_dev_examples (line 259) | def get_dev_examples(self, data_dir): method get_labels (line 264) | def get_labels(self): method _create_examples (line 268) | def _create_examples(self, lines, set_type): class StsbProcessor (line 282) | class StsbProcessor(DataProcessor): method get_train_examples (line 285) | def get_train_examples(self, data_dir): method get_dev_examples (line 290) | def get_dev_examples(self, data_dir): method get_labels (line 295) | def get_labels(self): method _create_examples (line 299) | def _create_examples(self, lines, set_type): class QqpProcessor (line 314) | class QqpProcessor(DataProcessor): method get_train_examples (line 317) | def get_train_examples(self, data_dir): method get_dev_examples (line 322) | def get_dev_examples(self, data_dir): method get_labels (line 327) | def get_labels(self): method _create_examples (line 331) | def _create_examples(self, lines, set_type): class QnliProcessor (line 349) | class QnliProcessor(DataProcessor): method get_train_examples (line 352) | def get_train_examples(self, data_dir): method get_dev_examples (line 357) | def get_dev_examples(self, data_dir): method get_labels (line 363) | def get_labels(self): method _create_examples (line 367) | def _create_examples(self, lines, set_type): class RteProcessor (line 382) | class RteProcessor(DataProcessor): method get_train_examples (line 385) | def get_train_examples(self, data_dir): method get_dev_examples (line 390) | def get_dev_examples(self, data_dir): method get_labels (line 395) | def get_labels(self): method _create_examples (line 399) | def _create_examples(self, lines, set_type): class WnliProcessor (line 414) | class WnliProcessor(DataProcessor): method get_train_examples (line 417) | def get_train_examples(self, data_dir): method get_dev_examples (line 422) | def get_dev_examples(self, data_dir): method get_labels (line 427) | def get_labels(self): method _create_examples (line 431) | def _create_examples(self, lines, set_type): function convert_examples_to_features (line 446) | def convert_examples_to_features(examples, label_list, max_seq_length, function _truncate_seq_pair (line 650) | def _truncate_seq_pair(tokens_a, tokens_b, max_length): function simple_accuracy (line 667) | def simple_accuracy(preds, labels): function acc_and_f1 (line 671) | def acc_and_f1(preds, labels): function pearson_and_spearman (line 683) | def pearson_and_spearman(preds, labels): function compute_metrics (line 693) | def compute_metrics(task_name, preds, labels): function main (line 721) | def main(): FILE: examples/tacred_run_classifier.py class InputExample (line 51) | class InputExample(object): method __init__ (line 54) | def __init__(self, guid, text_a, text_b=None, label=None, entity_pos=N... class InputFeatures (line 72) | class InputFeatures(object): method __init__ (line 75) | def __init__(self, input_ids, input_mask, segment_ids, label_id, entit... class DataProcessor (line 86) | class DataProcessor(object): method get_train_examples (line 89) | def get_train_examples(self, data_dir): method get_dev_examples (line 93) | def get_dev_examples(self, data_dir): method get_labels (line 97) | def get_labels(self): method _read_tsv (line 102) | def _read_tsv(cls, input_file, quotechar=None): class MrpcProcessor (line 114) | class MrpcProcessor(DataProcessor): method get_train_examples (line 117) | def get_train_examples(self, data_dir): method get_dev_examples (line 123) | def get_dev_examples(self, data_dir): method get_labels (line 128) | def get_labels(self): method _create_examples (line 132) | def _create_examples(self, lines, set_type): class SemProcessor (line 146) | class SemProcessor(DataProcessor): method get_train_examples (line 149) | def get_train_examples(self, data_dir): method get_dev_examples (line 155) | def get_dev_examples(self, data_dir): method get_labels (line 160) | def get_labels(self): method _create_examples (line 164) | def _create_examples(self, lines, set_type): class TacredProcessor (line 177) | class TacredProcessor(DataProcessor): method get_train_examples (line 180) | def get_train_examples(self, data_dir): method get_dev_examples (line 186) | def get_dev_examples(self, data_dir): method get_test_examples (line 191) | def get_test_examples(self, data_dir): method get_labels (line 196) | def get_labels(self): method _create_examples (line 199) | def _create_examples(self, lines, set_type): class MnliProcessor (line 215) | class MnliProcessor(DataProcessor): method get_train_examples (line 218) | def get_train_examples(self, data_dir): method get_dev_examples (line 223) | def get_dev_examples(self, data_dir): method get_labels (line 229) | def get_labels(self): method _create_examples (line 233) | def _create_examples(self, lines, set_type): class MnliMismatchedProcessor (line 248) | class MnliMismatchedProcessor(MnliProcessor): method get_dev_examples (line 251) | def get_dev_examples(self, data_dir): class ColaProcessor (line 258) | class ColaProcessor(DataProcessor): method get_train_examples (line 261) | def get_train_examples(self, data_dir): method get_dev_examples (line 266) | def get_dev_examples(self, data_dir): method get_labels (line 271) | def get_labels(self): method _create_examples (line 275) | def _create_examples(self, lines, set_type): class Sst2Processor (line 287) | class Sst2Processor(DataProcessor): method get_train_examples (line 290) | def get_train_examples(self, data_dir): method get_dev_examples (line 295) | def get_dev_examples(self, data_dir): method get_labels (line 300) | def get_labels(self): method _create_examples (line 304) | def _create_examples(self, lines, set_type): class StsbProcessor (line 318) | class StsbProcessor(DataProcessor): method get_train_examples (line 321) | def get_train_examples(self, data_dir): method get_dev_examples (line 326) | def get_dev_examples(self, data_dir): method get_labels (line 331) | def get_labels(self): method _create_examples (line 335) | def _create_examples(self, lines, set_type): class QqpProcessor (line 350) | class QqpProcessor(DataProcessor): method get_train_examples (line 353) | def get_train_examples(self, data_dir): method get_dev_examples (line 358) | def get_dev_examples(self, data_dir): method get_labels (line 363) | def get_labels(self): method _create_examples (line 367) | def _create_examples(self, lines, set_type): class QnliProcessor (line 385) | class QnliProcessor(DataProcessor): method get_train_examples (line 388) | def get_train_examples(self, data_dir): method get_dev_examples (line 393) | def get_dev_examples(self, data_dir): method get_labels (line 399) | def get_labels(self): method _create_examples (line 403) | def _create_examples(self, lines, set_type): class RteProcessor (line 418) | class RteProcessor(DataProcessor): method get_train_examples (line 421) | def get_train_examples(self, data_dir): method get_dev_examples (line 426) | def get_dev_examples(self, data_dir): method get_labels (line 431) | def get_labels(self): method _create_examples (line 435) | def _create_examples(self, lines, set_type): class WnliProcessor (line 450) | class WnliProcessor(DataProcessor): method get_train_examples (line 453) | def get_train_examples(self, data_dir): method get_dev_examples (line 458) | def get_dev_examples(self, data_dir): method get_labels (line 463) | def get_labels(self): method _create_examples (line 467) | def _create_examples(self, lines, set_type): function convert_examples_to_features (line 481) | def convert_examples_to_features(examples, label_list, max_seq_length, function _truncate_seq_pair (line 686) | def _truncate_seq_pair(tokens_a, tokens_b, max_length): function simple_accuracy (line 703) | def simple_accuracy(preds, labels): function acc_and_f1 (line 707) | def acc_and_f1(preds, labels): function pearson_and_spearman (line 721) | def pearson_and_spearman(preds, labels): function compute_metrics (line 731) | def compute_metrics(task_name, preds, labels): function main (line 761) | def main(): FILE: examples/tacred_run_infer.py class InputExample (line 39) | class InputExample(object): method __init__ (line 42) | def __init__(self, guid, text_a, text_b=None, label=None, entity_pos=N... class InputFeatures (line 60) | class InputFeatures(object): method __init__ (line 63) | def __init__(self,input_ids, input_mask, segment_ids, label_id, entity... class DataProcessor (line 74) | class DataProcessor(object): method get_train_examples (line 77) | def get_train_examples(self, data_dir): method get_dev_examples (line 81) | def get_dev_examples(self, data_dir): method get_labels (line 85) | def get_labels(self): method _read_tsv (line 90) | def _read_tsv(cls, input_file, quotechar=None): class TacredProcessor (line 101) | class TacredProcessor(DataProcessor): method get_train_examples (line 104) | def get_train_examples(self, data_dir): method get_dev_examples (line 110) | def get_dev_examples(self, data_dir): method get_test_examples (line 115) | def get_test_examples(self, data_dir): method get_labels (line 120) | def get_labels(self): method _create_examples (line 123) | def _create_examples(self, lines, set_type): class _TacredProcessor (line 138) | class _TacredProcessor(DataProcessor): method get_test_examples (line 141) | def get_test_examples(self, lines): method get_labels (line 145) | def get_labels(self): method _create_examples (line 149) | def _create_examples(self, lines, set_type): function convert_examples_to_features (line 164) | def convert_examples_to_features(examples, label_list, max_seq_length, function _truncate_seq_pair (line 359) | def _truncate_seq_pair(tokens_a, tokens_b, max_length): function load_model (line 375) | def load_model(): function get_helper_model (line 453) | def get_helper_model(spacy_used=False): function predict (line 466) | def predict(): FILE: hubconfs/bert_hubconf.py function _append_from_pretrained_docstring (line 48) | def _append_from_pretrained_docstring(docstr): function bertTokenizer (line 55) | def bertTokenizer(*args, **kwargs): function bertModel (line 100) | def bertModel(*args, **kwargs): function bertForNextSentencePrediction (line 129) | def bertForNextSentencePrediction(*args, **kwargs): function bertForPreTraining (line 158) | def bertForPreTraining(*args, **kwargs): function bertForMaskedLM (line 184) | def bertForMaskedLM(*args, **kwargs): function bertForSequenceClassification (line 217) | def bertForSequenceClassification(*args, **kwargs): function bertForMultipleChoice (line 257) | def bertForMultipleChoice(*args, **kwargs): function bertForQuestionAnswering (line 292) | def bertForQuestionAnswering(*args, **kwargs): function bertForTokenClassification (line 326) | def bertForTokenClassification(*args, **kwargs): FILE: hubconfs/gpt2_hubconf.py function _append_from_pretrained_docstring (line 28) | def _append_from_pretrained_docstring(docstr): function gpt2Tokenizer (line 35) | def gpt2Tokenizer(*args, **kwargs): function gpt2Model (line 66) | def gpt2Model(*args, **kwargs): function gpt2LMHeadModel (line 100) | def gpt2LMHeadModel(*args, **kwargs): function gpt2DoubleHeadsModel (line 138) | def gpt2DoubleHeadsModel(*args, **kwargs): FILE: hubconfs/gpt_hubconf.py function _append_from_pretrained_docstring (line 49) | def _append_from_pretrained_docstring(docstr): function openAIGPTTokenizer (line 56) | def openAIGPTTokenizer(*args, **kwargs): function openAIGPTModel (line 92) | def openAIGPTModel(*args, **kwargs): function openAIGPTLMHeadModel (line 122) | def openAIGPTLMHeadModel(*args, **kwargs): function openAIGPTDoubleHeadsModel (line 156) | def openAIGPTDoubleHeadsModel(*args, **kwargs): FILE: hubconfs/transformer_xl_hubconf.py function _append_from_pretrained_docstring (line 31) | def _append_from_pretrained_docstring(docstr): function transformerXLTokenizer (line 38) | def transformerXLTokenizer(*args, **kwargs): function transformerXLModel (line 60) | def transformerXLModel(*args, **kwargs): function transformerXLLMHeadModel (line 94) | def transformerXLLMHeadModel(*args, **kwargs): FILE: pytorch_pretrained_bert/__main__.py function main (line 2) | def main(): FILE: pytorch_pretrained_bert/convert_gpt2_checkpoint_to_pytorch.py function convert_gpt2_checkpoint_to_pytorch (line 30) | def convert_gpt2_checkpoint_to_pytorch(gpt2_checkpoint_path, gpt2_config... FILE: pytorch_pretrained_bert/convert_openai_checkpoint_to_pytorch.py function convert_openai_checkpoint_to_pytorch (line 30) | def convert_openai_checkpoint_to_pytorch(openai_checkpoint_folder_path, ... FILE: pytorch_pretrained_bert/convert_pytorch_checkpoint_to_tf.py function convert_pytorch_checkpoint_to_tf (line 26) | def convert_pytorch_checkpoint_to_tf(model:BertModel, ckpt_dir:str, mode... function main (line 95) | def main(raw_args=None): FILE: pytorch_pretrained_bert/convert_tf_checkpoint_to_pytorch.py function convert_tf_checkpoint_to_pytorch (line 30) | def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, bert_config_fil... FILE: pytorch_pretrained_bert/convert_transfo_xl_checkpoint_to_pytorch.py function convert_transfo_xl_checkpoint_to_pytorch (line 47) | def convert_transfo_xl_checkpoint_to_pytorch(tf_checkpoint_path, FILE: pytorch_pretrained_bert/file_utils.py function url_to_filename (line 53) | def url_to_filename(url, etag=None): function filename_to_url (line 71) | def filename_to_url(filename, cache_dir=None): function cached_path (line 97) | def cached_path(url_or_filename, cache_dir=None): function split_s3_path (line 127) | def split_s3_path(url): function s3_request (line 140) | def s3_request(func): function s3_etag (line 160) | def s3_etag(url): function s3_get (line 169) | def s3_get(url, temp_file): function http_get (line 176) | def http_get(url, temp_file): function get_from_cache (line 188) | def get_from_cache(url, cache_dir=None): function read_set_from_file (line 264) | def read_set_from_file(filename): function get_file_extension (line 276) | def get_file_extension(path, dot=True, lower=True): FILE: pytorch_pretrained_bert/modeling.py function load_tf_weights_in_bert (line 51) | def load_tf_weights_in_bert(model, tf_checkpoint_path): function gelu (line 118) | def gelu(x): function swish (line 127) | def swish(x): class BertConfig (line 134) | class BertConfig(object): method __init__ (line 137) | def __init__(self, method from_dict (line 199) | def from_dict(cls, json_object): method from_json_file (line 207) | def from_json_file(cls, json_file): method __repr__ (line 213) | def __repr__(self): method to_dict (line 216) | def to_dict(self): method to_json_string (line 221) | def to_json_string(self): method to_json_file (line 225) | def to_json_file(self, json_file_path): class BertLayerNorm (line 234) | class BertLayerNorm(nn.Module): method __init__ (line 235) | def __init__(self, hidden_size, eps=1e-12): method forward (line 243) | def forward(self, x): class BertEmbeddings (line 249) | class BertEmbeddings(nn.Module): method __init__ (line 252) | def __init__(self, config): method forward (line 263) | def forward(self, input_ids, entity_pos_seg=None, entity_span1_pos=Non... class BertSelfAttention (line 327) | class BertSelfAttention(nn.Module): method __init__ (line 328) | def __init__(self, config): method transpose_for_scores (line 344) | def transpose_for_scores(self, x): method forward (line 349) | def forward(self, hidden_states, attention_mask): class BertSelfOutput (line 378) | class BertSelfOutput(nn.Module): method __init__ (line 379) | def __init__(self, config): method forward (line 385) | def forward(self, hidden_states, input_tensor): class BertAttention (line 392) | class BertAttention(nn.Module): method __init__ (line 393) | def __init__(self, config): method forward (line 398) | def forward(self, input_tensor, attention_mask): class BertIntermediate (line 404) | class BertIntermediate(nn.Module): method __init__ (line 405) | def __init__(self, config): method forward (line 413) | def forward(self, hidden_states): class BertOutput (line 419) | class BertOutput(nn.Module): method __init__ (line 420) | def __init__(self, config): method forward (line 426) | def forward(self, hidden_states, input_tensor): class BertLayer (line 433) | class BertLayer(nn.Module): method __init__ (line 434) | def __init__(self, config): method forward (line 440) | def forward(self, hidden_states, attention_mask): class BertEncoder (line 447) | class BertEncoder(nn.Module): method __init__ (line 448) | def __init__(self, config): method forward (line 453) | def forward(self, hidden_states, attention_mask, output_all_encoded_la... class BertPooler (line 464) | class BertPooler(nn.Module): method __init__ (line 465) | def __init__(self, config): method forward (line 470) | def forward(self, hidden_states): class BertPredictionHeadTransform (line 479) | class BertPredictionHeadTransform(nn.Module): method __init__ (line 480) | def __init__(self, config): method forward (line 489) | def forward(self, hidden_states): class BertLMPredictionHead (line 496) | class BertLMPredictionHead(nn.Module): method __init__ (line 497) | def __init__(self, config, bert_model_embedding_weights): method forward (line 509) | def forward(self, hidden_states): class BertOnlyMLMHead (line 515) | class BertOnlyMLMHead(nn.Module): method __init__ (line 516) | def __init__(self, config, bert_model_embedding_weights): method forward (line 520) | def forward(self, sequence_output): class BertOnlyNSPHead (line 525) | class BertOnlyNSPHead(nn.Module): method __init__ (line 526) | def __init__(self, config): method forward (line 530) | def forward(self, pooled_output): class BertPreTrainingHeads (line 535) | class BertPreTrainingHeads(nn.Module): method __init__ (line 536) | def __init__(self, config, bert_model_embedding_weights): method forward (line 541) | def forward(self, sequence_output, pooled_output): class BertPreTrainedModel (line 547) | class BertPreTrainedModel(nn.Module): method __init__ (line 551) | def __init__(self, config, *inputs, **kwargs): method init_bert_weights (line 562) | def init_bert_weights(self, module): method from_pretrained (line 576) | def from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwa... class BertModel (line 708) | class BertModel(BertPreTrainedModel): method __init__ (line 752) | def __init__(self, config): method forward (line 759) | def forward(self, input_ids, entity_seg_pos = None, entity_span1_pos=N... class BertForPreTraining (line 795) | class BertForPreTraining(BertPreTrainedModel): method __init__ (line 845) | def __init__(self, config): method forward (line 851) | def forward(self, input_ids, token_type_ids=None, attention_mask=None,... class BertForMaskedLM (line 866) | class BertForMaskedLM(BertPreTrainedModel): method __init__ (line 908) | def __init__(self, config): method forward (line 914) | def forward(self, input_ids, token_type_ids=None, attention_mask=None,... class BertForNextSentencePrediction (line 927) | class BertForNextSentencePrediction(BertPreTrainedModel): method __init__ (line 970) | def __init__(self, config): method forward (line 976) | def forward(self, input_ids, token_type_ids=None, attention_mask=None,... class BertForSequenceClassification (line 989) | class BertForSequenceClassification(BertPreTrainedModel): method __init__ (line 1034) | def __init__(self, config, num_labels): method forward (line 1054) | def forward(self, input_ids, token_type_ids=None, attention_mask=None,... class BertForMultipleChoice (line 1137) | class BertForMultipleChoice(BertPreTrainedModel): method __init__ (line 1181) | def __init__(self, config, num_choices): method forward (line 1189) | def forward(self, input_ids, token_type_ids=None, attention_mask=None,... class BertForTokenClassification (line 1206) | class BertForTokenClassification(BertPreTrainedModel): method __init__ (line 1251) | def __init__(self, config, num_labels): method forward (line 1259) | def forward(self, input_ids, token_type_ids=None, attention_mask=None,... class BertForQuestionAnswering (line 1279) | class BertForQuestionAnswering(BertPreTrainedModel): method __init__ (line 1326) | def __init__(self, config): method forward (line 1334) | def forward(self, input_ids, token_type_ids=None, attention_mask=None,... FILE: pytorch_pretrained_bert/modeling_gpt2.py function prune_conv1d_layer (line 44) | def prune_conv1d_layer(layer, index, dim=1): function load_tf_weights_in_gpt2 (line 68) | def load_tf_weights_in_gpt2(model, gpt2_checkpoint_path): function gelu (line 122) | def gelu(x): class GPT2Config (line 126) | class GPT2Config(object): method __init__ (line 130) | def __init__( method total_tokens_embeddings (line 194) | def total_tokens_embeddings(self): method from_dict (line 198) | def from_dict(cls, json_object): method from_json_file (line 206) | def from_json_file(cls, json_file): method __repr__ (line 212) | def __repr__(self): method to_dict (line 215) | def to_dict(self): method to_json_string (line 220) | def to_json_string(self): method to_json_file (line 224) | def to_json_file(self, json_file_path): class Conv1D (line 230) | class Conv1D(nn.Module): method __init__ (line 231) | def __init__(self, nf, nx): method forward (line 239) | def forward(self, x): class Attention (line 246) | class Attention(nn.Module): method __init__ (line 247) | def __init__(self, nx, n_ctx, config, scale=False, output_attentions=F... method prune_heads (line 266) | def prune_heads(self, heads): method _attn (line 282) | def _attn(self, q, k, v, head_mask=None): method merge_heads (line 301) | def merge_heads(self, x): method split_heads (line 306) | def split_heads(self, x, k=False): method forward (line 314) | def forward(self, x, layer_past=None, head_mask=None): class MLP (line 341) | class MLP(nn.Module): method __init__ (line 342) | def __init__(self, n_state, config): # in MLP: n_state=3072 (4 * n_embd) method forward (line 350) | def forward(self, x): class Block (line 356) | class Block(nn.Module): method __init__ (line 357) | def __init__(self, n_ctx, config, scale=False, output_attentions=False... method forward (line 366) | def forward(self, x, layer_past=None, head_mask=None): class GPT2LMHead (line 380) | class GPT2LMHead(nn.Module): method __init__ (line 383) | def __init__(self, model_embeddings_weights, config): method set_embeddings_weights (line 392) | def set_embeddings_weights(self, model_embeddings_weights, predict_spe... method forward (line 396) | def forward(self, hidden_state): class GPT2MultipleChoiceHead (line 403) | class GPT2MultipleChoiceHead(nn.Module): method __init__ (line 406) | def __init__(self, config): method forward (line 415) | def forward(self, hidden_states, mc_token_ids): class GPT2PreTrainedModel (line 429) | class GPT2PreTrainedModel(nn.Module): method __init__ (line 434) | def __init__(self, config, *inputs, **kwargs): method init_weights (line 446) | def init_weights(self, module): method from_pretrained (line 460) | def from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwa... class GPT2Model (line 607) | class GPT2Model(GPT2PreTrainedModel): method __init__ (line 668) | def __init__(self, config, output_attentions=False, keep_multihead_out... method set_num_special_tokens (line 681) | def set_num_special_tokens(self, num_special_tokens): method prune_heads (line 695) | def prune_heads(self, heads_to_prune): method get_multihead_outputs (line 702) | def get_multihead_outputs(self): method forward (line 708) | def forward(self, input_ids, position_ids=None, token_type_ids=None, p... class GPT2LMHeadModel (line 768) | class GPT2LMHeadModel(GPT2PreTrainedModel): method __init__ (line 817) | def __init__(self, config, output_attentions=False, keep_multihead_out... method set_num_special_tokens (line 824) | def set_num_special_tokens(self, num_special_tokens, predict_special_t... method forward (line 832) | def forward(self, input_ids, position_ids=None, token_type_ids=None, l... class GPT2DoubleHeadsModel (line 855) | class GPT2DoubleHeadsModel(GPT2PreTrainedModel): method __init__ (line 909) | def __init__(self, config, output_attentions=False, keep_multihead_out... method set_num_special_tokens (line 917) | def set_num_special_tokens(self, num_special_tokens, predict_special_t... method forward (line 925) | def forward(self, input_ids, mc_token_ids, lm_labels=None, mc_labels=N... FILE: pytorch_pretrained_bert/modeling_openai.py function load_tf_weights_in_openai_gpt (line 44) | def load_tf_weights_in_openai_gpt(model, openai_checkpoint_folder_path): function gelu (line 114) | def gelu(x): function swish (line 118) | def swish(x): class OpenAIGPTConfig (line 125) | class OpenAIGPTConfig(object): method __init__ (line 129) | def __init__( method total_tokens_embeddings (line 197) | def total_tokens_embeddings(self): method from_dict (line 201) | def from_dict(cls, json_object): method from_json_file (line 209) | def from_json_file(cls, json_file): method __repr__ (line 215) | def __repr__(self): method to_dict (line 218) | def to_dict(self): method to_json_string (line 223) | def to_json_string(self): method to_json_file (line 227) | def to_json_file(self, json_file_path): class Conv1D (line 233) | class Conv1D(nn.Module): method __init__ (line 234) | def __init__(self, nf, rf, nx): method forward (line 246) | def forward(self, x): class Attention (line 256) | class Attention(nn.Module): method __init__ (line 257) | def __init__(self, nx, n_ctx, config, scale=False, output_attentions=F... method prune_heads (line 276) | def prune_heads(self, heads): method _attn (line 292) | def _attn(self, q, k, v, head_mask=None): method merge_heads (line 312) | def merge_heads(self, x): method split_heads (line 317) | def split_heads(self, x, k=False): method forward (line 325) | def forward(self, x, head_mask=None): class MLP (line 347) | class MLP(nn.Module): method __init__ (line 348) | def __init__(self, n_state, config): # in MLP: n_state=3072 (4 * n_embd) method forward (line 356) | def forward(self, x): class Block (line 362) | class Block(nn.Module): method __init__ (line 363) | def __init__(self, n_ctx, config, scale=False, output_attentions=False... method forward (line 372) | def forward(self, x, head_mask=None): class OpenAIGPTLMHead (line 384) | class OpenAIGPTLMHead(nn.Module): method __init__ (line 387) | def __init__(self, model_embeddings_weights, config): method set_embeddings_weights (line 396) | def set_embeddings_weights(self, model_embeddings_weights, predict_spe... method forward (line 401) | def forward(self, hidden_state): class OpenAIGPTMultipleChoiceHead (line 408) | class OpenAIGPTMultipleChoiceHead(nn.Module): method __init__ (line 411) | def __init__(self, config): method forward (line 420) | def forward(self, hidden_states, mc_token_ids): class OpenAIGPTPreTrainedModel (line 434) | class OpenAIGPTPreTrainedModel(nn.Module): method __init__ (line 439) | def __init__(self, config, *inputs, **kwargs): method init_weights (line 451) | def init_weights(self, module): method from_pretrained (line 465) | def from_pretrained(cls, pretrained_model_name_or_path, num_special_to... class OpenAIGPTModel (line 610) | class OpenAIGPTModel(OpenAIGPTPreTrainedModel): method __init__ (line 666) | def __init__(self, config, output_attentions=False, keep_multihead_out... method set_num_special_tokens (line 678) | def set_num_special_tokens(self, num_special_tokens): method prune_heads (line 692) | def prune_heads(self, heads_to_prune): method get_multihead_outputs (line 699) | def get_multihead_outputs(self): method forward (line 705) | def forward(self, input_ids, position_ids=None, token_type_ids=None, h... class OpenAIGPTLMHeadModel (line 760) | class OpenAIGPTLMHeadModel(OpenAIGPTPreTrainedModel): method __init__ (line 821) | def __init__(self, config, output_attentions=False, keep_multihead_out... method set_num_special_tokens (line 828) | def set_num_special_tokens(self, num_special_tokens, predict_special_t... method forward (line 836) | def forward(self, input_ids, position_ids=None, token_type_ids=None, l... class OpenAIGPTDoubleHeadsModel (line 857) | class OpenAIGPTDoubleHeadsModel(OpenAIGPTPreTrainedModel): method __init__ (line 923) | def __init__(self, config, output_attentions=False, keep_multihead_out... method set_num_special_tokens (line 931) | def set_num_special_tokens(self, num_special_tokens, predict_special_t... method forward (line 939) | def forward(self, input_ids, mc_token_ids, lm_labels=None, mc_labels=N... FILE: pytorch_pretrained_bert/modeling_transfo_xl.py function build_tf_to_pytorch_map (line 53) | def build_tf_to_pytorch_map(model, config): function load_tf_weights_in_transfo_xl (line 125) | def load_tf_weights_in_transfo_xl(model, config, tf_path): class TransfoXLConfig (line 181) | class TransfoXLConfig(object): method __init__ (line 184) | def __init__(self, method from_dict (line 289) | def from_dict(cls, json_object): method from_json_file (line 297) | def from_json_file(cls, json_file): method __repr__ (line 303) | def __repr__(self): method to_dict (line 306) | def to_dict(self): method to_json_string (line 311) | def to_json_string(self): method to_json_file (line 315) | def to_json_file(self, json_file_path): class PositionalEmbedding (line 321) | class PositionalEmbedding(nn.Module): method __init__ (line 322) | def __init__(self, demb): method forward (line 330) | def forward(self, pos_seq, bsz=None): class PositionwiseFF (line 340) | class PositionwiseFF(nn.Module): method __init__ (line 341) | def __init__(self, d_model, d_inner, dropout, pre_lnorm=False): method forward (line 359) | def forward(self, inp): class MultiHeadAttn (line 375) | class MultiHeadAttn(nn.Module): method __init__ (line 376) | def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, method forward (line 405) | def forward(self, h, attn_mask=None, mems=None): class RelMultiHeadAttn (line 456) | class RelMultiHeadAttn(nn.Module): method __init__ (line 457) | def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, method _parallelogram_mask (line 486) | def _parallelogram_mask(self, h, w, left=False): method _shift (line 497) | def _shift(self, x, qlen, klen, mask, left=False): method _rel_shift (line 515) | def _rel_shift(self, x, zero_triu=False): method forward (line 531) | def forward(self, w, r, attn_mask=None, mems=None): class RelPartialLearnableMultiHeadAttn (line 534) | class RelPartialLearnableMultiHeadAttn(RelMultiHeadAttn): method __init__ (line 535) | def __init__(self, *args, **kwargs): method forward (line 540) | def forward(self, w, r, attn_mask=None, mems=None): class RelLearnableMultiHeadAttn (line 615) | class RelLearnableMultiHeadAttn(RelMultiHeadAttn): method __init__ (line 616) | def __init__(self, *args, **kwargs): method forward (line 619) | def forward(self, w, r_emb, r_w_bias, r_bias, attn_mask=None, mems=None): class DecoderLayer (line 700) | class DecoderLayer(nn.Module): method __init__ (line 701) | def __init__(self, n_head, d_model, d_head, d_inner, dropout, **kwargs): method forward (line 708) | def forward(self, dec_inp, dec_attn_mask=None, mems=None): class RelLearnableDecoderLayer (line 716) | class RelLearnableDecoderLayer(nn.Module): method __init__ (line 717) | def __init__(self, n_head, d_model, d_head, d_inner, dropout, method forward (line 726) | def forward(self, dec_inp, r_emb, r_w_bias, r_bias, dec_attn_mask=None... class RelPartialLearnableDecoderLayer (line 735) | class RelPartialLearnableDecoderLayer(nn.Module): method __init__ (line 736) | def __init__(self, n_head, d_model, d_head, d_inner, dropout, method forward (line 745) | def forward(self, dec_inp, r, dec_attn_mask=None, mems=None): class AdaptiveEmbedding (line 755) | class AdaptiveEmbedding(nn.Module): method __init__ (line 756) | def __init__(self, n_token, d_embed, d_proj, cutoffs, div_val=1, method forward (line 786) | def forward(self, inp): class TransfoXLPreTrainedModel (line 819) | class TransfoXLPreTrainedModel(nn.Module): method __init__ (line 823) | def __init__(self, config, *inputs, **kwargs): method init_weight (line 834) | def init_weight(self, weight): method init_bias (line 840) | def init_bias(self, bias): method init_weights (line 843) | def init_weights(self, m): method set_num_special_tokens (line 884) | def set_num_special_tokens(self, num_special_tokens): method from_pretrained (line 888) | def from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwa... class TransfoXLModel (line 1012) | class TransfoXLModel(TransfoXLPreTrainedModel): method __init__ (line 1052) | def __init__(self, config): method backward_compatible (line 1127) | def backward_compatible(self): method reset_length (line 1131) | def reset_length(self, tgt_len, ext_len, mem_len): method init_mems (line 1136) | def init_mems(self, data): method _update_mems (line 1149) | def _update_mems(self, hids, mems, qlen, mlen): method _forward (line 1172) | def _forward(self, dec_inp, mems=None): method forward (line 1262) | def forward(self, input_ids, mems=None): class TransfoXLLMHeadModel (line 1289) | class TransfoXLLMHeadModel(TransfoXLPreTrainedModel): method __init__ (line 1339) | def __init__(self, config): method tie_weights (line 1354) | def tie_weights(self): method reset_length (line 1372) | def reset_length(self, tgt_len, ext_len, mem_len): method init_mems (line 1375) | def init_mems(self, data): method forward (line 1378) | def forward(self, input_ids, target=None, mems=None): FILE: pytorch_pretrained_bert/modeling_transfo_xl_utilities.py class ProjectedAdaptiveLogSoftmax (line 31) | class ProjectedAdaptiveLogSoftmax(nn.Module): method __init__ (line 32) | def __init__(self, n_token, d_embed, d_proj, cutoffs, div_val=1, method _compute_logit (line 78) | def _compute_logit(self, hidden, weight, bias, proj): method forward (line 92) | def forward(self, hidden, target=None, keep_order=False): method log_prob (line 198) | def log_prob(self, hidden): class LogUniformSampler (line 260) | class LogUniformSampler(object): method __init__ (line 261) | def __init__(self, range_max, n_sample): method sample (line 281) | def sample(self, labels): function sample_logits (line 302) | def sample_logits(embedding, bias, labels, inputs, sampler): FILE: pytorch_pretrained_bert/optimization.py class _LRSchedule (line 35) | class _LRSchedule(ABC): method __init__ (line 38) | def __init__(self, warmup=0.002, t_total=-1, **kw): method get_lr (line 53) | def get_lr(self, step, nowarn=False): method get_lr_ (line 73) | def get_lr_(self, progress): class ConstantLR (line 81) | class ConstantLR(_LRSchedule): method get_lr_ (line 82) | def get_lr_(self, progress): class WarmupCosineSchedule (line 86) | class WarmupCosineSchedule(_LRSchedule): method __init__ (line 93) | def __init__(self, warmup=0.002, t_total=-1, cycles=.5, **kw): method get_lr_ (line 103) | def get_lr_(self, progress): class WarmupCosineWithHardRestartsSchedule (line 111) | class WarmupCosineWithHardRestartsSchedule(WarmupCosineSchedule): method __init__ (line 117) | def __init__(self, warmup=0.002, t_total=-1, cycles=1., **kw): method get_lr_ (line 121) | def get_lr_(self, progress): class WarmupCosineWithWarmupRestartsSchedule (line 130) | class WarmupCosineWithWarmupRestartsSchedule(WarmupCosineWithHardRestart... method __init__ (line 136) | def __init__(self, warmup=0.002, t_total=-1, cycles=1., **kw): method get_lr_ (line 141) | def get_lr_(self, progress): class WarmupConstantSchedule (line 151) | class WarmupConstantSchedule(_LRSchedule): method get_lr_ (line 156) | def get_lr_(self, progress): class WarmupLinearSchedule (line 162) | class WarmupLinearSchedule(_LRSchedule): method get_lr_ (line 168) | def get_lr_(self, progress): class BertAdam (line 183) | class BertAdam(Optimizer): method __init__ (line 199) | def __init__(self, params, lr=required, warmup=-1, t_total=-1, schedul... method get_lr (line 224) | def get_lr(self): method step (line 236) | def step(self, closure=None): FILE: pytorch_pretrained_bert/optimization_openai.py class OpenAIAdam (line 29) | class OpenAIAdam(Optimizer): method __init__ (line 32) | def __init__(self, params, lr=required, schedule='warmup_linear', warm... method get_lr (line 58) | def get_lr(self): method step (line 70) | def step(self, closure=None): FILE: pytorch_pretrained_bert/tokenization.py function load_vocab (line 50) | def load_vocab(vocab_file): function whitespace_tokenize (line 65) | def whitespace_tokenize(text): class BertTokenizer (line 74) | class BertTokenizer(object): method __init__ (line 77) | def __init__(self, vocab_file, do_lower_case=True, max_len=None, do_ba... method tokenize (line 107) | def tokenize(self, text, entity_pos=None): method convert_tokens_to_ids (line 141) | def convert_tokens_to_ids(self, tokens): method convert_ids_to_tokens (line 154) | def convert_ids_to_tokens(self, ids): method save_vocabulary (line 161) | def save_vocabulary(self, vocab_path): method from_pretrained (line 177) | def from_pretrained(cls, pretrained_model_name_or_path, cache_dir=None... class BasicTokenizer (line 225) | class BasicTokenizer(object): method __init__ (line 228) | def __init__(self, method tokenize (line 239) | def tokenize(self, text): method _run_strip_accents (line 260) | def _run_strip_accents(self, text): method _run_split_on_punc (line 271) | def _run_split_on_punc(self, text): method _tokenize_chinese_chars (line 293) | def _tokenize_chinese_chars(self, text): method _is_chinese_char (line 306) | def _is_chinese_char(self, cp): method _clean_text (line 328) | def _clean_text(self, text): class WordpieceTokenizer (line 342) | class WordpieceTokenizer(object): method __init__ (line 345) | def __init__(self, vocab, unk_token="[UNK]", max_input_chars_per_word=... method tokenize (line 350) | def tokenize(self, text): function _is_whitespace (line 402) | def _is_whitespace(char): function _is_control (line 414) | def _is_control(char): function _is_punctuation (line 426) | def _is_punctuation(char): FILE: pytorch_pretrained_bert/tokenization_gpt2.py function lru_cache (line 31) | def lru_cache(): function bytes_to_unicode (line 54) | def bytes_to_unicode(): function get_pairs (line 76) | def get_pairs(word): class GPT2Tokenizer (line 88) | class GPT2Tokenizer(object): method from_pretrained (line 94) | def from_pretrained(cls, pretrained_model_name_or_path, cache_dir=None... method __init__ (line 151) | def __init__(self, vocab_file, merges_file, errors='replace', special_... method __len__ (line 170) | def __len__(self): method set_special_tokens (line 173) | def set_special_tokens(self, special_tokens): method bpe (line 186) | def bpe(self, token): method tokenize (line 227) | def tokenize(self, text): method convert_tokens_to_ids (line 238) | def convert_tokens_to_ids(self, tokens): method convert_ids_to_tokens (line 259) | def convert_ids_to_tokens(self, ids, skip_special_tokens=False): method encode (line 270) | def encode(self, text): method decode (line 273) | def decode(self, tokens, skip_special_tokens=False, clean_up_tokenizat... method save_vocabulary (line 283) | def save_vocabulary(self, vocab_path): FILE: pytorch_pretrained_bert/tokenization_openai.py function get_pairs (line 46) | def get_pairs(word): function text_standardize (line 58) | def text_standardize(text): class OpenAIGPTTokenizer (line 73) | class OpenAIGPTTokenizer(object): method from_pretrained (line 82) | def from_pretrained(cls, pretrained_model_name_or_path, cache_dir=None... method __init__ (line 139) | def __init__(self, vocab_file, merges_file, special_tokens=None, max_l... method __len__ (line 162) | def __len__(self): method set_special_tokens (line 165) | def set_special_tokens(self, special_tokens): method bpe (line 181) | def bpe(self, token): method tokenize (line 224) | def tokenize(self, text): method convert_tokens_to_ids (line 239) | def convert_tokens_to_ids(self, tokens): method convert_ids_to_tokens (line 260) | def convert_ids_to_tokens(self, ids, skip_special_tokens=False): method encode (line 271) | def encode(self, text): method decode (line 274) | def decode(self, ids, skip_special_tokens=False, clean_up_tokenization... method save_vocabulary (line 285) | def save_vocabulary(self, vocab_path): FILE: pytorch_pretrained_bert/tokenization_transfo_xl.py class TransfoXLTokenizer (line 53) | class TransfoXLTokenizer(object): method from_pretrained (line 58) | def from_pretrained(cls, pretrained_model_name_or_path, cache_dir=None... method __init__ (line 101) | def __init__(self, special=[], min_freq=0, max_size=None, lower_case=F... method count_file (line 112) | def count_file(self, path, verbose=False, add_eos=False): method count_sents (line 127) | def count_sents(self, sents, verbose=False): method _build_from_file (line 137) | def _build_from_file(self, vocab_file): method save_vocabulary (line 152) | def save_vocabulary(self, vocab_path): method build_vocab (line 160) | def build_vocab(self): method encode_file (line 181) | def encode_file(self, path, ordered=False, verbose=False, add_eos=True, method encode_sents (line 199) | def encode_sents(self, sents, ordered=False, verbose=False): method add_special (line 212) | def add_special(self, sym): method add_symbol (line 218) | def add_symbol(self, sym): method get_sym (line 223) | def get_sym(self, idx): method get_idx (line 227) | def get_idx(self, sym): method convert_ids_to_tokens (line 243) | def convert_ids_to_tokens(self, indices): method convert_tokens_to_ids (line 247) | def convert_tokens_to_ids(self, symbols): method convert_to_tensor (line 251) | def convert_to_tensor(self, symbols): method decode (line 254) | def decode(self, indices, exclude=None): method __len__ (line 261) | def __len__(self): method tokenize (line 264) | def tokenize(self, line, add_eos=False, add_double_eos=False): class LMOrderedIterator (line 284) | class LMOrderedIterator(object): method __init__ (line 285) | def __init__(self, data, bsz, bptt, device='cpu', ext_len=None): method get_batch (line 307) | def get_batch(self, i, bptt=None): method get_fixlen_iter (line 322) | def get_fixlen_iter(self, start=0): method get_varlen_iter (line 326) | def get_varlen_iter(self, start=0, std=5, min_len=5, max_deviation=3): method __iter__ (line 338) | def __iter__(self): class LMShuffledIterator (line 342) | class LMShuffledIterator(object): method __init__ (line 343) | def __init__(self, data, bsz, bptt, device='cpu', ext_len=None, shuffl... method get_sent_stream (line 356) | def get_sent_stream(self): method stream_iterator (line 365) | def stream_iterator(self, sent_stream): method __iter__ (line 414) | def __iter__(self): class LMMultiFileIterator (line 422) | class LMMultiFileIterator(LMShuffledIterator): method __init__ (line 423) | def __init__(self, paths, vocab, bsz, bptt, device='cpu', ext_len=None, method get_sent_stream (line 436) | def get_sent_stream(self, path): method __iter__ (line 444) | def __iter__(self): class TransfoXLCorpus (line 455) | class TransfoXLCorpus(object): method from_pretrained (line 457) | def from_pretrained(cls, pretrained_model_name_or_path, cache_dir=None... method __init__ (line 499) | def __init__(self, *args, **kwargs): method build_corpus (line 506) | def build_corpus(self, path, dataset): method get_iterator (line 545) | def get_iterator(self, split, *args, **kwargs): function get_lm_corpus (line 562) | def get_lm_corpus(datadir, dataset): FILE: tests/conftest.py function pytest_addoption (line 6) | def pytest_addoption(parser): function pytest_collection_modifyitems (line 12) | def pytest_collection_modifyitems(config, items): FILE: tests/modeling_gpt2_test.py class GPT2ModelTest (line 32) | class GPT2ModelTest(unittest.TestCase): class GPT2ModelTester (line 33) | class GPT2ModelTester(object): method __init__ (line 35) | def __init__(self, method prepare_config_and_inputs (line 73) | def prepare_config_and_inputs(self): method create_gpt2_model (line 106) | def create_gpt2_model(self, config, input_ids, token_type_ids, posit... method check_gpt2_model_output (line 117) | def check_gpt2_model_output(self, result): method create_gpt2_lm_head (line 124) | def create_gpt2_lm_head(self, config, input_ids, token_type_ids, pos... method create_gpt2_lm_head_with_output_attention (line 137) | def create_gpt2_lm_head_with_output_attention(self, config, input_id... method check_gpt2_lm_head_output (line 151) | def check_gpt2_lm_head_output(self, result): method check_gpt2_lm_head_loss_output (line 161) | def check_gpt2_lm_head_loss_output(self, result): method create_gpt2_double_heads (line 166) | def create_gpt2_double_heads(self, config, input_ids, token_type_ids... method create_gpt2_double_heads_with_output_attention (line 182) | def create_gpt2_double_heads_with_output_attention(self, config, inp... method check_gpt2_double_heads_output (line 199) | def check_gpt2_double_heads_output(self, result): method check_gpt2_double_heads_loss_output (line 208) | def check_gpt2_double_heads_loss_output(self, result): method create_and_check_gpt2_for_headmasking (line 213) | def create_and_check_gpt2_for_headmasking(self, config, input_ids, t... method create_and_check_gpt2_for_head_pruning (line 268) | def create_and_check_gpt2_for_head_pruning(self, config, input_ids, ... method test_default (line 305) | def test_default(self): method test_config_to_json_string (line 308) | def test_config_to_json_string(self): method test_config_to_json_file (line 314) | def test_config_to_json_file(self): method test_model_from_pretrained (line 323) | def test_model_from_pretrained(self): method run_tester (line 330) | def run_tester(self, tester): method ids_tensor (line 347) | def ids_tensor(cls, shape, vocab_size, rng=None, name=None): FILE: tests/modeling_openai_test.py class OpenAIGPTModelTest (line 32) | class OpenAIGPTModelTest(unittest.TestCase): class OpenAIGPTModelTester (line 33) | class OpenAIGPTModelTester(object): method __init__ (line 35) | def __init__(self, method prepare_config_and_inputs (line 81) | def prepare_config_and_inputs(self): method create_openai_model (line 117) | def create_openai_model(self, config, input_ids, token_type_ids, pos... method check_openai_model_output (line 127) | def check_openai_model_output(self, result): method create_openai_lm_head (line 134) | def create_openai_lm_head(self, config, input_ids, token_type_ids, p... method check_openai_lm_head_output (line 146) | def check_openai_lm_head_output(self, result): method check_openai_lm_head_loss_output (line 152) | def check_openai_lm_head_loss_output(self, result): method create_openai_double_heads (line 157) | def create_openai_double_heads(self, config, input_ids, token_type_i... method check_openai_double_heads_output (line 172) | def check_openai_double_heads_output(self, result): method check_openai_double_heads_loss_output (line 181) | def check_openai_double_heads_loss_output(self, result): method create_and_check_openai_for_headmasking (line 186) | def create_and_check_openai_for_headmasking(self, config, input_ids,... method create_and_check_openai_for_head_pruning (line 242) | def create_and_check_openai_for_head_pruning(self, config, input_ids... method test_default (line 279) | def test_default(self): method test_config_to_json_string (line 282) | def test_config_to_json_string(self): method test_config_to_json_file (line 288) | def test_config_to_json_file(self): method test_model_from_pretrained (line 297) | def test_model_from_pretrained(self): method run_tester (line 304) | def run_tester(self, tester): method ids_tensor (line 321) | def ids_tensor(cls, shape, vocab_size, rng=None, name=None): FILE: tests/modeling_test.py class BertModelTest (line 35) | class BertModelTest(unittest.TestCase): class BertModelTester (line 36) | class BertModelTester(object): method __init__ (line 38) | def __init__(self, method prepare_config_and_inputs (line 84) | def prepare_config_and_inputs(self): method check_loss_output (line 118) | def check_loss_output(self, result): method create_bert_model (line 123) | def create_bert_model(self, config, input_ids, token_type_ids, input... method check_bert_model_output (line 134) | def check_bert_model_output(self, result): method create_bert_for_masked_lm (line 144) | def create_bert_for_masked_lm(self, config, input_ids, token_type_id... method check_bert_for_masked_lm_output (line 155) | def check_bert_for_masked_lm_output(self, result): method create_bert_for_next_sequence_prediction (line 160) | def create_bert_for_next_sequence_prediction(self, config, input_ids... method check_bert_for_next_sequence_prediction_output (line 171) | def check_bert_for_next_sequence_prediction_output(self, result): method create_bert_for_pretraining (line 177) | def create_bert_for_pretraining(self, config, input_ids, token_type_... method check_bert_for_pretraining_output (line 189) | def check_bert_for_pretraining_output(self, result): method create_bert_for_question_answering (line 198) | def create_bert_for_question_answering(self, config, input_ids, toke... method check_bert_for_question_answering_output (line 210) | def check_bert_for_question_answering_output(self, result): method create_bert_for_sequence_classification (line 219) | def create_bert_for_sequence_classification(self, config, input_ids,... method check_bert_for_sequence_classification_output (line 230) | def check_bert_for_sequence_classification_output(self, result): method create_bert_for_token_classification (line 236) | def create_bert_for_token_classification(self, config, input_ids, to... method check_bert_for_token_classification_output (line 247) | def check_bert_for_token_classification_output(self, result): method create_bert_for_multiple_choice (line 253) | def create_bert_for_multiple_choice(self, config, input_ids, token_t... method check_bert_for_multiple_choice (line 272) | def check_bert_for_multiple_choice(self, result): method create_and_check_bert_for_attentions (line 278) | def create_and_check_bert_for_attentions(self, config, input_ids, to... method create_and_check_bert_for_headmasking (line 296) | def create_and_check_bert_for_headmasking(self, config, input_ids, t... method create_and_check_bert_for_head_pruning (line 356) | def create_and_check_bert_for_head_pruning(self, config, input_ids, ... method test_default (line 397) | def test_default(self): method test_config_to_json_string (line 400) | def test_config_to_json_string(self): method test_config_to_json_file (line 406) | def test_config_to_json_file(self): method test_model_from_pretrained (line 415) | def test_model_from_pretrained(self): method run_tester (line 422) | def run_tester(self, tester): method ids_tensor (line 460) | def ids_tensor(cls, shape, vocab_size, rng=None, name=None): FILE: tests/modeling_transfo_xl_test.py class TransfoXLModelTest (line 31) | class TransfoXLModelTest(unittest.TestCase): class TransfoXLModelTester (line 32) | class TransfoXLModelTester(object): method __init__ (line 34) | def __init__(self, method prepare_config_and_inputs (line 72) | def prepare_config_and_inputs(self): method set_seed (line 95) | def set_seed(self): method create_transfo_xl_model (line 99) | def create_transfo_xl_model(self, config, input_ids_1, input_ids_2, ... method check_transfo_xl_model_output (line 113) | def check_transfo_xl_model_output(self, result): method create_transfo_xl_lm_head (line 128) | def create_transfo_xl_lm_head(self, config, input_ids_1, input_ids_2... method check_transfo_xl_lm_head_output (line 150) | def check_transfo_xl_lm_head_output(self, result): method test_default (line 183) | def test_default(self): method test_config_to_json_string (line 186) | def test_config_to_json_string(self): method test_config_to_json_file (line 192) | def test_config_to_json_file(self): method test_model_from_pretrained (line 201) | def test_model_from_pretrained(self): method run_tester (line 208) | def run_tester(self, tester): method ids_tensor (line 220) | def ids_tensor(cls, shape, vocab_size, rng=None, name=None): FILE: tests/optimization_test.py class OptimizationTest (line 30) | class OptimizationTest(unittest.TestCase): method assertListAlmostEqual (line 32) | def assertListAlmostEqual(self, list1, list2, tol): method test_adam (line 37) | def test_adam(self): class ScheduleInitTest (line 54) | class ScheduleInitTest(unittest.TestCase): method test_bert_sched_init (line 55) | def test_bert_sched_init(self): method test_openai_sched_init (line 65) | def test_openai_sched_init(self): class WarmupCosineWithRestartsTest (line 76) | class WarmupCosineWithRestartsTest(unittest.TestCase): method test_it (line 77) | def test_it(self): FILE: tests/tokenization_gpt2_test.py class GPT2TokenizationTest (line 26) | class GPT2TokenizationTest(unittest.TestCase): method test_full_tokenizer (line 28) | def test_full_tokenizer(self): method test_tokenizer_from_pretrained (line 69) | def test_tokenizer_from_pretrained(self): FILE: tests/tokenization_openai_test.py class OpenAIGPTTokenizationTest (line 26) | class OpenAIGPTTokenizationTest(unittest.TestCase): method test_full_tokenizer (line 28) | def test_full_tokenizer(self): method test_tokenizer_from_pretrained (line 70) | def test_tokenizer_from_pretrained(self): FILE: tests/tokenization_test.py class TokenizationTest (line 30) | class TokenizationTest(unittest.TestCase): method test_full_tokenizer (line 32) | def test_full_tokenizer(self): method test_tokenizer_from_pretrained (line 62) | def test_tokenizer_from_pretrained(self): method test_chinese (line 69) | def test_chinese(self): method test_basic_tokenizer_lower (line 76) | def test_basic_tokenizer_lower(self): method test_basic_tokenizer_no_lower (line 84) | def test_basic_tokenizer_no_lower(self): method test_wordpiece_tokenizer (line 91) | def test_wordpiece_tokenizer(self): method test_is_whitespace (line 111) | def test_is_whitespace(self): method test_is_control (line 121) | def test_is_control(self): method test_is_punctuation (line 129) | def test_is_punctuation(self): FILE: tests/tokenization_transfo_xl_test.py class TransfoXLTokenizationTest (line 26) | class TransfoXLTokenizationTest(unittest.TestCase): method test_full_tokenizer (line 28) | def test_full_tokenizer(self): method test_full_tokenizer_lower (line 57) | def test_full_tokenizer_lower(self): method test_full_tokenizer_no_lower (line 64) | def test_full_tokenizer_no_lower(self): method test_tokenizer_from_pretrained (line 72) | def test_tokenizer_from_pretrained(self):