MCPcopy Create free account

hub / github.com/AMAP-ML/EMF / functions

Functions947 in github.com/AMAP-ML/EMF

↓ 150 callersMethodfrom_pretrained
r""" Instantiates a new model from a pretrained model from `transformers`. The pretrained model is loaded using the `from_pretrained`
trl/trl/models/modeling_base.py:111
↓ 53 callersMethodpush_to_hub
r""" Push the pretrained model to the hub. This method is a wrapper around `transformers.PreTrainedModel.push_to_hub`. Please refer to
trl/trl/models/modeling_base.py:507
↓ 41 callersMethodtrain
(self)
trl/trl/trainer/ppo_trainer.py:347
↓ 37 callersMethodupdate
Updates running moments from batch's moments computed across ranks
trl/trl/trainer/utils.py:409
↓ 32 callersMethodsave_model
(self, output_dir: Optional[str] = None, _internal_call: bool = False)
trl/trl/trainer/ppo_trainer.py:332
↓ 30 callersMethodgenerate
Generates model completions for the provided prompts. Args: prompts (`list[str]`): List of text prompts
trl/trl/extras/vllm_client.py:168
↓ 25 callersMethodlog
Log `logs` on the various objects watching training, including stored metrics. Args: logs (`dict[str, float]`):
trl/trl/trainer/kto_trainer.py:1632
↓ 25 callersFunctionpad
Pads a list of tensors to the same shape along the first dimension. Args: tensors (`list[torch.Tensor]`): List of input
trl/trl/trainer/utils.py:245
↓ 24 callersMethodadd
(self, val)
trl/trl/data_utils.py:455
↓ 20 callersFunctionget_peft_config
(model_args: ModelConfig)
trl/trl/trainer/utils.py:618
↓ 19 callersMethoddecode
(self, quant)
tok/ar_dtok/vqvae.py:87
↓ 19 callersFunctionempty_cache
Empties the cache of the available torch device. This function checks for the availability of different torch devices (XPU, MLU, NPU, CUDA) and e
trl/trl/trainer/utils.py:1193
↓ 18 callersFunctiongenerate_model_card
Generate a `ModelCard` from a template. Args: base_model (`str` or `None`): Base model name. model_name (`str`):
trl/trl/trainer/utils.py:1229
↓ 18 callersFunctionget_kbit_device_map
()
trl/trl/trainer/utils.py:611
↓ 18 callersMethodparse_args_and_config
Parse command-line args and config file into instances of the specified dataclass types. This method wraps [`transformers.HfArgument
trl/trl/scripts/utils.py:183
↓ 18 callersFunctionrank0_print
(*args)
blip3o/utils.py:4
↓ 17 callersFunctiondisable_dropout_in_model
(model: torch.nn.Module)
trl/trl/trainer/utils.py:527
↓ 17 callersFunctionget_comet_experiment_url
If Comet integration is enabled, return the URL of the current Comet experiment; otherwise, return `None`.
trl/trl/trainer/utils.py:1303
↓ 16 callersFunctionget_quantization_config
(model_args: ModelConfig)
trl/trl/trainer/utils.py:592
↓ 16 callersFunctionpad_to_length
(tensor: torch.Tensor, length: int, pad_value: Union[int, float], dim: int = -1)
trl/trl/trainer/utils.py:512
↓ 14 callersFunctionis_conversational
r""" Check if the example is in a conversational format. Args: example (`dict[str, Any]`): A single data entry of a datas
trl/trl/data_utils.py:31
↓ 14 callersFunctionselective_log_softmax
A memory-efficient implementation of the common `log_softmax -> gather` operation. This function is equivalent to the following naive implem
trl/trl/trainer/utils.py:1429
↓ 13 callersFunctionunwrap_model_for_generation
Context manager to unwrap distributed or accelerated models for generation tasks. Args: model (`Union[DistributedDataParallel, DeepS
trl/trl/models/utils.py:291
↓ 12 callersMethod_prepare_inputs
( self, generation_batch: dict[str, Union[torch.Tensor, Any]] )
trl/trl/trainer/grpo_trainer.py:1291
↓ 12 callersFunctionprepare_deepspeed
Prepares the model for training with DeepSpeed (both for stage 2 and 3), configuring the appropriate settings based on the model and batch si
trl/trl/trainer/utils.py:981
↓ 11 callersFunctionlog_table_to_comet_experiment
If Comet integration is enabled logs a table to the Comet experiment if it is currently running. Args: name (`str`): Tab
trl/trl/trainer/utils.py:1316
↓ 11 callersMethodsave_pretrained
r""" Save the pretrained model to a directory. This method is a wrapper around `transformers.PreTrainedModel.save_pretrained`. Please
trl/trl/models/modeling_base.py:521
↓ 11 callersMethodtokenizer
Returns the tokenizer used for tokenizing text inputs
trl/trl/models/modeling_sd_base.py:100
↓ 10 callersFunctionget_reward
Computes the reward logits and the rewards for a given model and query responses. Args: model (`torch.nn.Module`): The m
trl/trl/trainer/utils.py:899
↓ 9 callersFunctionis_vllm_available
()
trl/trl/import_utils.py:83
↓ 9 callersMethodjudge
(self, prompts: list[str], completions: list[str], shuffle_order: bool = True)
trl/trl/trainer/judges.py:70
↓ 9 callersMethodstep
Perform a single step of training. Args: epoch (int): The current epoch. global_step (int): The current glob
trl/trl/trainer/ddpo_trainer.py:225
↓ 8 callersMethod__init__
(self, in_features, hidden_features, out_features)
tok/ar_dtok/ar_model.py:95
↓ 8 callersMethod__init__
( self, model='VQ-16', ckpt='', codebook_size=16384, codebook_embed_di
tok/ar_dtok/vqvae.py:14
↓ 8 callersMethodsample
( self, c, cfg_scale=2.0, cfg_interval=-1, temperature=1.0, t
tok/ar_dtok/ar_model.py:464
↓ 7 callersMethoddevice
(self)
tok/ar_dtok/ar_model.py:357
↓ 7 callersMethodget_model
(self)
blip3o/model/blip3o_arch.py:163
↓ 7 callersFunctionis_diffusers_available
()
trl/trl/import_utils.py:47
↓ 7 callersFunctionis_liger_kernel_available
(min_version: str = LIGER_KERNEL_MIN_VERSION)
trl/trl/import_utils.py:55
↓ 7 callersFunctionmasked_mean
Compute mean of tensor with a masked values.
trl/trl/core.py:43
↓ 7 callersFunctionpeft_module_casting_to_bf16
(model)
trl/trl/trainer/utils.py:582
↓ 7 callersMethodto_dict
(self)
trl/trl/trainer/ddpo_config.py:288
↓ 6 callersFunctioncreate_reference_model
Creates a static reference copy of a model. Note that model will be in `.eval()` mode. Args: model (`PreTrainedModelWrapper`): The m
trl/trl/models/modeling_base.py:592
↓ 6 callersFunctionflush_left
Shift non-zero elements in the mask and corresponding tensors to the left. This function operates on a binary mask and any number of additio
trl/trl/trainer/utils.py:1334
↓ 6 callersMethodstate_dict
r""" Return the state_dict of the pretrained model.
trl/trl/models/modeling_base.py:548
↓ 5 callersFunctionNormalize
(in_channels, norm_type='group')
tok/ar_dtok/vqvae.py:392
↓ 5 callersFunctionexact_div
(a, b, custom_error_message="")
trl/trl/trainer/utils.py:533
↓ 5 callersFunctionfirst_true_indices
Takes an N-dimensional bool tensor and returns an (N-1)-dimensional tensor of integers giving the position of the first True in each "row".
trl/trl/trainer/utils.py:876
↓ 5 callersFunctionforward
Performs a forward pass through the model with the given query responses and pad token ID. Args: model (`torch.nn.Module`):
trl/trl/trainer/utils.py:949
↓ 5 callersMethodgenerate_completions
(self, sampling: bool = False)
trl/trl/trainer/ppo_trainer.py:687
↓ 5 callersMethodget_rank
(prompt, candidates)
trl/trl/trainer/judges.py:323
↓ 5 callersMethodget_vision_tower
(self)
blip3o/model/blip3o_arch.py:62
↓ 5 callersMethodload_model
(self, device_map=None)
blip3o/model/multimodal_encoder/ta_tok_encoder.py:36
↓ 5 callersMethodnull_ref_context
Context manager for handling null reference model (that is, peft adapter manipulation).
trl/trl/trainer/dpo_trainer.py:890
↓ 5 callersMethodon_save
(self, args, state, control, model=None, **kwargs)
trl/trl/trainer/callbacks.py:566
↓ 5 callersFunctionprofiling_context
A context manager function for profiling a block of code. Results are logged to Weights & Biases or MLflow depending on the trainer's configu
trl/trl/extras/profiling.py:32
↓ 5 callersFunctiontruncate_right
Truncates the input tensor from the right side after the first occurrence of the stop token. Args: input_ids (`torch.Tensor`):
trl/trl/trainer/utils.py:1164
↓ 5 callersMethodupdate_named_param
Updates a specific named parameter in the model and broadcasts it to other processes. Args: name (`str`):
trl/trl/extras/vllm_client.py:296
↓ 4 callersMethod__init__
( self, in_channels: int, out_channels: int, expand_ratio: float = 4,
sana_transformer.py:39
↓ 4 callersMethod_get_per_token_logps_and_entropies
Compute log-probs and (optionally) entropies for each token.
trl/trl/trainer/grpo_trainer.py:1104
↓ 4 callersFunction_win_rate_completions_df
( state: TrainerState, prompts: list[str], completions: list[str], winner_indices: list[str] )
trl/trl/trainer/callbacks.py:214
↓ 4 callersFunctionbatch_generation
( model: torch.nn.Module, queries: torch.Tensor, local_rollout_forward_batch_size: int, pad_to
trl/trl/trainer/utils.py:1098
↓ 4 callersMethodcopy
(self)
blip3o/conversation.py:218
↓ 4 callersMethodcreate
(self)
trl/trl/mergekit_utils.py:251
↓ 4 callersMethoddecode_from_bottleneck
(self, z)
tok/ar_dtok/vqvae.py:44
↓ 4 callersMethodencode
(self, x)
tok/ar_dtok/vqvae.py:81
↓ 4 callersMethodevaluate
(self, *args, **kwargs)
trl/trl/trainer/reward_trainer.py:330
↓ 4 callersMethodfrom_checkpoint
(cls, ckpt, **kwargs)
tok/ar_dtok/vqvae.py:40
↓ 4 callersMethodget_batch_logps
Compute the log probabilities of the given labels under the given logits. Args: logits: Logits of the model (unno
trl/trl/trainer/kto_trainer.py:1002
↓ 4 callersFunctionget_length_grouped_indices_auto_single
(lengths, batch_size, world_size, generator=None)
blip3o/train/blip3o_trainer.py:153
↓ 4 callersFunctionis_mergekit_available
()
trl/trl/import_utils.py:63
↓ 4 callersFunctionmaybe_apply_chat_template
r""" If the example is in a conversational format, apply a chat template to it. Args: example (`dict[str, list[dict[str, str]]`):
trl/trl/data_utils.py:168
↓ 4 callersFunctionnonlinearity
(x)
tok/ar_dtok/vqvae.py:388
↓ 4 callersMethodpost_init
r""" Post initialization method. This method is called after the model is instantiated and loaded from a checkpoint. It can be used to
trl/trl/models/modeling_base.py:554
↓ 4 callersMethodprepare_inputs_labels_for_multimodal
(self, input_ids, position_ids, attention_mask, past_key_values, labels, images, modalities=None, image_sizes=
blip3o/model/blip3o_arch.py:181
↓ 4 callersFunctionsetup_chat_format
Setup chat format by adding special tokens to the tokenizer, setting the correct format, and extending the embedding layer of the model based
trl/trl/models/utils.py:76
↓ 4 callersMethodtext_encoder
Returns the text encoder used for encoding text inputs
trl/trl/models/modeling_sd_base.py:114
↓ 4 callersFunctiontruncate_response
Truncates the responses at the first occurrence of the stop token, filling the rest with pad tokens. Args: stop_token_id (`int`):
trl/trl/trainer/utils.py:1035
↓ 4 callersMethodunet
Returns the 2d U-Net model used for diffusion.
trl/trl/models/modeling_sd_base.py:86
↓ 4 callersMethodupdate
(self, input_pos, k_val, v_val)
tok/ar_dtok/ar_model.py:179
↓ 3 callersMethod_compute_kl_logps
Compute KL log probabilities for a given batch.
trl/trl/trainer/kto_trainer.py:1175
↓ 3 callersMethod_fix_param_name_to_vllm
(self, name, extra_prefixes: Optional[list[str]] = None)
trl/trl/trainer/grpo_trainer.py:1167
↓ 3 callersMethod_forward
(self, model, prompt_ids, prompt_mask, completion_ids, completion_mask)
trl/trl/trainer/online_dpo_trainer.py:528
↓ 3 callersFunction_generate_completions
Generates completions for a list of pre-formatted prompts from the given model. Args: prompts (list[str]): A list of input prompts f
trl/trl/trainer/callbacks.py:54
↓ 3 callersMethod_get_current_device
r""" Get the current device. For GPU & XPU, we return the local process index using the `accelerate.PartialState` object to handle cor
trl/trl/models/modeling_base.py:389
↓ 3 callersFunction_left_broadcast
As opposed to the default direction of broadcasting (right to left), this function broadcasts from left to right Args: input
trl/trl/models/modeling_sd_base.py:158
↓ 3 callersMethod_prepare_dataset
( self, dataset: Union[Dataset, IterableDataset], processing_class: Union[PreTrainedTo
trl/trl/trainer/dpo_trainer.py:614
↓ 3 callersMethod_prepare_dataset
( self, dataset: Union[Dataset, IterableDataset], processing_class: Union[PreTrainedTo
trl/trl/trainer/sft_trainer.py:660
↓ 3 callersMethod_split_kwargs
Separate the kwargs from the arguments that we support inside `supported_args` and the ones that we don't.
trl/trl/models/modeling_base.py:407
↓ 3 callersMethodappend_segment
Append a new segment to the history. Args: text (`str`): The text of the new segment. tokens (`torch.LongTen
trl/trl/environment/base_environment.py:88
↓ 3 callersMethodautocast
Returns the autocast context manager
trl/trl/models/modeling_sd_base.py:121
↓ 3 callersMethodcompute_ref_log_probs
Computes log probabilities of the reference model for a single padded batch of a DPO specific dataset.
trl/trl/trainer/dpo_trainer.py:903
↓ 3 callersMethodconcatenated_forward
Runs the given model on the given batch of inputs, concatenating the chosen and rejected inputs together. We do this to avoid doing
trl/trl/trainer/dpo_trainer.py:1424
↓ 3 callersMethoddecode
(self, z)
tok/ta_tok.py:138
↓ 3 callersMethodforward
( self, model: nn.Module, batch: dict[str, Union[list, torch.LongTensor]] )
trl/trl/trainer/kto_trainer.py:1047
↓ 3 callersMethodforward
( self, model: nn.Module, batch: dict[str, Union[list, torch.LongTensor]] )
trl/trl/trainer/bco_trainer.py:1055
↓ 3 callersMethodgenerate_images
( self, input_ids: Optional[torch.Tensor] = None, attention_mask: Optional[torch.Tenso
blip3o/model/language_model/blip3o_qwen_grpo.py:146
↓ 3 callersMethodget_emb
(self)
tok/ar_dtok/bottleneck.py:110
↓ 3 callersFunctionget_length_grouped_indices
Return a list of indices so that each slice of `batch_size` consecutive indices correspond to elements of similar lengths. To do this, the in
blip3o/train/blip3o_trainer.py:130
↓ 3 callersFunctionis_llm_blender_available
()
trl/trl/import_utils.py:59
next →1–100 of 947, ranked by callers