MCPcopy Create free account

hub / github.com/huggingface/transformers / functions

Functions4,119 in github.com/huggingface/transformers

↓ 4 callersMethod_get_hidden_states
(self)
tests/test_modeling_reformer.py:615
↓ 4 callersMethod_get_resized_embeddings
Build a resized Embedding Module from a provided token Embedding Module. Increasing the size will add newly initialized vectors at the en
src/transformers/modeling_utils.py:408
↓ 4 callersFunction_is_control
Checks whether `chars` is a control character.
src/transformers/tokenization_utils.py:59
↓ 4 callersFunction_is_punctuation
Checks whether `chars` is a punctuation character.
src/transformers/tokenization_utils.py:71
↓ 4 callersFunction_is_whitespace
Checks whether `chars` is a whitespace character.
src/transformers/tokenization_utils.py:47
↓ 4 callersFunction_make_linear_from_emb
(emb)
src/transformers/modeling_bart.py:164
↓ 4 callersMethod_split_seq_length_dim_to
splits sequence length dim of vectors into `dim_factor_1` and `dim_factor_2` dims
src/transformers/modeling_reformer.py:282
↓ 4 callersMethod_test_distiller_cli
(self, updates, check_contents=True)
examples/seq2seq/test_seq2seq_examples.py:153
↓ 4 callersFunctionbuild_mask
Builds the mask. The attention mechanism will only attend to positions with value 1.
examples/seq2seq/bertabs/utils_summarization.py:121
↓ 4 callersMethodcheck_loss_output
(self, result)
templates/adding_a_new_model/tests/test_modeling_xxx.py:131
↓ 4 callersMethodcheck_loss_output
(self, result)
tests/test_modeling_roberta.py:103
↓ 4 callersMethodevaluate
Prediction/evaluation loop, shared by `evaluate()` and `predict()`.
src/transformers/trainer_tf.py:266
↓ 4 callersFunctionfloats_tensor
Creates a random float32 tensor
tests/test_modeling_common.py:837
↓ 4 callersFunctiongeneric_train
( model: BaseTransformer, args: argparse.Namespace, early_stopping_callback=False, logger=True
examples/lightning_base.py:276
↓ 4 callersMethodget_decoder
(self)
src/transformers/modeling_t5.py:880
↓ 4 callersMethodget_dev_examples
See base class.
examples/multiple-choice/utils_multiple_choice.py:408
↓ 4 callersMethodget_output_embeddings
(self)
templates/adding_a_new_model/modeling_xxx.py:428
↓ 4 callersMethodget_train_examples
See base class.
examples/multiple-choice/utils_multiple_choice.py:403
↓ 4 callersFunctionglue_compute_metrics
(task_name, preds, labels)
src/transformers/data/metrics/__init__.py:53
↓ 4 callersFunctionh
(e,t,o)
docs/source/_static/js/custom.js:246
↓ 4 callersFunctioninvert_mask
Turns 1->0, 0->1, False->True, True-> False
src/transformers/modeling_bart.py:109
↓ 4 callersFunctionis_psutil_available
()
src/transformers/file_utils.py:143
↓ 4 callersMethodlogin
Call HF API to sign in a user and get a token if credentials are valid. Outputs: token if credentials are valid
src/transformers/hf_api.py:102
↓ 4 callersMethodmodel_list
Get the public list of all the models on huggingface, including the community models
src/transformers/hf_api.py:195
↓ 4 callersMethodprepare_config_and_inputs
(self)
tests/test_modeling_openai.py:63
↓ 4 callersMethodprepare_config_and_inputs
(self)
tests/test_modeling_tf_openai_gpt.py:64
↓ 4 callersFunctionprocess_story
Extract the story and summary from a story file. Arguments: raw_story (str): content of the story file as an utf-8 encoded string.
examples/seq2seq/bertabs/utils_summarization.py:62
↓ 4 callersFunctionr
(n)
docs/source/_static/js/custom.js:246
↓ 4 callersMethodreset
Resets the accumulated gradients on the current replica.
src/transformers/optimization_tf.py:262
↓ 4 callersFunctions
(e,t,o)
docs/source/_static/js/custom.js:246
↓ 4 callersMethodsave_model
Save the pretrained model.
src/transformers/trainer_tf.py:492
↓ 4 callersFunctionseparate_process_wrapper_fn
This function wraps another function into its own separated process. In order to ensure accurate memory measurements it is important
src/transformers/benchmark/benchmark_utils.py:64
↓ 4 callersFunctionset_param
(torch_layer, weight, bias=None)
src/transformers/convert_reformer_trax_checkpoint_to_pytorch.py:31
↓ 4 callersMethodset_seed
(self)
tests/test_modeling_tf_xlnet.py:129
↓ 4 callersMethodto_json_file
Save this instance to a json file.
src/transformers/modelcard.py:211
↓ 4 callersMethodtrain
Train method to train the model.
src/transformers/trainer_tf.py:283
↓ 4 callersMethodtransform
Scikit / Keras interface to transformers' pipelines. This method will forward to __call__().
src/transformers/pipelines.py:418
↓ 4 callersFunctiontruncate_or_pad
Adapt the source and target sequences' lengths to the block size. If the sequence is shorter we append padding token to the right of the sequence
examples/seq2seq/bertabs/utils_summarization.py:110
↓ 4 callersFunctionwhitespace_tokenize
Runs basic whitespace cleaning and splitting on a piece of text.
src/transformers/tokenization_bert.py:111
↓ 3 callersFunctionBody
(*x, **y)
src/transformers/commands/serving.py:21
↓ 3 callersMethod__init__
(self, config)
src/transformers/modeling_ctrl.py:299
↓ 3 callersMethod__init__
TFConv1D layer as defined by Radford et al. for OpenAI GPT (and also used in GPT-2) Basically works like a Linear layer but the weights a
src/transformers/modeling_tf_utils.py:1590
↓ 3 callersMethod__init__
(self, *args, **kwargs)
src/transformers/tokenization_transfo_xl.py:708
↓ 3 callersFunction_config_zero_init
(config)
tests/test_modeling_common.py:45
↓ 3 callersMethod_create_and_check_torchscript
(self, config, inputs_dict)
tests/test_modeling_common.py:238
↓ 3 callersMethod_create_examples
Creates examples for the training, dev and test sets.
src/transformers/data/processors/glue.py:196
↓ 3 callersMethod_create_examples
Creates examples for the training, dev and test sets.
src/transformers/data/processors/glue.py:238
↓ 3 callersMethod_create_examples
Creates examples for the training, dev and test sets.
src/transformers/data/processors/glue.py:292
↓ 3 callersMethod_create_examples
Creates examples for the training, dev and test sets.
src/transformers/data/processors/glue.py:335
↓ 3 callersMethod_create_examples
Creates examples for the training, dev and test sets.
src/transformers/data/processors/glue.py:377
↓ 3 callersMethod_create_examples
Creates examples for the training, dev and test sets.
src/transformers/data/processors/glue.py:467
↓ 3 callersMethod_create_examples
Creates examples for the training, dev and test sets.
src/transformers/data/processors/glue.py:509
↓ 3 callersMethod_create_examples
Creates examples for the training, dev and test sets.
src/transformers/data/processors/glue.py:551
↓ 3 callersMethod_create_examples
Creates examples for the training and dev sets.
examples/multiple-choice/utils_multiple_choice.py:280
↓ 3 callersMethod_create_examples
Creates examples for the training and dev sets.
examples/multiple-choice/utils_multiple_choice.py:330
↓ 3 callersMethod_create_examples
Creates examples for the training and dev sets.
examples/multiple-choice/utils_multiple_choice.py:379
↓ 3 callersMethod_create_examples
Creates examples for the training and dev sets.
examples/multiple-choice/utils_multiple_choice.py:426
↓ 3 callersMethod_get_padding_truncation_strategies
Find the correct padding/truncation strategy with backward compatibility for old arguments (truncation_strategy and pad_to_max_length) an
src/transformers/tokenization_utils_base.py:1433
↓ 3 callersMethod_log
(self, logs: Dict[str, float], iterator: Optional[tqdm] = None)
src/transformers/trainer.py:542
↓ 3 callersMethod_look_adjacent
Used to implement attention between consecutive chunks. Args: vectors: array of shape [batch_size, num_attention_heads,
src/transformers/modeling_reformer.py:244
↓ 3 callersFunction_prepare_bart_decoder_inputs
Prepare masks that ignore padding tokens in the decoder and a causal mask for the decoder if none are provided. This mimics the default behavior i
src/transformers/modeling_bart.py:115
↓ 3 callersMethod_read_csv
(self, input_file)
examples/multiple-choice/utils_multiple_choice.py:326
↓ 3 callersMethod_read_csv
(self, input_file)
examples/multiple-choice/utils_multiple_choice.py:375
↓ 3 callersMethod_read_json
(self, input_file)
examples/multiple-choice/utils_multiple_choice.py:421
↓ 3 callersMethod_read_txt
(self, input_dir)
examples/multiple-choice/utils_multiple_choice.py:270
↓ 3 callersMethod_test_export
(self, model, framework, opset, tokenizer=None)
tests/test_onnx.py:52
↓ 3 callersFunctionadd_generic_args
(parser, root_dir)
examples/lightning_base.py:235
↓ 3 callersMethodassertListAlmostEqual
(self, list1, list2, tol)
tests/test_optimization_tf.py:17
↓ 3 callersMethodassert_dump_and_restore
(self, be_original: BatchEncoding, equal_op: Optional[Callable] = None)
tests/test_tokenization_utils.py:39
↓ 3 callersMethodavg_representation
(self, x)
examples/text-generation/pplm/run_pplm_discrim_train.py:65
↓ 3 callersMethodbuild
(self, input_shape)
src/transformers/modeling_tf_transfo_xl.py:763
↓ 3 callersFunctioncompute_heads_importance
This method shows how to compute: - head attention entropy - head importance scores according to http://arxiv.org/abs/1905.10650
examples/bertology/run_bertology.py:66
↓ 3 callersFunctioncompute_predictions_log_probs
XLNet write prediction logic (more complex than Bert's). Write final predictions to the json file and log-odds of null if needed. Re
src/transformers/data/metrics/squad_metrics.py:576
↓ 3 callersFunctioncompute_predictions_logits
Write final predictions to the json file and log-odds of null if needed.
src/transformers/data/metrics/squad_metrics.py:371
↓ 3 callersFunctionconvert
(source_dir: Path, dest_dir)
src/transformers/convert_marian_to_pytorch.py:494
↓ 3 callersFunctionconvert_examples_to_features
Loads a data file into a list of `InputFeatures`
examples/multiple-choice/utils_multiple_choice.py:491
↓ 3 callersFunctionconvert_opus_name_to_hf_name
(x)
src/transformers/convert_marian_to_pytorch.py:136
↓ 3 callersMethodconvert_tokens_to_string
Converts a sequence of tokens (string) in a single string.
src/transformers/tokenization_t5.py:191
↓ 3 callersFunctioncopy_layers
(teacher_layers: nn.ModuleList, student_layers: nn.ModuleList, layers_to_copy: List)
examples/seq2seq/initialization_utils.py:17
↓ 3 callersFunctiondefault_data_collator
Very simple data collator that: - simply collates batches of dict-like objects - Performs special handling for potential keys named:
src/transformers/data/data_collator.py:19
↓ 3 callersFunctionembed_passages_for_retrieval
(passages, tokenizer, qa_embedder, max_length=128, device="cuda:0")
examples/longform-qa/eli5_utils.py:533
↓ 3 callersFunctionembed_questions_for_retrieval
(q_ls, tokenizer, qa_embedder, device="cuda:0")
examples/longform-qa/eli5_utils.py:544
↓ 3 callersMethodget_dataloader
(self, type_path: str, batch_size: int, shuffle: bool = False)
examples/seq2seq/finetune.py:192
↓ 3 callersMethodget_examples_from_dataset
Creates a list of :class:`~transformers.data.processors.squad.SquadExample` using a TFDS dataset. Args: dataset: The tfd
src/transformers/data/processors/squad.py:482
↓ 3 callersFunctionget_labels
(path: str)
examples/token-classification/utils_ner.py:390
↓ 3 callersFunctionget_masks
Generate hidden states mask, and optionally an attention mask.
src/transformers/modeling_xlm.py:68
↓ 3 callersMethodget_test_examples
(self, data_dir)
examples/multiple-choice/utils_multiple_choice.py:413
↓ 3 callersMethodget_tokenizer
(self, **kwargs)
tests/test_tokenization_common.py:101
↓ 3 callersFunctionglue_convert_examples_to_features
Loads a data file into a list of ``InputFeatures`` Args: examples: List of ``InputExamples`` or ``tf.data.Dataset`` containing the e
src/transformers/data/processors/glue.py:34
↓ 3 callersFunctiongrad_status
(model: nn.Module)
examples/seq2seq/utils.py:244
↓ 3 callersFunctioninfer_shapes
(nlp: Pipeline, framework: str)
src/transformers/convert_graph_to_onnx.py:69
↓ 3 callersFunctionmake_test_data_dir
(**kwargs)
examples/seq2seq/test_seq2seq_examples.py:96
↓ 3 callersFunctionmerge_model_tokenizer_mappings
( model_mapping: Dict["PretrainedConfig", Union["PreTrainedModel", "TFPreTrainedModel"]], tokenizer_ma
tests/test_tokenization_common.py:37
↓ 3 callersFunctionnormalize_answer
Lower text and remove punctuation, articles and extra whitespace.
src/transformers/data/metrics/squad_metrics.py:24
↓ 3 callersFunctionprepare_bart_inputs_dict
( config, input_ids, attention_mask=None, )
tests/test_modeling_bart.py:101
↓ 3 callersMethodprepare_config_and_inputs
(self)
tests/test_modeling_transfo_xl.py:57
↓ 3 callersMethodprepare_config_and_inputs
(self)
tests/test_modeling_tf_transfo_xl.py:61
↓ 3 callersMethodprepare_config_and_inputs
(self)
tests/test_modeling_tf_ctrl.py:59
↓ 3 callersMethodprepare_config_and_inputs
(self)
tests/test_modeling_ctrl.py:58
↓ 3 callersFunctionprune_conv1d_layer
Prune a Conv1D layer (a model parameters) to keep only entries in index. A Conv1D work as a Linear layer (see e.g. BERT) but the weights are
src/transformers/modeling_utils.py:2122
← previousnext →201–300 of 4,119, ranked by callers