Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/PKU-YuanGroup/TaxDiff
/ functions
Functions
92 in github.com/PKU-YuanGroup/TaxDiff
⨍
Functions
92
◇
Types & classes
18
↓ 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
↓ 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, hid
models.py:178
↓ 4 callers
Method
_wrap_model
(self, model)
diffusion/respace.py:105
↓ 4 callers
Function
modulate
(x, shift, scale)
models.py:10
↓ 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
↓ 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
Method
decode
decode index array, x, to byte string of this alphabet
data_reader/decoder.py:34
↓ 2 callers
Function
decode_protein
(or_file_path,select_method,gene_num,select_inner)
data_reader/decoder.py:114
↓ 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:324
↓ 2 callers
Method
load
(self, path, alphabet)
data_reader/decoder.py:62
↓ 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
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
↓ 1 callers
Method
__init__
(self, model, timestep_map, original_num_steps)
diffusion/respace.py:118
↓ 1 callers
Method
__init__
(self, chars, encoding=None, missing=255)
data_reader/decoder.py:13
↓ 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
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_diffusion
( timestep_respacing, noise_schedule="linear", use_kl=False, sigma_small=False, predict_x
diffusion/__init__.py:10
↓ 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
(model_name)
sample_protein.py:17
↓ 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:250
↓ 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:295
↓ 1 callers
Function
get_2d_sincos_pos_embed_from_grid
(embed_dim, grid)
models.py:313
↓ 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:214
↓ 1 callers
Function
len_select
(data)
data_reader/decoder.py:92
↓ 1 callers
Function
main
(args,class_lables)
sample_protein.py:24
↓ 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
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:28
↓ 1 callers
Method
token_drop
Drops labels to enable classifier-free guidance.
models.py:65
↓ 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_pro_12_h6_L16
(**kwargs)
models.py:355
Function
DiT_pro_12_h6_L32
(**kwargs)
models.py:358
Function
DiT_pro_12_h6_L4
(**kwargs)
models.py:349
Function
DiT_pro_12_h6_L64
(**kwargs)
models.py:361
Function
DiT_pro_12_h6_L8
(**kwargs)
models.py:352
Method
__call__
(self, x, ts, **kwargs)
diffusion/respace.py:124
Method
__getitem__
(self, i)
data_reader/decoder.py:25
Method
__init__
(self, hidden_size, frequency_embedding_size=256)
models.py:18
Method
__init__
(self, num_classes, hidden_size, dropout_prob)
models.py:58
Method
__init__
(self, hidden_size, num_heads, mlp_ratio, slice_size,**block_kwargs)
models.py:114
Method
__init__
(self, hidden_size, out_channels)
models.py:158
Method
__init__
(self, diffusion)
diffusion/timestep_sampler.py:63
Method
__init__
(self, diffusion, history_per_term=10, uniform_prob=0.001)
diffusion/timestep_sampler.py:121
Method
__init__
( self, *, betas, model_mean_type, model_var_type, loss_type
diffusion/gaussian_diffusion.py:153
Method
__init__
(self, use_timesteps, **kwargs)
diffusion/respace.py:73
Method
__init__
(self)
data_reader/decoder.py:41
Method
__init__
(self, path='generate_data/protein/generate1.txt', alphabet=Uniprot21())
data_reader/decoder.py:50
Method
__iter__
(self)
data_reader/decoder.py:48
Method
__len__
(self)
data_reader/decoder.py:22
Method
_basic_init
(module)
models.py:216
Method
_scale_timesteps
(self, t)
diffusion/respace.py:112
Method
calc_bpd_loop
Compute the entire variational lower-bound, measured in bits-per-dim, as well as other related quantities. :param model: the
diffusion/gaussian_diffusion.py:805
Method
condition_mean
(self, cond_fn, *args, **kwargs)
diffusion/respace.py:99
Method
condition_score
(self, cond_fn, *args, **kwargs)
diffusion/respace.py:102
Function
continuous_gaussian_log_likelihood
Compute the log-likelihood of a continuous Gaussian distribution. :param x: the targets :param means: the Gaussian mean Tensor. :para
diffusion/diffusion_utils.py:47
Function
create_named_schedule_sampler
Create a ScheduleSampler from a library of pre-defined samplers. :param name: the name of the sampler. :param diffusion: the diffusion ob
diffusion/timestep_sampler.py:13
Method
ddim_reverse_sample
Sample x_{t+1} from the model using DDIM reverse ODE.
diffusion/gaussian_diffusion.py:562
Method
ddim_sample_loop
Generate samples from the model using DDIM. Same usage as p_sample_loop().
diffusion/gaussian_diffusion.py:600
Method
encode
encode a byte string into alphabet indices
data_reader/decoder.py:28
Method
forward
(self, t)
models.py:48
Method
forward
(self, labels, train, force_drop_ids=None)
models.py:76
Method
forward
(self, x, c)
models.py:135
Method
forward
(self, x, c)
models.py:167
Method
forward_with_cfg
Forward pass of DiT, but also batches the unconditional forward pass for classifier-free guidance.
models.py:271
Function
get_named_beta_schedule
Get a pre-defined beta schedule for the given name. The beta schedule library consists of beta schedules which remain similar in the limi
diffusion/gaussian_diffusion.py:98
Method
is_vb
(self)
diffusion/gaussian_diffusion.py:54
Method
p_mean_variance
( self, model, *args, **kwargs )
diffusion/respace.py:89
Method
process_xstart
(x)
diffusion/gaussian_diffusion.py:310
Function
random_select
(data)
data_reader/decoder.py:106
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
Method
training_losses
Compute training losses for a single timestep. :param model: the model to evaluate loss on. :param x_start: the [N x C x ...]
diffusion/gaussian_diffusion.py:715
Method
training_losses
( self, model, *args, **kwargs )
diffusion/respace.py:94
Method
update_with_all_losses
(self, ts, losses)
diffusion/timestep_sampler.py:139
Method
update_with_local_losses
Update the reweighting using losses from a model. Call this method from each rank with a batch of timesteps and the correspon
diffusion/timestep_sampler.py:72
Method
weights
(self)
diffusion/timestep_sampler.py:67
Method
weights
(self)
diffusion/timestep_sampler.py:130