MCPcopy Create free account

hub / github.com/TonyLianLong/LLM-groundedDiffusion / functions

Functions202 in github.com/TonyLianLong/LLM-groundedDiffusion

Method__init__
( self, sample_size: Optional[int] = None, in_channels: int = 4, out_channels:
models/unet_2d_condition.py:201
Method__init__
(self, query_dim, context_dim, n_heads, d_head)
models/attention.py:26
Method__init__
( self, dim: int, num_attention_heads: int, attention_head_dim: int, d
models/attention.py:77
Method__init__
( self, dim: int, dim_out: Optional[int] = None, mult: int = 4, dropou
models/attention.py:253
Method__init__
(self, dim_in: int, dim_out: int)
models/attention.py:323
Method__init__
(self, dim_in: int, dim_out: int)
models/attention.py:345
Method__init__
(self, embedding_dim, num_embeddings)
models/attention.py:359
Method__init__
(self, embedding_dim, num_embeddings)
models/attention.py:378
Method__init__
( self, in_channels: int, temb_channels: int, dropout: float = 0.0, nu
models/unet_2d_blocks.py:158
Method__init__
( self, in_channels: int, out_channels: int, temb_channels: int, dropo
models/unet_2d_blocks.py:282
Method__init__
( self, in_channels: int, out_channels: int, temb_channels: int, dropo
models/unet_2d_blocks.py:455
Method__init__
( self, in_channels: int, out_channels: int, prev_output_channel: int,
models/unet_2d_blocks.py:541
Method_set_gradient_checkpointing
(self, module, value=False)
models/unet_2d_condition.py:700
Methodattn_processors
r""" Returns: `dict` of attention processors: A dictionary containing all attention processors used in the model with
models/unet_2d_condition.py:576
Functionbinary_mask_to_box_mask
(mask, to_device=True)
utils/utils.py:90
Functionbinary_mask_to_center
This computes the mass center of the mask. normalize: the coords range from 0 to 1 Reference: https://stackoverflow.com/a/66184125
utils/utils.py:102
Functioncompose_latents_with_alignment
( model_dict, latents_all_list, mask_tensor_list, num_inference_steps, overall_batch_size, height, width,
utils/latents.py:108
Functioncompute_ca_lossv3
The `saved_attn` is supposed to be passed to `save_attn_to_dict` in `cross_attention_kwargs` prior to computing ths loss. `AttnProcessor` wil
utils/guidance.py:244
Functionconvert_spec
(spec, height, width, include_counts=True, verbose=False)
utils/parse.py:313
Methodcreate_custom_forward
(module, return_dict=None)
models/unet_2d_blocks.py:390
Methodcreate_custom_forward
(module)
models/unet_2d_blocks.py:512
Methodcreate_custom_forward
(module, return_dict=None)
models/unet_2d_blocks.py:653
Methodcreate_custom_forward
(module)
models/unet_2d_blocks.py:772
Methodcustom_forward
(*inputs)
models/unet_2d_blocks.py:391
Methodcustom_forward
(*inputs)
models/unet_2d_blocks.py:513
Methodcustom_forward
(*inputs)
models/unet_2d_blocks.py:654
Methodcustom_forward
(*inputs)
models/unet_2d_blocks.py:773
Functiondisplay
save_ind_in_filename: This adds a global index to the filename so that two calls to this function will not save to the same file and overwrite th
utils/vis.py:223
Functiondraw_box
(pil_img, bboxes, phrases)
utils/utils.py:8
Functiondynamically_adjust_inference_steps
(scheduler, index, t)
utils/schedule.py:10
Functionencode
image should be a PIL object or numpy array with range 0 to 255
models/pipelines.py:85
Functionencode_prompts
(tokenizer, text_encoder, prompts, negative_prompt="", return_full_only=False, one_uncond_input_only=False)
models/models.py:63
Functioneval_prompt
(p, prompt_type, path, processor, model, score_threshold = 0.1, nms_threshold = 0.5, use_class_aware_nms=False
utils/eval/eval.py:120
Functionexpand_overall_bboxes
Expand overall bboxes from a 3d list to 2d list: Input: [[box 1 for phrase 1, box 2 for phrase 1], ...] Output: [box 1, box 2, ...]
utils/utils.py:137
Functionfind_word_after
(text, word)
utils/eval/utils.py:9
Methodfn_recursive_add_processors
(name: str, module: torch.nn.Module, processors: Dict[str, AttentionProcessor])
models/unet_2d_condition.py:585
Methodfn_recursive_attn_processor
(name: str, module: torch.nn.Module, processor)
models/unet_2d_condition.py:616
Methodfn_recursive_retrieve_sliceable_dims
(module: torch.nn.Module)
models/unet_2d_condition.py:651
Methodfn_recursive_set_attention_slice
(module: torch.nn.Module, slice_size: List[int])
models/unet_2d_condition.py:689
Methodforward
Apply gaussian filter to input. Arguments: input (torch.Tensor): Input to apply gaussian filter on. Returns:
utils/attn.py:132
Methodforward
(self, hidden_states, encoder_hidden_states=None, attention_mask=None, return_attntion_probs=False, **cross_at
models/attention_processor.py:170
Methodforward
(self, f, zq)
models/attention_processor.py:503
Methodforward
Args: hidden_states ( When discrete, `torch.LongTensor` of shape `(batch size, num latent pixels)`. When continuo
models/transformer_2d.py:216
Methodforward
(self, boxes, masks, positive_embeddings)
models/unet_2d_condition.py:99
Methodforward
r""" Args: sample (`torch.FloatTensor`): (batch, channel, height, width) noisy inputs tensor timestep (`torch.FloatTen
models/unet_2d_condition.py:704
Methodforward
(self, x, objs, fuser_attn_kwargs={})
models/attention.py:43
Methodforward
( self, hidden_states: torch.FloatTensor, attention_mask: Optional[torch.FloatTensor]
models/attention.py:156
Methodforward
(self, hidden_states)
models/attention.py:286
Methodforward
(self, hidden_states)
models/attention.py:308
Methodforward
(self, hidden_states)
models/attention.py:333
Methodforward
(self, x)
models/attention.py:349
Methodforward
(self, x, timestep)
models/attention.py:366
Methodforward
(self, x, timestep, class_labels, hidden_dtype=None)
models/attention.py:387
Methodforward
( self, hidden_states: torch.FloatTensor, temb: Optional[torch.FloatTensor] = None,
models/unet_2d_blocks.py:245
Methodforward
( self, hidden_states: torch.FloatTensor, temb: Optional[torch.FloatTensor] = None,
models/unet_2d_blocks.py:370
Methodforward
(self, hidden_states, temb=None)
models/unet_2d_blocks.py:506
Methodforward
( self, hidden_states: torch.FloatTensor, res_hidden_states_tuple: Tuple[torch.FloatTe
models/unet_2d_blocks.py:627
Methodforward
(self, hidden_states, res_hidden_states_tuple, temb=None, upsample_size=None)
models/unet_2d_blocks.py:762
Functionfree_memory
()
utils/utils.py:133
Functiongenerate
(model_dict, latents, input_embeddings, num_inference_steps, guidance_scale = 7.5, no_set_timesteps=False, sch
models/pipelines.py:250
Functiongenerate_gligen
The `bboxes` should be a list, rather than a list of lists (one box per phrase, we can have multiple duplicated phrases). batched: E
models/pipelines.py:324
Functiongenerate_partial_frozen
(model_dict, latents_all, frozen_mask, input_embeddings, num_inference_steps, frozen_steps, guidance_scale = 7
models/pipelines.py:541
Functiongenerate_semantic_guidance
object_positions: object indices in text tokens return_cross_attn: should be deprecated. Use `return_saved_cross_attn` and the new format.
models/pipelines.py:129
Functionget_centered_box
(box, horizontal_center_only=True, vertical_placement='centered', vertical_center=0.5, floor_padding=None)
utils/utils.py:19
Functionget_fast_schedule
(origial_timesteps, fast_after_steps, fast_rate)
utils/schedule.py:4
Functionget_input_latents_list
Note: the returned input latents are scaled by `scheduler.init_noise_sigma`
utils/latents.py:120
Functionget_phrase_indices
(tokenizer, prompt, phrases, verbose=False, words=None, include_eos=False, token_map=None, return_word_token_i
utils/guidance.py:32
Functionget_token_attnv2
saved_attns: a list of saved_attn (list is across timesteps) moves to cpu by default
utils/attn.py:9
Functioninit
(offload_model=True)
generation/sdxl_refinement.py:10
Functioninit_cache
(allow_nonexist=True)
utils/cache.py:25
Functioninvert
latents: encoded from the image, should not have noise (t = 0) returns inverted_latents for all time steps
models/pipelines.py:490
Functioniou
(mask, masks, eps=1e-6)
utils/utils.py:124
Functionlatent_backward_guidance_boxdiff
amp_loss_scale: this scales the loss but will de-scale before applying for latents. This is to prevent overflow/underflow with amp, not to adjust
utils/boxdiff.py:190
Functionload_sam
()
models/sam.py:13
Functionload_sd
Keys: key = "CompVis/stable-diffusion-v1-4" key = "runwayml/stable-diffusion-v1-5" key = "stabilityai/stable-diffusion-2-1-base"
models/models.py:16
Functionparse_input
(text=None, no_input=False)
utils/parse.py:28
Functionpkl_to_json
(filename)
utils/cache.py:73
Functionpredicate_attribution
(query_names1, query_names2, modifier1, modifier2, intended_count1, intended_count2, gen_boxes, verbose=False)
utils/eval/utils.py:84
Functionpredicate_numeracy
(query_names, intended_count, gen_boxes, verbose=False)
utils/eval/utils.py:61
Functionpredicate_numeracy_2obj
(query_names1, intended_count1, query_names2, intended_count2, gen_boxes, verbose=False)
utils/eval/utils.py:70
Functionpredicate_spatial
(query_names1, query_names2, verify_fn, gen_boxes, verbose=False)
utils/eval/utils.py:104
Functionproportion_to_mask
(obj_box, H, W, use_legacy=False, return_np=False)
utils/utils.py:47
Functionrefine
(image, spec, refine_seed, refinement_step_ratio=0.5)
generation/sdxl_refinement.py:22
Functionreset_cache_access
()
utils/cache.py:17
Functionreset_save_ind
()
utils/vis.py:219
Functionrun
(prompt, seed=100, extra_neg_prompt="")
generation/stable_diffusion_generate.py:31
Functionrun
so_center_box: using centered box in single object generation so_horizontal_center_only: move to the center horizontally only align_with
generation/boxdiff.py:46
Functionrun
spec: the spec for generation (see generate.py for how to construct a spec) bg_seed: background seed overall_prompt_override: use custom
generation/lmd_plus.py:193
Functionrun
so_center_box: using centered box in single object generation so_horizontal_center_only: move to the center horizontally only align_with
generation/backward_guidance.py:43
Functionrun
so_center_box: using centered box in single object generation so_horizontal_center_only: move to the center horizontally only align_with
generation/gligen.py:42
Functionsam_refine_attn
(sam_input_image, token_attn_np, model_dict, height, width, H, W, use_box_input, gaussian_sigma, mask_th_for_b
models/sam.py:125
Functionsam_refine_box
(sam_input_image, box, *args, **kwargs)
models/sam.py:174
Methodset_default_attn_processor
Disables custom attention processors and sets the default attention implementation.
models/unet_2d_condition.py:629
Functionshift_saved_attns
(saved_attns, offset, guidance_attn_keys, **kwargs)
utils/attn.py:66
Functionshift_tensor
base_w and base_h: make sure the shift is aligned in the latent and multiple levels of cross attention
utils/utils.py:145
Functionvalues_accessed
()
utils/cache.py:22
Functionvisualize
(image, title, colorbar=False, show_plot=True, **kwargs)
utils/vis.py:11
Functionvisualize_across_timesteps
Visualize cross attention for one token, across timesteps: `stage_id`th downsampling block, mean over all timesteps starting from step start, `bl
utils/vis.py:161
Functionvisualize_arrays
( image_title_pairs, colorbar_index=-1, show_plot=True, figsize=None, **kwargs )
utils/vis.py:20
Functionvisualize_attn
Visualize cross attention: `stage_id`th downsampling block, mean over all timesteps starting from step start, `block_id`th Transformer block, sec
utils/vis.py:115
← previousnext →101–200 of 202, ranked by callers