Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/chuanyangjin/fast-DiT
/ functions
Functions
171 in github.com/chuanyangjin/fast-DiT
⨍
Functions
171
◇
Types & classes
22
↓ 23 callers
Function
_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
diffusion/gaussian_diffusion.py:861
↓ 8 callers
Function
create_diffusion
( timestep_respacing, noise_schedule="linear", use_kl=False, sigma_small=False, predict_x
diffusion/__init__.py:10
↓ 6 callers
Function
mean_flat
Take the mean over all non-batch dimensions.
diffusion/gaussian_diffusion.py:16
↓ 6 callers
Method
training_losses
( self, model, *args, **kwargs )
diffusion/respace.py:94
↓ 5 callers
Method
sample
Importance-sample timesteps for a batch. :param batch_size: the number of timesteps. :param device: the torch device to save
diffusion/timestep_sampler.py:44
↓ 4 callers
Method
__init__
( self, input_size=32, patch_size=2, in_channels=4, hidden_size=1152,
models.py:149
↓ 4 callers
Method
__init__
( self, input_size=32, patch_size=2, in_channels=4, hidden_size=1152,
train_options/models_original.py:149
↓ 4 callers
Method
_wrap_model
(self, model)
diffusion/respace.py:105
↓ 4 callers
Method
p_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
diffusion/gaussian_diffusion.py:254
↓ 4 callers
Method
q_posterior_mean_variance
Compute the mean and variance of the diffusion posterior: q(x_{t-1} | x_t, x_0)
diffusion/gaussian_diffusion.py:232
↓ 3 callers
Method
_predict_eps_from_xstart
(self, x_t, t, pred_xstart)
diffusion/gaussian_diffusion.py:341
↓ 3 callers
Method
_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
diffusion/gaussian_diffusion.py:682
↓ 3 callers
Function
modulate
(x, shift, scale)
models.py:19
↓ 3 callers
Function
modulate
(x, shift, scale)
train_options/models_original.py:19
↓ 2 callers
Method
_predict_xstart_from_eps
(self, x_t, t, eps)
diffusion/gaussian_diffusion.py:334
↓ 2 callers
Function
_warmup_beta
(beta_start, beta_end, num_diffusion_timesteps, warmup_frac)
diffusion/gaussian_diffusion.py:58
↓ 2 callers
Function
approx_standard_normal_cdf
A fast approximation of the cumulative distribution function of the standard normal.
diffusion/diffusion_utils.py:39
↓ 2 callers
Method
condition_score
Compute what the p_mean_variance output would have been, should the model's score function be conditioned by cond_fn. See con
diffusion/gaussian_diffusion.py:358
↓ 2 callers
Function
create_logger
Create a logger that writes to a log file and stdout.
train_options/train_baseline.py:67
↓ 2 callers
Function
create_logger
Create a logger that writes to a log file and stdout.
train_options/train_tf32_disabled.py:67
↓ 2 callers
Function
create_logger
Create a logger that writes to a log file and stdout.
train_options/train_original.py:67
↓ 2 callers
Function
create_logger
Create a logger that writes to a log file and stdout.
train_options/train_features.py:67
↓ 2 callers
Function
download_model
Downloads a pre-trained DiT model from the web.
download.py:32
↓ 2 callers
Function
find_model
Finds a pre-trained DiT model, downloading it if necessary. Alternatively, loads a model from a local path.
download.py:18
↓ 2 callers
Function
get_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)
models.py:309
↓ 2 callers
Function
get_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)
train_options/models_original.py:303
↓ 2 callers
Function
normal_kl
Compute the KL divergence between two gaussians. Shapes are automatically broadcasted, so batches can be compared to scalars, among other
diffusion/diffusion_utils.py:10
↓ 2 callers
Method
p_sample_loop
Generate samples from the model. :param model: the model module. :param shape: the shape of the samples, (N, C, H, W).
diffusion/gaussian_diffusion.py:419
↓ 2 callers
Method
q_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
diffusion/gaussian_diffusion.py:215
↓ 2 callers
Function
update_ema
Step the EMA model towards the current model.
train.py:41
↓ 2 callers
Function
update_ema
Step the EMA model towards the current model.
train_options/train_baseline.py:40
↓ 2 callers
Function
update_ema
Step the EMA model towards the current model.
train_options/train_tf32_disabled.py:40
↓ 2 callers
Function
update_ema
Step the EMA model towards the current model.
train_options/train_original.py:40
↓ 2 callers
Function
update_ema
Step the EMA model towards the current model.
train_options/train_amp.py:41
↓ 2 callers
Function
update_ema
Step the EMA model towards the current model.
train_options/train_features.py:40
↓ 1 callers
Method
__init__
(self, model, timestep_map, original_num_steps)
diffusion/respace.py:118
↓ 1 callers
Method
_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
diffusion/gaussian_diffusion.py:789
↓ 1 callers
Method
_warmed_up
(self)
diffusion/timestep_sampler.py:149
↓ 1 callers
Function
betas_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 = [
diffusion/gaussian_diffusion.py:125
↓ 1 callers
Function
center_crop_arr
Center cropping implementation from ADM. https://github.com/openai/guided-diffusion/blob/8fb3ad9197f16bbc40620447b2742e13458d2831/guided_diff
extract_features.py:86
↓ 1 callers
Function
center_crop_arr
Center cropping implementation from ADM. https://github.com/openai/guided-diffusion/blob/8fb3ad9197f16bbc40620447b2742e13458d2831/guided_diff
train_options/train_baseline.py:85
↓ 1 callers
Function
center_crop_arr
Center cropping implementation from ADM. https://github.com/openai/guided-diffusion/blob/8fb3ad9197f16bbc40620447b2742e13458d2831/guided_diff
train_options/train_tf32_disabled.py:85
↓ 1 callers
Function
center_crop_arr
Center cropping implementation from ADM. https://github.com/openai/guided-diffusion/blob/8fb3ad9197f16bbc40620447b2742e13458d2831/guided_diff
train_options/train_original.py:85
↓ 1 callers
Function
center_crop_arr
Center cropping implementation from ADM. https://github.com/openai/guided-diffusion/blob/8fb3ad9197f16bbc40620447b2742e13458d2831/guided_diff
train_options/train_amp.py:76
↓ 1 callers
Method
ckpt_wrapper
(self, module)
models.py:233
↓ 1 callers
Function
cleanup
End DDP training.
extract_features.py:61
↓ 1 callers
Function
cleanup
End DDP training.
train_options/train_baseline.py:60
↓ 1 callers
Function
cleanup
End DDP training.
train_options/train_tf32_disabled.py:60
↓ 1 callers
Function
cleanup
End DDP training.
train_options/train_original.py:60
↓ 1 callers
Function
cleanup
End DDP training.
train_options/train_features.py:60
↓ 1 callers
Method
condition_mean
Compute the mean for the previous step, given a function cond_fn that computes the gradient of a conditional log probability with res
diffusion/gaussian_diffusion.py:346
↓ 1 callers
Function
create_logger
Create a logger that writes to a log file and stdout.
train.py:62
↓ 1 callers
Function
create_logger
Create a logger that writes to a log file and stdout.
train_options/train_amp.py:62
↓ 1 callers
Function
create_npz_from_sample_folder
Builds a single .npz file from a folder of .png samples.
sample_ddp.py:28
↓ 1 callers
Method
ddim_sample
Sample x_{t-1} from the model using DDIM. Same usage as p_sample().
diffusion/gaussian_diffusion.py:513
↓ 1 callers
Method
ddim_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
diffusion/gaussian_diffusion.py:633
↓ 1 callers
Function
discretized_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
diffusion/diffusion_utils.py:62
↓ 1 callers
Method
forward
Forward pass of DiT. x: (N, C, H, W) tensor of spatial inputs (images or latent representations of images) t: (N,) tensor of
models.py:239
↓ 1 callers
Method
forward
Forward pass of DiT. x: (N, C, H, W) tensor of spatial inputs (images or latent representations of images) t: (N,) tensor of
train_options/models_original.py:233
↓ 1 callers
Function
get_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/
models.py:280
↓ 1 callers
Function
get_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/
train_options/models_original.py:274
↓ 1 callers
Function
get_2d_sincos_pos_embed_from_grid
(embed_dim, grid)
models.py:298
↓ 1 callers
Function
get_2d_sincos_pos_embed_from_grid
(embed_dim, grid)
train_options/models_original.py:292
↓ 1 callers
Function
get_beta_schedule
This is the deprecated API for creating beta schedules. See get_named_beta_schedule() for the new library of schedules.
diffusion/gaussian_diffusion.py:65
↓ 1 callers
Method
initialize_weights
(self)
models.py:182
↓ 1 callers
Method
initialize_weights
(self)
train_options/models_original.py:182
↓ 1 callers
Function
main
Trains a new DiT model.
train.py:123
↓ 1 callers
Function
main
(args)
sample.py:21
↓ 1 callers
Function
main
Trains a new DiT model.
extract_features.py:111
↓ 1 callers
Function
main
Run sampling.
sample_ddp.py:45
↓ 1 callers
Function
main
Trains a new DiT model.
train_options/train_baseline.py:110
↓ 1 callers
Function
main
Trains a new DiT model.
train_options/train_tf32_disabled.py:110
↓ 1 callers
Function
main
Trains a new DiT model.
train_options/train_original.py:110
↓ 1 callers
Function
main
Trains a new DiT model.
train_options/train_amp.py:101
↓ 1 callers
Function
main
Trains a new DiT model.
train_options/train_features.py:133
↓ 1 callers
Method
p_sample
Sample x_{t-1} from the model at the given timestep. :param model: the model to sample from. :param x: the current tensor at
diffusion/gaussian_diffusion.py:376
↓ 1 callers
Method
p_sample_loop_progressive
Generate samples from the model and yield intermediate samples from each timestep of diffusion. Arguments are the same as p_s
diffusion/gaussian_diffusion.py:464
↓ 1 callers
Method
q_mean_variance
Get the distribution q(x_t | x_0). :param x_start: the [N x C x ...] tensor of noiseless inputs. :param t: the number of diff
diffusion/gaussian_diffusion.py:203
↓ 1 callers
Function
requires_grad
Set requires_grad flag for all parameters in a model.
train.py:54
↓ 1 callers
Function
requires_grad
Set requires_grad flag for all parameters in a model.
train_options/train_baseline.py:52
↓ 1 callers
Function
requires_grad
Set requires_grad flag for all parameters in a model.
train_options/train_tf32_disabled.py:52
↓ 1 callers
Function
requires_grad
Set requires_grad flag for all parameters in a model.
train_options/train_original.py:52
↓ 1 callers
Function
requires_grad
Set requires_grad flag for all parameters in a model.
train_options/train_amp.py:54
↓ 1 callers
Function
requires_grad
Set requires_grad flag for all parameters in a model.
train_options/train_features.py:52
↓ 1 callers
Function
space_timesteps
Create a list of timesteps to use from an original diffusion process, given the number of timesteps we want to take from equally-sized portio
diffusion/respace.py:12
↓ 1 callers
Method
timestep_embedding
Create sinusoidal timestep embeddings. :param t: a 1-D Tensor of N indices, one per batch element. These ma
models.py:41
↓ 1 callers
Method
timestep_embedding
Create sinusoidal timestep embeddings. :param t: a 1-D Tensor of N indices, one per batch element. These ma
train_options/models_original.py:41
↓ 1 callers
Method
token_drop
Drops labels to enable classifier-free guidance.
models.py:78
↓ 1 callers
Method
token_drop
Drops labels to enable classifier-free guidance.
train_options/models_original.py:78
↓ 1 callers
Method
unpatchify
x: (N, T, patch_size**2 * C) imgs: (N, H, W, C)
models.py:218
↓ 1 callers
Method
unpatchify
x: (N, T, patch_size**2 * C) imgs: (N, H, W, C)
train_options/models_original.py:218
↓ 1 callers
Method
update_with_all_losses
Update the reweighting using losses from a model. Sub-classes should override this method to update the reweighting using los
diffusion/timestep_sampler.py:106
↓ 1 callers
Method
weights
Get a numpy array of weights, one per diffusion step. The weights needn't be normalized, but must be positive.
diffusion/timestep_sampler.py:38
Function
DiT_B_2
(**kwargs)
models.py:352
Function
DiT_B_2
(**kwargs)
train_options/models_original.py:346
Function
DiT_B_4
(**kwargs)
models.py:355
Function
DiT_B_4
(**kwargs)
train_options/models_original.py:349
Function
DiT_B_8
(**kwargs)
models.py:358
Function
DiT_B_8
(**kwargs)
train_options/models_original.py:352
Function
DiT_L_2
(**kwargs)
models.py:343
next →
1–100 of 171, ranked by callers