MCPcopy Create free account

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

Functions202 in github.com/TonyLianLong/LLM-groundedDiffusion

↓ 7 callersMethod__init__
(self, dim_in: int, dim_out: int, approximate: str = "none")
models/attention.py:297
↓ 7 callersFunctionrun
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.py:215
↓ 5 callersFunctioncount
(gen_boxes, name_include)
utils/eval/utils.py:55
↓ 5 callersFunctionfilter_boxes
(gen_boxes, scale_boxes=True, ignore_background=True, max_scale=3)
utils/parse.py:126
↓ 5 callersFunctionget_prompts
This function returns the text prompts according to the requested `prompt_type` and `model`. Set `model` to "all" to return all the text prompts
prompt.py:74
↓ 4 callersMethod__init__
( self, in_channels: int, prev_output_channel: int, out_channels: int,
models/unet_2d_blocks.py:713
↓ 4 callersFunctionparse_input_with_negative
(text=None, no_input=False)
utils/parse.py:66
↓ 4 callersFunctionprocess_object_name
(object_name)
utils/eval/lmd.py:150
↓ 4 callersFunctionshow_boxes
(gen_boxes, bg_prompt=None, neg_prompt=None, ind=None, show=False, save=False)
utils/parse.py:252
↓ 4 callersFunctionsingular
(noun)
utils/eval/utils.py:36
↓ 3 callersFunctiondecode
(vae, latents)
models/pipelines.py:117
↓ 3 callersMethodgelu
(self, gate)
models/attention.py:302
↓ 3 callersFunctionget_full_model_name
(model)
utils/llm.py:17
↓ 3 callersFunctionget_full_prompt
(template, prompt, suffix=None)
utils/llm.py:11
↓ 3 callersFunctionget_token_map
(tokenizer, prompt, verbose=False, padding="do_not_pad")
utils/guidance.py:10
↓ 3 callersFunctionget_unscaled_latents
in_channels: often obtained with `unet.config.in_channels`
utils/latents.py:7
↓ 3 callersFunctiongligen_enable_fuser
(unet, enabled=True)
models/pipelines.py:280
↓ 3 callersMethodhead_to_batch_dim
(self, tensor, out_dim=3)
models/attention_processor.py:190
↓ 3 callersFunctionlatent_backward_guidance
(scheduler, unet, cond_embeddings, index, bboxes, object_positions, t, latents, loss, loss_scale = 30, loss_th
models/pipelines.py:16
↓ 3 callersMethodset_processor
(self, processor: "AttnProcessor")
models/attention_processor.py:157
↓ 2 callersMethod__init__
(self, positive_len, out_dim, fourier_freqs=8)
models/unet_2d_condition.py:80
↓ 2 callersFunctioneval_prompt
(p, prompt_type, gen_boxes, verbose=False)
scripts/eval_stage_one.py:16
↓ 2 callersFunctionevaluate_with_boxes
(boxes, eval_info, verbose=False)
utils/eval/eval.py:107
↓ 2 callersFunctionget_box
(gen_boxes, name_include)
utils/eval/utils.py:43
↓ 2 callersFunctionget_eval_info_from_prompt
(prompt, prompt_type)
utils/eval/eval.py:5
↓ 2 callersFunctionget_iou_with_resize
(mask, masks, masks_shape)
models/sam.py:63
↓ 2 callersFunctionget_layout
(prompt, llm_kwargs, suffix="")
utils/llm.py:52
↓ 2 callersFunctionget_llm_kwargs
(model, template_version)
utils/llm.py:27
↓ 2 callersFunctionnms
This NMS processes boxes of all labels. It not only removes the box with the same label. Adapted from https://github.com/amusi/Non-Maxim
utils/eval/eval.py:11
↓ 2 callersMethodnorm_encoder_hidden_states
(self, encoder_hidden_states)
models/attention_processor.py:276
↓ 2 callersMethodprepare_attention_mask
(self, attention_mask, target_length, batch_size=None, out_dim=3)
models/attention_processor.py:235
↓ 2 callersFunctionpreprocess_mask
(token_attn_np_smooth, mask_th, n_erode_dilate_mask=0)
models/sam.py:113
↓ 2 callersFunctionsam
target_mask_shape: (h, w)
models/sam.py:25
↓ 2 callersFunctionsam_box_input
(sam_model_dict, image, input_boxes, **kwargs)
models/sam.py:60
↓ 2 callersFunctionselect_mask
masks: numpy bool array
models/sam.py:67
↓ 1 callersMethod__call_fast__
( self, attn: Attention, hidden_states, encoder_hidden_states=None, at
models/attention_processor.py:305
↓ 1 callersMethod__init__
( self, query_dim: int, cross_attention_dim: Optional[int] = None, heads: int
models/attention_processor.py:41
↓ 1 callersFunction_compute_loss
Computes the attend-and-excite loss using the maximum attention value for each token.
utils/boxdiff.py:104
↓ 1 callersFunction_compute_max_attention_per_index
Computes the maximum attention value for each of the tokens we wish to alter.
utils/boxdiff.py:20
↓ 1 callersFunctionadd_ca_loss_per_attn_map_to_loss
fg_top_p, bg_top_p, fg_weight, and bg_weight are only used with max-based loss
utils/guidance.py:91
↓ 1 callersFunctionadd_ca_loss_per_attn_map_to_loss_boxdiff
(original_loss, attention_maps, object_number, bboxes, object_positions, P=0.2, L=1, smooth_attentions=True, s
utils/boxdiff.py:164
↓ 1 callersFunctionadd_cache
(key, value)
utils/cache.py:60
↓ 1 callersFunctionadd_ref_ca_loss_per_attn_map_to_lossv2
This adds the ca loss with ref. Note that this should be used with ca loss without ref since it only enforces the mse of the normalized ca betwee
utils/guidance.py:150
↓ 1 callersFunctionalign_with_bboxes
Each offset in `offset_list` is `(x_offset, y_offset)` (normalized).
utils/latents.py:85
↓ 1 callersMethodbatch_to_head_dim
(self, tensor)
models/attention_processor.py:183
↓ 1 callersFunctionbinary_mask_to_box
(mask, enlarge_box_by_one=True, w_scale=1, h_scale=1)
utils/utils.py:72
↓ 1 callersFunctionblend_latents
in_channels: often obtained with `unet.config.in_channels`
utils/latents.py:25
↓ 1 callersFunctionboxes_to_masks_prompts
(boxes, fg_negative_prompt, first_top=True)
generation/multidiffusion.py:303
↓ 1 callersFunctionclass_aware_nms
This NMS processes boxes of each label individually.
utils/eval/eval.py:83
↓ 1 callersFunctioncompose_latents
(model_dict, latents_all_list, mask_tensor_list, num_inference_steps, overall_batch_size, height, width, laten
utils/latents.py:38
↓ 1 callersFunctioncompute_ca_loss_boxdiff
v3 is equivalent to v2 but with new dictionary format for attention maps. The `saved_attn` is supposed to be passed to `save_attn_to_dict` in
utils/boxdiff.py:120
↓ 1 callersFunctionconvert_box
(box, height, width)
utils/parse.py:304
↓ 1 callersMethoddecode_latents
(self, latents)
generation/multidiffusion.py:154
↓ 1 callersFunctiondraw_boxes
(anns)
utils/parse.py:228
↓ 1 callersMethodencode_imgs
(self, imgs)
generation/multidiffusion.py:147
↓ 1 callersMethodgelu
(self, gate)
models/attention.py:327
↓ 1 callersMethodgenerate
( self, masks, prompts, negative_prompts="", height=512, width
generation/multidiffusion.py:161
↓ 1 callersFunctiongenerate_single_object_with_box
( prompt, box, phrase, word, input_latents, input_embeddings, semantic_guidance_kw
generation/lmd_plus.py:44
↓ 1 callersFunctiongenerate_single_object_with_box
( prompt, box, phrase, word, input_latents, input_embeddings, semantic_guidance_kw
generation/lmd.py:54
↓ 1 callersMethodget_attention_scores
(self, query, key, attention_mask=None)
models/attention_processor.py:201
↓ 1 callersFunctionget_cache
(key)
utils/cache.py:42
↓ 1 callersFunctionget_down_block
( down_block_type, num_layers, in_channels, out_channels, temb_channels, add_downsampl
models/unet_2d_blocks.py:27
↓ 1 callersFunctionget_eval_info_from_prompt_lmd
Note: object_name needs to be a substring of each item in texts to make `count` and `get_box` in the predicate work
utils/eval/lmd.py:11
↓ 1 callersFunctionget_inverse_timesteps
(inverse_scheduler, num_inference_steps, strength)
models/pipelines.py:476
↓ 1 callersFunctionget_layout_with_cache
(prompt, *args, **kwargs)
utils/llm.py:96
↓ 1 callersFunctionget_lmd_prompts
()
utils/eval/lmd.py:236
↓ 1 callersFunctionget_masked_latents_all_list
( so_prompt_phrase_word_box_list, input_latents_list, so_input_embeddings, verbose=False,
generation/lmd_plus.py:148
↓ 1 callersFunctionget_masked_latents_all_list
( so_prompt_phrase_word_box_list, input_latents_list, so_input_embeddings, verbose=False,
generation/lmd.py:167
↓ 1 callersFunctionget_parsed_layout
(prompt, llm_kwargs, verbose=True)
utils/llm.py:113
↓ 1 callersFunctionget_prompt_predicates_attribution
(num_prompts=100, repeat=1)
utils/eval/lmd.py:159
↓ 1 callersFunctionget_prompt_predicates_negation
(repeat=10)
utils/eval/lmd.py:99
↓ 1 callersFunctionget_prompt_predicates_numeracy
(min_num=1, max_num=5, repeat=2)
utils/eval/lmd.py:125
↓ 1 callersFunctionget_prompt_predicates_spatial
(num_prompts=25, left_right_only=False)
utils/eval/lmd.py:190
↓ 1 callersMethodget_random_background
(self, n_samples)
generation/multidiffusion.py:113
↓ 1 callersFunctionget_scaled_latents
(batch_size, in_channels, height, width, generator, dtype, scheduler)
utils/latents.py:20
↓ 1 callersMethodget_text_embeds
(self, prompt, negative_prompt)
generation/multidiffusion.py:121
↓ 1 callersFunctionget_up_block
( up_block_type, num_layers, in_channels, out_channels, prev_output_channel, temb_chan
models/unet_2d_blocks.py:92
↓ 1 callersFunctionget_views
(panorama_height, panorama_width, window_size=64, stride=8)
generation/multidiffusion.py:30
↓ 1 callersFunctionprepare_gligen_condition
(bboxes, phrases, dtype, tokenizer, text_encoder, num_images_per_prompt)
models/pipelines.py:285
↓ 1 callersFunctionpreprocess_mask
(mask_path, h, w, device)
generation/multidiffusion.py:288
↓ 1 callersFunctionprocess_input_embeddings
(input_embeddings)
models/models.py:91
↓ 1 callersFunctionrun
( gen_boxes, bg_prompt, original_ind_base=None, bootstrapping=20, generate_kw=None, fi
generation/multidiffusion.py:351
↓ 1 callersFunctionsam_point_input
(sam_model_dict, image, input_points, **kwargs)
models/sam.py:57
↓ 1 callersFunctionsam_refine_boxes
(sam_input_images, boxes, model_dict, height, width, H, W, discourage_mask_below_confidence, discourage_mask_b
models/sam.py:182
↓ 1 callersFunctionscale_proportion
(obj_box, H, W, use_legacy=False)
utils/utils.py:57
↓ 1 callersFunctionseed_everything
(seed)
generation/multidiffusion.py:23
↓ 1 callersMethodset_attention_slice
r""" Enable sliced attention computation. When this option is enabled, the attention module will split the input tensor in slices, to
models/unet_2d_condition.py:635
↓ 1 callersMethodset_attn_processor
r""" Parameters: `processor (`dict` of `AttentionProcessor` or `AttentionProcessor`): The instantiated processor c
models/unet_2d_condition.py:599
↓ 1 callersFunctionshift_saved_attns_item
`horizontal_shift_only`: only shift horizontally. If you use `offset` from `compose_latents_with_alignment` with `horizontal_shift_only=True`, th
utils/attn.py:40
↓ 1 callersFunctionshow_masks
(masks)
utils/parse.py:293
↓ 1 callersFunctionto_gen_box_format
(box, width, height)
utils/eval/eval.py:114
↓ 1 callersMethodunet_batch
(self, latent_model_input, t, encoder_hidden_states)
generation/multidiffusion.py:93
Method__call__
attn_key: current key (a tuple of hierarchy index (up/mid/down, stage id, block id, sub-block id), sub block id should always be 0 in SD UNet
models/attention_processor.py:377
Method__call__
(self, x)
models/unet_2d_condition.py:74
Method__init__
(self, channels, kernel_size, sigma, dim=2)
utils/attn.py:89
Method__init__
(self, device, sd_version="2.0", batch_size=2, hf_key=None)
generation/multidiffusion.py:47
Method__init__
(self)
models/attention_processor.py:301
Method__init__
( self, f_channels, zq_channels, )
models/attention_processor.py:493
Method__init__
( self, num_attention_heads: int = 16, attention_head_dim: int = 88, in_channe
models/transformer_2d.py:80
Method__init__
(self, num_freqs=64, temperature=100)
models/unet_2d_condition.py:64
next →1–100 of 202, ranked by callers