Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/YuchuanTian/DiC
/ functions
Functions
186 in github.com/YuchuanTian/DiC
⨍
Functions
186
◇
Types & classes
36
↓ 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
↓ 11 callers
Method
load
(cls, path: str, arr_name: str)
evaluator.py:499
↓ 10 callers
Method
__init__
( self, input_size=32, in_channels=4, hidden_size=1152, depth=[2*
dic_models.py:342
↓ 6 callers
Function
mean_flat
Take the mean over all non-batch dimensions.
diffusion/gaussian_diffusion.py:16
↓ 4 callers
Method
__init__
( self, input_size=32, patch_size=2, in_channels=4, hidden_size=1152,
models.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
create_diffusion
( timestep_respacing, noise_schedule="linear", use_kl=False, sigma_small=False, predict_x
diffusion/__init__.py:10
↓ 3 callers
Function
extract_parser
(unparsed, d)
utils/parser_setter.py:32
↓ 3 callers
Function
modulate
(x, shift, scale)
models.py:19
↓ 3 callers
Function
printopt
(opt, level=0)
utils/parser_setter.py:56
↓ 2 callers
Function
_batch_pairwise_distances
Compute pairwise distances between two batches of feature vectors.
evaluator.py:414
↓ 2 callers
Function
_download_inception_model
()
evaluator.py:573
↓ 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
compute_activations
Compute image features for downstream evals. :param batches: a iterator over NHWC numpy arrays in [0, 255]. :return: a tuple
evaluator.py:142
↓ 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.py:66
↓ 2 callers
Function
download_model
Downloads a pre-trained DiT model from the web.
download.py:32
↓ 2 callers
Method
evaluate_pr
Evaluate precision and recall efficiently. :param features_1: [N1 x D] feature vectors for reference batch. :param radii_1:
evaluator.py:325
↓ 2 callers
Method
frechet_distance
Compute the Frechet distance between two sets of statistics.
evaluator.py:72
↓ 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:303
↓ 2 callers
Method
manifold_radii
(self, features: np.ndarray)
evaluator.py:248
↓ 2 callers
Function
norm_cdf
(x)
dic_models.py:52
↓ 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
pairwise_distances
Evaluate pairwise distances between two batches of feature vectors.
evaluator.py:393
↓ 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
Method
read_activations
(self, npz_path: str)
evaluator.py:138
↓ 2 callers
Method
read_statistics
( self, npz_path: str, activations: Tuple[np.ndarray, np.ndarray] )
evaluator.py:164
↓ 2 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
↓ 2 callers
Method
training_losses
( self, model, *args, **kwargs )
diffusion/respace.py:94
↓ 2 callers
Function
update_ema
Step the EMA model towards the current model.
train.py:39
↓ 2 callers
Function
update_ema
Step the EMA model towards the current model.
train_accelerate.py:48
↓ 1 callers
Function
DiC_XL
(**kwargs)
dic_models.py:589
↓ 1 callers
Method
__init__
(self, model, timestep_map, original_num_steps)
diffusion/respace.py:118
↓ 1 callers
Function
_create_feature_graph
(input_batch)
evaluator.py:586
↓ 1 callers
Function
_create_softmax_graph
(input_batch)
evaluator.py:603
↓ 1 callers
Function
_no_grad_trunc_normal_
(tensor, mean, std, a, b)
dic_models.py:48
↓ 1 callers
Function
_numpy_partition
(arr, kth, **kwargs)
evaluator.py:636
↓ 1 callers
Function
_open_npy_file
(path: str, arr_name: str)
evaluator.py:564
↓ 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
Function
_read_bytes
Copied from: https://github.com/numpy/numpy/blob/fb215c76967739268de71aa4bda55dd1b062bc2e/numpy/lib/format.py#L788-L886 Read from file-like
evaluator.py:534
↓ 1 callers
Function
_update_shapes
(pool3)
evaluator.py:617
↓ 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
train.py:84
↓ 1 callers
Function
center_crop_arr
Center cropping implementation from ADM. https://github.com/openai/guided-diffusion/blob/8fb3ad9197f16bbc40620447b2742e13458d2831/guided_diff
train_accelerate.py:83
↓ 1 callers
Function
cleanup
End DDP training.
train.py:59
↓ 1 callers
Method
compute_inception_score
(self, activations: np.ndarray, split_size: int = 5000)
evaluator.py:179
↓ 1 callers
Method
compute_prec_recall
( self, activations_ref: np.ndarray, activations_sample: np.ndarray )
evaluator.py:194
↓ 1 callers
Method
compute_statistics
(self, activations: np.ndarray)
evaluator.py:174
↓ 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_accelerate.py:69
↓ 1 callers
Function
create_npz_from_sample_folder
Builds a single .npz file from a folder of .png samples.
sample_ddp.py:37
↓ 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
Function
find_model
Finds a pre-trained DiT model, downloading it if necessary. Alternatively, loads a model from a local path.
download.py:18
↓ 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:233
↓ 1 callers
Method
forward
(self, x, t, y)
dic_models.py:498
↓ 1 callers
Method
gen_fn
()
evaluator.py:443
↓ 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:274
↓ 1 callers
Function
get_2d_sincos_pos_embed_from_grid
(embed_dim, grid)
models.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)
dic_models.py:433
↓ 1 callers
Function
key_dealer
Insert s without opt_
utils/parser_setter.py:28
↓ 1 callers
Method
less_thans
(self, batch_1, radii_1, batch_2, radii_2)
evaluator.py:402
↓ 1 callers
Function
main
Trains a new DiT model.
train.py:109
↓ 1 callers
Function
main
()
evaluator.py:27
↓ 1 callers
Function
main
Trains a new DiT model.
train_accelerate.py:108
↓ 1 callers
Function
main
Run sampling.
sample_ddp.py:54
↓ 1 callers
Function
modulate
(x, shift, scale)
dic_models.py:111
↓ 1 callers
Function
open_npz_array
(path: str, arr_name: str)
evaluator.py:517
↓ 1 callers
Function
opt_setter
(d, key, value)
utils/parser_setter.py:16
↓ 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
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
↓ 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
Method
read_batch
(self, batch_size: int)
evaluator.py:435
↓ 1 callers
Method
read_batches
(self, batch_size: int)
evaluator.py:442
↓ 1 callers
Method
remaining
(self)
evaluator.py:439
↓ 1 callers
Function
requires_grad
Set requires_grad flag for all parameters in a model.
train.py:51
↓ 1 callers
Function
requires_grad
Set requires_grad flag for all parameters in a model.
train_accelerate.py:61
↓ 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
dic_models.py:132
↓ 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.
dic_models.py:169
↓ 1 callers
Method
unpatchify
x: (N, T, patch_size**2 * C) imgs: (N, H, W, C)
models.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
warmup
(self)
evaluator.py:135
↓ 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
DiC_B
(**kwargs)
dic_models.py:592
Function
DiC_H
(**kwargs)
dic_models.py:586
Function
DiC_S
(**kwargs)
dic_models.py:595
next →
1–100 of 186, ranked by callers