MCPcopy Create free account

hub / github.com/cedrickchee/transformers-llama / functions

Functions36,568 in github.com/cedrickchee/transformers-llama

↓ 87 callersMethodembed_positions
( self, input_ids: Optional[TFModelInputType] = None, inputs_embeds: Optional[Union[np
src/transformers/models/xglm/modeling_tf_xglm.py:479
↓ 87 callersFunctionshape_list
Deal with dynamic shape in tensorflow cleanly. Args: tensor (`tf.Tensor` or `np.ndarray`): The tensor we want the shape of. Ret
src/transformers/tf_utils.py:26
↓ 86 callersMethodassert_padded_input_match
(self, input_r: list, input_p: list, max_length: int, pad_token_id: int)
tests/test_tokenization_common.py:296
↓ 86 callersFunctionfind_pruneable_heads_and_indices
Finds the heads and their indices taking `already_pruned_heads` into account. Args: heads (`List[int]`): List of the indices of head
src/transformers/pytorch_utils.py:251
↓ 86 callersMethodmain_process_first
A context manager for torch distributed environment where on needs to do something on the main process, while blocking replicas, and
src/transformers/training_args.py:1809
↓ 85 callersFunctionappend_call_sample_docstring
(model_class, checkpoint, output_type, config_class, mask=None)
src/transformers/modeling_flax_utils.py:1155
↓ 84 callersMethod_get_feat_extract_output_lengths
Computes the output length of the convolutional layers
src/transformers/models/sew/modeling_sew.py:765
↓ 84 callersMethodpush_to_hub
Upload the {object_files} to the 🤗 Model Hub while synchronizing a local clone of the repo in `repo_path_or_name`. Parameter
src/transformers/utils/hub.py:703
↓ 82 callersMethodparse_args_into_dataclasses
Parse command-line args into instances of the specified dataclass types. This relies on argparse's `ArgumentParser.parse_known_args`
src/transformers/hf_argparser.py:259
↓ 80 callersMethodprocess_index
The index of the current process used.
src/transformers/training_args.py:1715
↓ 77 callersFunction_config_zero_init
(config)
tests/models/oneformer/test_modeling_oneformer.py:45
↓ 77 callersMethodfrom_pretrained
(cls, retriever_name_or_path, indexed_dataset=None, **kwargs)
src/transformers/models/rag/retrieval_rag.py:419
↓ 77 callersMethodvalues
(self)
src/transformers/models/auto/auto_factory.py:635
↓ 75 callersMethoddevice
(self)
src/transformers/utils/fx.py:573
↓ 75 callersMethodsave_metrics
(self, latest_metrics, type_path)
examples/research_projects/rag/finetune_rag.py:301
↓ 73 callersFunctionids_tensor
(shape, vocab_size, rng=None, name=None)
tests/test_modeling_common.py:2668
↓ 72 callersMethodbuild_inputs_with_special_tokens
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and adding special tokens
src/transformers/models/t5/tokenization_t5.py:256
↓ 72 callersMethodget_decoder
(self, **kwargs)
tests/models/wav2vec2_with_lm/test_processor_wav2vec2_with_lm.py:88
↓ 70 callersMethodget_tokenizers
(self, **kwargs)
tests/models/esm/test_tokenization_esm.py:42
↓ 70 callersMethodhalf
(self, *args)
src/transformers/modeling_utils.py:1813
↓ 70 callersFunctionstable_softmax
Stable wrapper that returns the same output as `tf.nn.softmax`, but that works reliably with XLA on CPU. It is meant as a workaround for the
src/transformers/tf_utils.py:49
↓ 69 callersMethodto
(self, device)
src/transformers/models/table_transformer/modeling_table_transformer.py:1913
↓ 68 callersMethodget_head_mask
(self, head_mask)
src/transformers/models/deit/modeling_tf_deit.py:493
↓ 67 callersMethodsave
(self, saveas=None)
examples/research_projects/lxmert/visualizing_image.py:194
↓ 66 callersMethod__init__
(self, shape, initializer, trainable, name, **kwargs)
templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/modeling_tf_{{cookiecutter.lowercase_modelname}}.py:2835
↓ 66 callersMethodadd
Add a new hypothesis to the list.
src/transformers/generation/beam_search.py:885
↓ 65 callersMethodadd_tokens
Add a list of new tokens to the tokenizer class. If the new tokens are not in the vocabulary, they are added to it with indices start
src/transformers/tokenization_utils_base.py:938
↓ 65 callersFunctionget_image_size
Returns the (height, width) dimensions of the image. Args: image (`np.ndarray`): The image to get the dimensions of.
src/transformers/image_utils.py:187
↓ 65 callersMethodtokenizer
(self, proto)
src/transformers/convert_slow_tokenizer.py:459
↓ 63 callersMethodresize_token_embeddings
Resizes input token embeddings matrix of the model if `new_num_tokens != config.vocab_size`. Takes care of tying weights embeddings
src/transformers/modeling_utils.py:1333
↓ 62 callersMethodfrom_encoder_decoder_pretrained
r""" Instantiate an encoder and a decoder from one or two base classes of the library from pretrained model checkpoints. The
src/transformers/models/encoder_decoder/modeling_encoder_decoder.py:382
↓ 61 callersFunctionauto_class_update
(cls, checkpoint_for_example="bert-base-cased", head_doc="")
src/transformers/models/auto/auto_factory.py:510
↓ 59 callersFunctionsupported_features_mapping
Generate the mapping between supported the features and their corresponding OnnxConfig for a given model. Args: *supported_features:
src/transformers/onnx/features.py:55
↓ 59 callersFunctionto_numpy_array
(img)
src/transformers/image_utils.py:134
↓ 58 callersFunction_is_whitespace
Checks whether `char` is a whitespace character.
src/transformers/tokenization_utils.py:268
↓ 58 callersMethodnum_special_tokens_to_add
Returns the number of added tokens when encoding a sequence with special tokens. <Tip> This encodes a dummy input and check
src/transformers/tokenization_utils.py:458
↓ 58 callersMethodprepare_config_and_inputs
(self)
tests/models/t5/test_modeling_t5.py:103
↓ 57 callersMethod_prepare_for_class
(self, inputs_dict, model_class, return_labels=False)
tests/models/splinter/test_modeling_splinter.py:227
↓ 57 callersMethodparse_json_file
Alternative helper method that does not use `argparse` at all, instead loading a json file and populating the dataclass types.
src/transformers/hf_argparser.py:373
↓ 57 callersFunctionto_channel_dimension_format
Converts `image` to the channel dimension format specified by `channel_dim`. Args: image (`numpy.ndarray`): The image to
src/transformers/image_transforms.py:54
↓ 56 callersMethod_prepare_for_class
(self, inputs_dict, model_class, return_labels=False)
tests/test_modeling_common.py:231
↓ 55 callersFunctionapply_chunking_to_forward
(*args, **kwargs)
src/transformers/utils/dummy_pt_objects.py:7377
↓ 54 callersFunctionrequire_version
Perform a runtime check of the dependency versions, using the exact same syntax used by pip. The installed module version comes from the *si
src/transformers/utils/versions.py:55
↓ 54 callersFunctionsend_example_telemetry
Sends telemetry that helps tracking the examples use. Args: example_name (`str`): The name of the example. *example_args (da
src/transformers/utils/hub.py:801
↓ 54 callersMethodtrain
The real training loop.
examples/research_projects/distillation/distiller.py:329
↓ 53 callersFunctionis_torch_tpu_available
Checks if `torch_xla` is installed and potentially if a TPU is in the environment
src/transformers/utils/import_utils.py:439
↓ 53 callersFunctionresize
(image, checkpoint_url)
src/transformers/models/table_transformer/convert_table_transformer_original_pytorch_checkpoint_to_pytorch.py:173
↓ 52 callersMethodadd_special_tokens
Add a dictionary of special tokens (eos, pad, cls, etc.) to the encoder and link them to class attributes. If special tokens are NOT
src/transformers/tokenization_utils_base.py:844
↓ 52 callersMethodbackward
(ctx, grad)
examples/research_projects/lxmert/modeling_frcnn.py:409
↓ 52 callersMethodconvert_ids_to_tokens
(self, ids)
src/transformers/models/deberta_v2/tokenization_deberta_v2.py:339
↓ 52 callersFunctionget_tests_dir
Args: append_path: optional path to append to the tests dir path Return: The full path to the `tests` dir, so that the tests
src/transformers/testing_utils.py:771
↓ 51 callersMethodfeature_extractor
(self)
src/transformers/models/clip/processing_clip.py:141
↓ 50 callersFunction_is_punctuation
Checks whether `char` is a punctuation character.
src/transformers/tokenization_utils.py:292
↓ 49 callersMethod_prepare_for_class
(self, inputs_dict, model_class, return_labels=False)
tests/models/git/test_modeling_git.py:392
↓ 49 callersFunctioncenter_to_corners_format
Converts bounding boxes from center format to corners format. center format: contains the coordinate for the center of the box and its width
src/transformers/image_transforms.py:483
↓ 49 callersFunctioncheck_min_version
(min_version)
src/transformers/utils/__init__.py:195
↓ 49 callersMethodclose
Closes the progress bar.
src/transformers/utils/notebook.py:195
↓ 49 callersMethodget_encoder
(self)
src/transformers/models/t5/modeling_t5.py:1379
↓ 49 callersMethodget_tokenizers
(self, fast=True, **kwargs)
tests/test_tokenization_common.py:208
↓ 49 callersMethodzero_grad
(self)
examples/research_projects/bertabs/modeling_bertabs.py:1047
↓ 48 callersMethod_prepare_for_class
(self, inputs_dict, model_class, return_labels=False)
tests/test_modeling_tf_common.py:172
↓ 48 callersMethodget_bias
Dict of bias attached to an LM head. The key represents the name of the bias attribute. Return: `tf.Variable`: The weigh
src/transformers/modeling_tf_utils.py:1828
↓ 48 callersFunctionis_deepspeed_zero3_enabled
()
src/transformers/deepspeed.py:245
↓ 47 callersMethodsave_model
Will save the model, so you can reload it using `from_pretrained()`. Will only save from the main process.
src/transformers/trainer.py:2710
↓ 46 callersMethod_check_no_pad_token_padding
(self, tokenizer, sequences)
tests/test_tokenization_common.py:2308
↓ 46 callersMethodrun
(self)
setup.py:232
↓ 45 callersMethodtransform
Scikit / Keras interface to transformers' pipelines. This method will forward to __call__().
src/transformers/pipelines/base.py:860
↓ 44 callersMethodassert_batch_padded_input_match
( self, input_r: dict, input_p: dict, max_length: int, pad_token_id: i
tests/models/fnet/test_tokenization_fnet.py:419
↓ 44 callersMethodfrom_config
Creates an optimizer from its config with WarmUp custom object.
src/transformers/optimization_tf.py:230
↓ 44 callersFunctionis_sagemaker_mp_enabled
()
src/transformers/utils/import_utils.py:656
↓ 44 callersFunctionmake_list_of_images
Ensure that the input is a list of images. If the input is a single image, it is converted to a list of length 1. If the input is a batch of
src/transformers/image_utils.py:95
↓ 44 callersFunctionvalid_images
(imgs)
src/transformers/image_utils.py:77
↓ 43 callersMethodevaluate
Run evaluation and returns metrics. The calling script will be responsible for providing a method to compute metrics, as they are ta
src/transformers/trainer.py:2887
↓ 43 callersMethodinvert_attention_mask
Invert an attention mask (e.g., switches 0. and 1.). Args: encoder_attention_mask (`torch.Tensor`): An attention mask.
src/transformers/modeling_utils.py:757
↓ 42 callersFunction_is_control
Checks whether `char` is a control character.
src/transformers/tokenization_utils.py:280
↓ 42 callersMethod_prepare_for_class
(self, inputs_dict, model_class, return_labels=False)
tests/models/clipseg/test_modeling_clipseg.py:425
↓ 42 callersMethod_prepare_for_class
(self, inputs_dict, model_class, return_labels=False)
tests/models/perceiver/test_modeling_perceiver.py:308
↓ 42 callersFunctionis_main_process
Whether or not the current process is the local process, based on `xm.get_ordinal()` (for TPUs) first, then on `local_rank`.
src/transformers/trainer_utils.py:309
↓ 42 callersFunctionis_torch_tensor
Tests if `x` is a torch tensor or not. Safe to call even if torch is not installed.
src/transformers/utils/generic.py:103
↓ 42 callersMethodstep
One optimization step: forward of student AND teacher, backward on the loss (for gradient accumulation), and possibly a parameter upd
examples/research_projects/distillation/distiller.py:371
↓ 40 callersMethodfrom_pretrained
(cls, retriever_name_or_path, actor_handles, indexed_dataset=None, **kwargs)
examples/research_projects/rag/distributed_ray_retriever.py:136
↓ 40 callersFunctionrescale
Rescales `image` by `scale`. Args: image (`np.ndarray`): The image to rescale. scale (`float`): The
src/transformers/image_transforms.py:91
↓ 39 callersFunctioncached_file
Tries to locate a file in a local folder and repo, downloads and cache it if necessary. Args: path_or_repo_id (`str` or `os.PathLike
src/transformers/utils/hub.py:295
↓ 39 callersMethodfrom_json_file
Constructs a `ModelCard` from a json file of parameters.
src/transformers/modelcard.py:225
↓ 39 callersFunctionget_last_checkpoint
(folder)
src/transformers/trainer_utils.py:162
↓ 38 callersMethodfrom_config
(cls, config, **kwargs)
src/transformers/models/auto/auto_factory.py:391
↓ 38 callersMethodget_extended_attention_mask
Makes broadcastable attention and causal masks so that future and masked tokens are ignored. Arguments: word_attention_m
src/transformers/models/luke/modeling_luke.py:1194
↓ 38 callersFunctionoverwrite_call_docstring
(model_class, docstring)
src/transformers/modeling_flax_utils.py:1146
↓ 37 callersMethodget_config_dict
From a `pretrained_model_name_or_path`, resolve to a dictionary of parameters, to be used for instantiating a [`PretrainedConfig`] us
src/transformers/configuration_utils.py:556
↓ 37 callersFunctionnormalize
(input_tensors)
src/transformers/models/yoso/modeling_yoso.py:90
↓ 37 callersMethodto
(self, device)
src/transformers/models/conditional_detr/modeling_conditional_detr.py:2629
↓ 37 callersFunctiontorch_int_div
A function that performs integer division across different versions of PyTorch.
src/transformers/pytorch_utils.py:36
↓ 36 callersFunctionget_activation
(activation_string)
src/transformers/activations.py:193
↓ 36 callersMethodpredict
Run prediction and returns predictions and potential metrics. Depending on the dataset and your use case, your test dataset may cont
src/transformers/trainer.py:2958
↓ 35 callersMethodtrace
Traces `root` and returns the corresponding FX `torch.fx.Graph` representation. `root` can either be a `torch.nn.Module` instance or
src/transformers/utils/fx.py:944
↓ 34 callersMethod__init__
( self, config: SpeechT5Config, encoder: Optional[nn.Module] = None, decoder:
src/transformers/models/speecht5/modeling_speecht5.py:2040
↓ 34 callersMethod__init__
(self, config, input_size, widening_factor)
src/transformers/models/perceiver/modeling_perceiver.py:411
↓ 34 callersMethod_read_tsv
Reads a tab separated value file.
src/transformers/data/processors/utils.py:119
↓ 34 callersMethodconvert
(self, oneformer: OneFormerModel, is_swin: bool)
src/transformers/models/oneformer/convert_to_hf_oneformer.py:905
↓ 34 callersMethodcross_entropy
(logits, labels)
tests/models/speech_encoder_decoder/test_modeling_flax_speech_encoder_decoder.py:346
← previousnext →101–200 of 36,568, ranked by callers