Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/cedrickchee/transformers-llama
/ functions
Functions
36,568 in github.com/cedrickchee/transformers-llama
⨍
Functions
36,568
◇
Types & classes
9,398
↳
Endpoints
539
↓ 87 callers
Method
embed_positions
( self, input_ids: Optional[TFModelInputType] = None, inputs_embeds: Optional[Union[np
src/transformers/models/xglm/modeling_tf_xglm.py:479
↓ 87 callers
Function
shape_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 callers
Method
assert_padded_input_match
(self, input_r: list, input_p: list, max_length: int, pad_token_id: int)
tests/test_tokenization_common.py:296
↓ 86 callers
Function
find_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 callers
Method
main_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 callers
Function
append_call_sample_docstring
(model_class, checkpoint, output_type, config_class, mask=None)
src/transformers/modeling_flax_utils.py:1155
↓ 84 callers
Method
_get_feat_extract_output_lengths
Computes the output length of the convolutional layers
src/transformers/models/sew/modeling_sew.py:765
↓ 84 callers
Method
push_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 callers
Method
parse_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 callers
Method
process_index
The index of the current process used.
src/transformers/training_args.py:1715
↓ 77 callers
Function
_config_zero_init
(config)
tests/models/oneformer/test_modeling_oneformer.py:45
↓ 77 callers
Method
from_pretrained
(cls, retriever_name_or_path, indexed_dataset=None, **kwargs)
src/transformers/models/rag/retrieval_rag.py:419
↓ 77 callers
Method
values
(self)
src/transformers/models/auto/auto_factory.py:635
↓ 75 callers
Method
device
(self)
src/transformers/utils/fx.py:573
↓ 75 callers
Method
save_metrics
(self, latest_metrics, type_path)
examples/research_projects/rag/finetune_rag.py:301
↓ 73 callers
Function
ids_tensor
(shape, vocab_size, rng=None, name=None)
tests/test_modeling_common.py:2668
↓ 72 callers
Method
build_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 callers
Method
get_decoder
(self, **kwargs)
tests/models/wav2vec2_with_lm/test_processor_wav2vec2_with_lm.py:88
↓ 70 callers
Method
get_tokenizers
(self, **kwargs)
tests/models/esm/test_tokenization_esm.py:42
↓ 70 callers
Method
half
(self, *args)
src/transformers/modeling_utils.py:1813
↓ 70 callers
Function
stable_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 callers
Method
to
(self, device)
src/transformers/models/table_transformer/modeling_table_transformer.py:1913
↓ 68 callers
Method
get_head_mask
(self, head_mask)
src/transformers/models/deit/modeling_tf_deit.py:493
↓ 67 callers
Method
save
(self, saveas=None)
examples/research_projects/lxmert/visualizing_image.py:194
↓ 66 callers
Method
__init__
(self, shape, initializer, trainable, name, **kwargs)
templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/modeling_tf_{{cookiecutter.lowercase_modelname}}.py:2835
↓ 66 callers
Method
add
Add a new hypothesis to the list.
src/transformers/generation/beam_search.py:885
↓ 65 callers
Method
add_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 callers
Function
get_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 callers
Method
tokenizer
(self, proto)
src/transformers/convert_slow_tokenizer.py:459
↓ 63 callers
Method
resize_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 callers
Method
from_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 callers
Function
auto_class_update
(cls, checkpoint_for_example="bert-base-cased", head_doc="")
src/transformers/models/auto/auto_factory.py:510
↓ 59 callers
Function
supported_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 callers
Function
to_numpy_array
(img)
src/transformers/image_utils.py:134
↓ 58 callers
Function
_is_whitespace
Checks whether `char` is a whitespace character.
src/transformers/tokenization_utils.py:268
↓ 58 callers
Method
num_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 callers
Method
prepare_config_and_inputs
(self)
tests/models/t5/test_modeling_t5.py:103
↓ 57 callers
Method
_prepare_for_class
(self, inputs_dict, model_class, return_labels=False)
tests/models/splinter/test_modeling_splinter.py:227
↓ 57 callers
Method
parse_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 callers
Function
to_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 callers
Method
_prepare_for_class
(self, inputs_dict, model_class, return_labels=False)
tests/test_modeling_common.py:231
↓ 55 callers
Function
apply_chunking_to_forward
(*args, **kwargs)
src/transformers/utils/dummy_pt_objects.py:7377
↓ 54 callers
Function
require_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 callers
Function
send_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 callers
Method
train
The real training loop.
examples/research_projects/distillation/distiller.py:329
↓ 53 callers
Function
is_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 callers
Function
resize
(image, checkpoint_url)
src/transformers/models/table_transformer/convert_table_transformer_original_pytorch_checkpoint_to_pytorch.py:173
↓ 52 callers
Method
add_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 callers
Method
backward
(ctx, grad)
examples/research_projects/lxmert/modeling_frcnn.py:409
↓ 52 callers
Method
convert_ids_to_tokens
(self, ids)
src/transformers/models/deberta_v2/tokenization_deberta_v2.py:339
↓ 52 callers
Function
get_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 callers
Method
feature_extractor
(self)
src/transformers/models/clip/processing_clip.py:141
↓ 50 callers
Function
_is_punctuation
Checks whether `char` is a punctuation character.
src/transformers/tokenization_utils.py:292
↓ 49 callers
Method
_prepare_for_class
(self, inputs_dict, model_class, return_labels=False)
tests/models/git/test_modeling_git.py:392
↓ 49 callers
Function
center_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 callers
Function
check_min_version
(min_version)
src/transformers/utils/__init__.py:195
↓ 49 callers
Method
close
Closes the progress bar.
src/transformers/utils/notebook.py:195
↓ 49 callers
Method
get_encoder
(self)
src/transformers/models/t5/modeling_t5.py:1379
↓ 49 callers
Method
get_tokenizers
(self, fast=True, **kwargs)
tests/test_tokenization_common.py:208
↓ 49 callers
Method
zero_grad
(self)
examples/research_projects/bertabs/modeling_bertabs.py:1047
↓ 48 callers
Method
_prepare_for_class
(self, inputs_dict, model_class, return_labels=False)
tests/test_modeling_tf_common.py:172
↓ 48 callers
Method
get_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 callers
Function
is_deepspeed_zero3_enabled
()
src/transformers/deepspeed.py:245
↓ 47 callers
Method
save_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 callers
Method
_check_no_pad_token_padding
(self, tokenizer, sequences)
tests/test_tokenization_common.py:2308
↓ 46 callers
Method
run
(self)
setup.py:232
↓ 45 callers
Method
transform
Scikit / Keras interface to transformers' pipelines. This method will forward to __call__().
src/transformers/pipelines/base.py:860
↓ 44 callers
Method
assert_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 callers
Method
from_config
Creates an optimizer from its config with WarmUp custom object.
src/transformers/optimization_tf.py:230
↓ 44 callers
Function
is_sagemaker_mp_enabled
()
src/transformers/utils/import_utils.py:656
↓ 44 callers
Function
make_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 callers
Function
valid_images
(imgs)
src/transformers/image_utils.py:77
↓ 43 callers
Method
evaluate
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 callers
Method
invert_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 callers
Function
_is_control
Checks whether `char` is a control character.
src/transformers/tokenization_utils.py:280
↓ 42 callers
Method
_prepare_for_class
(self, inputs_dict, model_class, return_labels=False)
tests/models/clipseg/test_modeling_clipseg.py:425
↓ 42 callers
Method
_prepare_for_class
(self, inputs_dict, model_class, return_labels=False)
tests/models/perceiver/test_modeling_perceiver.py:308
↓ 42 callers
Function
is_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 callers
Function
is_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 callers
Method
step
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 callers
Method
from_pretrained
(cls, retriever_name_or_path, actor_handles, indexed_dataset=None, **kwargs)
examples/research_projects/rag/distributed_ray_retriever.py:136
↓ 40 callers
Function
rescale
Rescales `image` by `scale`. Args: image (`np.ndarray`): The image to rescale. scale (`float`): The
src/transformers/image_transforms.py:91
↓ 39 callers
Function
cached_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 callers
Method
from_json_file
Constructs a `ModelCard` from a json file of parameters.
src/transformers/modelcard.py:225
↓ 39 callers
Function
get_last_checkpoint
(folder)
src/transformers/trainer_utils.py:162
↓ 38 callers
Method
from_config
(cls, config, **kwargs)
src/transformers/models/auto/auto_factory.py:391
↓ 38 callers
Method
get_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 callers
Function
overwrite_call_docstring
(model_class, docstring)
src/transformers/modeling_flax_utils.py:1146
↓ 37 callers
Method
get_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 callers
Function
normalize
(input_tensors)
src/transformers/models/yoso/modeling_yoso.py:90
↓ 37 callers
Method
to
(self, device)
src/transformers/models/conditional_detr/modeling_conditional_detr.py:2629
↓ 37 callers
Function
torch_int_div
A function that performs integer division across different versions of PyTorch.
src/transformers/pytorch_utils.py:36
↓ 36 callers
Function
get_activation
(activation_string)
src/transformers/activations.py:193
↓ 36 callers
Method
predict
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 callers
Method
trace
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 callers
Method
__init__
( self, config: SpeechT5Config, encoder: Optional[nn.Module] = None, decoder:
src/transformers/models/speecht5/modeling_speecht5.py:2040
↓ 34 callers
Method
__init__
(self, config, input_size, widening_factor)
src/transformers/models/perceiver/modeling_perceiver.py:411
↓ 34 callers
Method
_read_tsv
Reads a tab separated value file.
src/transformers/data/processors/utils.py:119
↓ 34 callers
Method
convert
(self, oneformer: OneFormerModel, is_swin: bool)
src/transformers/models/oneformer/convert_to_hf_oneformer.py:905
↓ 34 callers
Method
cross_entropy
(logits, labels)
tests/models/speech_encoder_decoder/test_modeling_flax_speech_encoder_decoder.py:346
← previous
next →
101–200 of 36,568, ranked by callers