MCPcopy Create free account

hub / github.com/alibaba-damo-academy/DyDiT / functions

Functions281 in github.com/alibaba-damo-academy/DyDiT

↓ 41 callersFunctionprint
(*args, **kwargs)
DyDiT/misc.py:177
↓ 23 callersFunction_extract_into_tensor
Extract values from a 1-D numpy array for a batch of indices. :param arr: the 1-D numpy array. :param timesteps: a tensor of indices into
DyDiT/diffusion/gaussian_diffusion.py:974
↓ 14 callersMethodload_state_dict
(self, state_dict)
DyDiT/misc.py:269
↓ 13 callersMethodstate_dict
(self)
DyDiT/misc.py:266
↓ 12 callersMethodforward_inference
(self, hidden_states, channel_mask=None)
DyFLUX/flux_models/dy_utils.py:155
↓ 8 callersMethod__init__
( self, in_features, hidden_features=None, out_features=None,
DyDiT/models.py:148
↓ 8 callersMethodload
(cls, path: str, arr_name: str)
DyDiT/evaluator.py:511
↓ 8 callersFunctionmean_flat
Take the mean over all non-batch dimensions.
DyDiT/diffusion/gaussian_diffusion.py:16
↓ 7 callersMethodmax
(self)
DyDiT/misc.py:70
↓ 6 callersMethod_vb_terms_bpd
Get a term for the variational lower-bound. The resulting units are bits (rather than nats, as one might expect). This allows
DyDiT/diffusion/gaussian_diffusion.py:682
↓ 5 callersMethod_wrap_model
(self, model)
DyDiT/diffusion/respace.py:110
↓ 5 callersMethodq_posterior_mean_variance
Compute the mean and variance of the diffusion posterior: q(x_{t-1} | x_t, x_0)
DyDiT/diffusion/gaussian_diffusion.py:232
↓ 4 callersMethod__init__
(self, dim_in: int, dim_out: int, approximate: str = "none", bias: bool = True, dyna_dim=[False, False])
DyFLUX/flux_models/dy_utils.py:135
↓ 4 callersFunctioncreate_diffusion
( timestep_respacing, noise_schedule="linear", use_kl=False, sigma_small=False, predict_x
DyDiT/diffusion/__init__.py:10
↓ 4 callersFunctionmodulate
(x, shift, scale)
DyDiT/models.py:194
↓ 4 callersMethodp_mean_variance
Apply the model to get p(x_{t-1} | x_t), as well as a prediction of the initial x, x_0. :param model: the model, which takes
DyDiT/diffusion/gaussian_diffusion.py:254
↓ 4 callersFunctionround_to_nearest
(input_size, width_mult, num_heads, min_value=1)
DyDiT/models.py:24
↓ 4 callersMethodset_processor
r""" Set the attention processor to use. Args: processor (`AttnProcessor`): The attention processor to us
DyFLUX/flux_models/attention_processor_dyn.py:431
↓ 3 callersMethod__init__
(self, dim: int, theta: int, axes_dim: List[int])
DyFLUX/flux_models/transformer_flux_dyn.py:61
↓ 3 callersMethod_predict_eps_from_xstart
(self, x_t, t, pred_xstart)
DyDiT/diffusion/gaussian_diffusion.py:341
↓ 3 callersMethodbackward
(ctx, g)
DyDiT/dynamic_model.py:95
↓ 3 callersMethodhead_to_batch_dim
r""" Reshape the tensor from `[batch_size, seq_len, dim]` to `[batch_size, seq_len, heads, dim // heads]` `heads` is the number of hea
DyFLUX/flux_models/attention_processor_dyn.py:531
↓ 3 callersFunctionis_dist_avail_and_initialized
()
DyDiT/misc.py:188
↓ 3 callersMethodq_sample
Diffuse the data for a given number of diffusion steps. In other words, sample from q(x_t | x_0). :param x_start: the initial
DyDiT/diffusion/gaussian_diffusion.py:215
↓ 2 callersFunction_batch_pairwise_distances
Compute pairwise distances between two batches of feature vectors.
DyDiT/evaluator.py:426
↓ 2 callersFunction_download_inception_model
()
DyDiT/evaluator.py:585
↓ 2 callersFunction_gumbel_sigmoid
( logits, tau=1, hard=False, eps=1e-10, training = True, threshold = 0.5 )
DyDiT/dynamic_model.py:18
↓ 2 callersMethod_predict_xstart_from_eps
(self, x_t, t, eps)
DyDiT/diffusion/gaussian_diffusion.py:334
↓ 2 callersMethod_prepare_latent_image_ids
(batch_size, height, width, device, dtype)
DyFLUX/flux_models/pipeline_flux_dyn.py:421
↓ 2 callersFunction_warmup_beta
(beta_start, beta_end, num_diffusion_timesteps, warmup_frac)
DyDiT/diffusion/gaussian_diffusion.py:58
↓ 2 callersFunctionapply_rope
(xq, xk, freqs_cis)
DyFLUX/flux_models/attention_processor_dyn.py:804
↓ 2 callersFunctionapprox_standard_normal_cdf
A fast approximation of the cumulative distribution function of the standard normal.
DyDiT/diffusion/diffusion_utils.py:39
↓ 2 callersFunctionbuild_image_dataset
(args)
DyDiT/datasets/image_datasets.py:30
↓ 2 callersFunctionclean_caption
(caption)
DyDiT/utils.py:343
↓ 2 callersFunctionclip_grad_norm_
r""" Copy from torch.nn.utils.clip_grad_norm_ Clips gradient norm of an iterable of parameters. The norm is computed over all gradients
DyDiT/utils.py:73
↓ 2 callersMethodcompute_activations
Compute image features for downstream evals. :param batches: a iterator over NHWC numpy arrays in [0, 255]. :return: a tuple
DyDiT/evaluator.py:154
↓ 2 callersMethodcondition_score
Compute what the p_mean_variance output would have been, should the model's score function be conditioned by cond_fn. See con
DyDiT/diffusion/gaussian_diffusion.py:358
↓ 2 callersFunctioncreate_logger
(output_dir, dist_rank=0, name='')
DyDiT/util/logger.py:9
↓ 2 callersMethodevaluate_pr
Evaluate precision and recall efficiently. :param features_1: [N1 x D] feature vectors for reference batch. :param radii_1:
DyDiT/evaluator.py:337
↓ 2 callersFunctionfind_model
Finds a pre-trained Latte model, downloading it if necessary. Alternatively, loads a model from a local path.
DyDiT/utils.py:278
↓ 2 callersMethodforward
(self, hidden_states, channel_mask=None)
DyFLUX/flux_models/dy_utils.py:143
↓ 2 callersMethodfrechet_distance
Compute the Frechet distance between two sets of statistics.
DyDiT/evaluator.py:84
↓ 2 callersFunctionget_1d_sincos_pos_embed_from_grid
embed_dim: output dimension for each position pos: a list of positions to be encoded: size (M,) out: (M, D)
DyDiT/models.py:525
↓ 2 callersFunctionget_rank
()
DyDiT/misc.py:202
↓ 2 callersFunctionget_world_size
()
DyDiT/misc.py:196
↓ 2 callersMethodmanifold_radii
(self, features: np.ndarray)
DyDiT/evaluator.py:260
↓ 2 callersFunctionnormal_kl
Compute the KL divergence between two gaussians. Shapes are automatically broadcasted, so batches can be compared to scalars, among other
DyDiT/diffusion/diffusion_utils.py:10
↓ 2 callersMethodp_sample_loop
Generate samples from the model. :param model: the model module. :param shape: the shape of the samples, (N, C, H, W).
DyDiT/diffusion/gaussian_diffusion.py:419
↓ 2 callersMethodpairwise_distances
Evaluate pairwise distances between two batches of feature vectors.
DyDiT/evaluator.py:405
↓ 2 callersMethodread_activations
(self, npz_path: str)
DyDiT/evaluator.py:150
↓ 2 callersMethodread_statistics
( self, npz_path: str, activations: Tuple[np.ndarray, np.ndarray] )
DyDiT/evaluator.py:176
↓ 2 callersMethodsample
Importance-sample timesteps for a batch. :param batch_size: the number of timesteps. :param device: the torch device to save
DyDiT/diffusion/timestep_sampler.py:44
↓ 2 callersFunctionsetup_for_distributed
This function disables printing when not in master process
DyDiT/misc.py:171
↓ 2 callersMethodupdate
(self, value, n=1)
DyDiT/misc.py:37
↓ 2 callersMethodupdate
(self, **kwargs)
DyDiT/misc.py:92
↓ 2 callersFunctionupdate_ema
Step the EMA model towards the current model.
DyDiT/train.py:44
↓ 2 callersFunctionupdate_ema
Step the EMA model towards the current model.
DyDiT/train_without_completemodel.py:46
↓ 1 callersMethod__init__
(self, dim=768, channel_number=196, tau=5, is_hard=True, threshold=0.5)
DyDiT/dynamic_model.py:113
↓ 1 callersMethod__init__
(self, model, timestep_map, original_num_steps)
DyDiT/diffusion/respace.py:123
↓ 1 callersFunction_create_feature_graph
(input_batch)
DyDiT/evaluator.py:598
↓ 1 callersFunction_create_softmax_graph
(input_batch)
DyDiT/evaluator.py:615
↓ 1 callersMethod_get_clip_prompt_embeds
( self, prompt: Union[str, List[str]], num_images_per_prompt: int = 1, device:
DyFLUX/flux_models/pipeline_flux_dyn.py:247
↓ 1 callersMethod_get_t5_prompt_embeds
( self, prompt: Union[str, List[str]] = None, num_images_per_prompt: int = 1,
DyFLUX/flux_models/pipeline_flux_dyn.py:201
↓ 1 callersMethod_get_token_loss
(self, attn_channel_mask, mlp_channel_mask, token_select)
DyDiT/loss.py:63
↓ 1 callersFunction_gumbel_sigmoid
(logits, tau=1, hard=False, eps=1e-10, training=True, threshold=0.5)
DyFLUX/flux_models/dy_utils.py:9
↓ 1 callersFunction_numpy_partition
(arr, kth, **kwargs)
DyDiT/evaluator.py:648
↓ 1 callersFunction_open_npy_file
(path: str, arr_name: str)
DyDiT/evaluator.py:576
↓ 1 callersMethod_pack_latents
(latents, batch_size, num_channels_latents, height, width)
DyFLUX/flux_models/pipeline_flux_dyn.py:436
↓ 1 callersMethod_prior_bpd
Get the prior KL term for the variational lower-bound, measured in bits-per-dim. This term can't be optimized, as it only dep
DyDiT/diffusion/gaussian_diffusion.py:902
↓ 1 callersFunction_read_bytes
Copied from: https://github.com/numpy/numpy/blob/fb215c76967739268de71aa4bda55dd1b062bc2e/numpy/lib/format.py#L788-L886 Read from file-like
DyDiT/evaluator.py:546
↓ 1 callersMethod_unpack_latents
(latents, height, width, vae_scale_factor)
DyFLUX/flux_models/pipeline_flux_dyn.py:444
↓ 1 callersFunction_update_shapes
(pool3)
DyDiT/evaluator.py:629
↓ 1 callersMethod_warmed_up
(self)
DyDiT/diffusion/timestep_sampler.py:149
↓ 1 callersFunctionappend_line_to_file
在指定路径的文件中追加一行文本。 :param file_path: 文件的完整路径 :param line_to_append: 要追加的文本行
DyFLUX/utils.py:17
↓ 1 callersMethodbatch_to_head_dim
r""" Reshape the tensor from `[batch_size, seq_len, dim]` to `[batch_size // heads, seq_len, dim * heads]`. `heads` is the number of h
DyFLUX/flux_models/attention_processor_dyn.py:514
↓ 1 callersFunctionbetas_for_alpha_bar
Create a beta schedule that discretizes the given alpha_t_bar function, which defines the cumulative product of (1-beta) over time from t = [
DyDiT/diffusion/gaussian_diffusion.py:125
↓ 1 callersFunctioncalculate_shift
( image_seq_len, base_seq_len: int = 256, max_seq_len: int = 4096, base_shift: float = 0.5,
DyFLUX/flux_models/pipeline_flux_dyn.py:67
↓ 1 callersFunctioncenter_crop_arr
Center cropping implementation from ADM. https://github.com/openai/guided-diffusion/blob/8fb3ad9197f16bbc40620447b2742e13458d2831/guided_diff
DyDiT/datasets/image_datasets.py:10
↓ 1 callersMethodcheck_inputs
( self, prompt, prompt_2, height, width, prompt_embeds=None,
DyFLUX/flux_models/pipeline_flux_dyn.py:372
↓ 1 callersFunctioncleanup
End DDP training.
DyDiT/train.py:64
↓ 1 callersFunctioncleanup
End DDP training.
DyDiT/train_without_completemodel.py:66
↓ 1 callersFunctioncombine_images_horizontally
将给定路径中的图片横向拼接
DyFLUX/utils.py:39
↓ 1 callersMethodcompute_inception_score
(self, activations: np.ndarray, split_size: int = 5000)
DyDiT/evaluator.py:191
↓ 1 callersMethodcompute_prec_recall
( self, activations_ref: np.ndarray, activations_sample: np.ndarray )
DyDiT/evaluator.py:206
↓ 1 callersMethodcompute_statistics
(self, activations: np.ndarray)
DyDiT/evaluator.py:186
↓ 1 callersMethodcondition_mean
Compute the mean for the previous step, given a function cond_fn that computes the gradient of a conditional log probability with res
DyDiT/diffusion/gaussian_diffusion.py:346
↓ 1 callersFunctioncreate_npz_from_sample_folder
Builds a single .npz file from a folder of .png samples.
DyDiT/sample_ddp.py:28
↓ 1 callersMethodddim_sample
Sample x_{t-1} from the model using DDIM. Same usage as p_sample().
DyDiT/diffusion/gaussian_diffusion.py:513
↓ 1 callersMethodddim_sample_loop_progressive
Use DDIM to sample from the model and yield intermediate samples from each timestep of DDIM. Same usage as p_sample_loop_prog
DyDiT/diffusion/gaussian_diffusion.py:633
↓ 1 callersFunctiondiscretized_gaussian_log_likelihood
Compute the log-likelihood of a Gaussian distribution discretizing to a given image. :param x: the target images. It is assumed that this
DyDiT/diffusion/diffusion_utils.py:62
↓ 1 callersMethodencode_prompt
r""" Args: prompt (`str` or `List[str]`, *optional*): prompt to be encoded prompt_2 (`str` or `List[s
DyFLUX/flux_models/pipeline_flux_dyn.py:288
↓ 1 callersMethodforward
Forward pass of DiT. x: (N, C, H, W) tensor of spatial inputs (images or latent representations of images) t: (N,) tensor of
DyDiT/models.py:438
↓ 1 callersMethodforward
(self, input_x, channel_mask=None)
DyFLUX/flux_models/dy_utils.py:89
↓ 1 callersMethodgen_fn
()
DyDiT/evaluator.py:455
↓ 1 callersFunctionget_2d_sincos_pos_embed
grid_size: int of the grid height and width return: pos_embed: [grid_size*grid_size, embed_dim] or [1+grid_size*grid_size, embed_dim] (w/
DyDiT/models.py:496
↓ 1 callersFunctionget_2d_sincos_pos_embed_from_grid
(embed_dim, grid)
DyDiT/models.py:514
↓ 1 callersMethodget_attention_scores
r""" Compute the attention scores. Args: query (`torch.Tensor`): The query tensor. key (`torch.Tensor`): The
DyFLUX/flux_models/attention_processor_dyn.py:558
↓ 1 callersFunctionget_beta_schedule
This is the deprecated API for creating beta schedules. See get_named_beta_schedule() for the new library of schedules.
DyDiT/diffusion/gaussian_diffusion.py:65
↓ 1 callersFunctionget_grad_norm_
(parameters, norm_type: float = 2.0)
DyDiT/misc.py:273
↓ 1 callersMethodinit_routers
(self)
DyFLUX/flux_models/transformer_flux_dyn.py:420
next →1–100 of 281, ranked by callers