SYMBOL INDEX (2802 symbols across 163 files) FILE: XTI_hijack.py function unet_forward_XTI (line 11) | def unet_forward_XTI( function downblock_forward_XTI (line 126) | def downblock_forward_XTI( function upblock_forward_XTI (line 164) | def upblock_forward_XTI( FILE: anima_minimal_inference.py class GenerationSettings (line 34) | class GenerationSettings: method __init__ (line 35) | def __init__(self, device: torch.device, dit_weight_dtype: Optional[to... function parse_args (line 40) | def parse_args() -> argparse.Namespace: function parse_prompt_line (line 136) | def parse_prompt_line(line: str) -> Dict[str, Any]: function apply_overrides (line 177) | def apply_overrides(args: argparse.Namespace, overrides: Dict[str, Any])... function check_inputs (line 200) | def check_inputs(args: argparse.Namespace) -> Tuple[int, int]: function load_dit_model (line 221) | def load_dit_model( function load_text_encoder (line 288) | def load_text_encoder( function decode_latent (line 313) | def decode_latent( function process_escape (line 332) | def process_escape(text: str) -> str: function prepare_text_inputs (line 344) | def prepare_text_inputs( function generate (line 458) | def generate( function generate_body (line 504) | def generate_body( function get_time_flag (line 579) | def get_time_flag(): function save_latent (line 583) | def save_latent(latent: torch.Tensor, args: argparse.Namespace, height: ... function save_images (line 625) | def save_images(sample: torch.Tensor, args: argparse.Namespace, original... function save_output (line 656) | def save_output( function preprocess_prompts_for_batch (line 708) | def preprocess_prompts_for_batch(prompt_lines: List[str], base_args: arg... function load_shared_models (line 733) | def load_shared_models(args: argparse.Namespace) -> Dict: function process_batch_prompts (line 752) | def process_batch_prompts(prompts_data: List[Dict], args: argparse.Names... function process_interactive (line 882) | def process_interactive(args: argparse.Namespace) -> None: function get_generation_settings (line 951) | def get_generation_settings(args: argparse.Namespace) -> GenerationSetti... function main (line 966) | def main(): FILE: anima_train.py function train (line 43) | def train(args): function setup_parser (line 712) | def setup_parser() -> argparse.ArgumentParser: FILE: anima_train_network.py class AnimaNetworkTrainer (line 33) | class AnimaNetworkTrainer(train_network.NetworkTrainer): method __init__ (line 34) | def __init__(self): method assert_extra_args (line 38) | def assert_extra_args( method load_target_model (line 82) | def load_target_model(self, args, weight_dtype, accelerator): method load_unet_lazily (line 101) | def load_unet_lazily(self, args, weight_dtype, accelerator, text_encod... method get_tokenize_strategy (line 136) | def get_tokenize_strategy(self, args): method get_tokenizers (line 146) | def get_tokenizers(self, tokenize_strategy: strategy_anima.AnimaTokeni... method get_latents_caching_strategy (line 149) | def get_latents_caching_strategy(self, args): method get_text_encoding_strategy (line 152) | def get_text_encoding_strategy(self, args): method post_process_network (line 155) | def post_process_network(self, args, accelerator, network, text_encode... method get_models_for_text_encoding (line 158) | def get_models_for_text_encoding(self, args, accelerator, text_encoders): method get_text_encoder_outputs_caching_strategy (line 163) | def get_text_encoder_outputs_caching_strategy(self, args): method cache_text_encoder_outputs_if_needed (line 170) | def cache_text_encoder_outputs_if_needed( method sample_images (line 222) | def sample_images(self, accelerator, args, epoch, global_step, device,... method get_noise_scheduler (line 242) | def get_noise_scheduler(self, args: argparse.Namespace, device: torch.... method encode_images_to_latents (line 246) | def encode_images_to_latents(self, args, vae, images): method shift_scale_latents (line 250) | def shift_scale_latents(self, args, latents): method get_noise_pred_and_target (line 254) | def get_noise_pred_and_target( method process_batch (line 325) | def process_batch( method post_process_loss (line 376) | def post_process_loss(self, loss, args, timesteps, noise_scheduler): method get_sai_model_spec (line 379) | def get_sai_model_spec(self, args): method update_metadata (line 382) | def update_metadata(self, metadata, args): method is_text_encoder_not_needed_for_training (line 391) | def is_text_encoder_not_needed_for_training(self, args): method prepare_text_encoder_grad_ckpt_workaround (line 394) | def prepare_text_encoder_grad_ckpt_workaround(self, index, text_encoder): method prepare_unet_with_accelerator (line 399) | def prepare_unet_with_accelerator( method on_validation_step_end (line 417) | def on_validation_step_end(self, args, accelerator, network, text_enco... function setup_parser (line 423) | def setup_parser() -> argparse.ArgumentParser: FILE: bitsandbytes_windows/cextension.py class CUDALibrary_Singleton (line 8) | class CUDALibrary_Singleton(object): method __init__ (line 11) | def __init__(self): method initialize (line 14) | def initialize(self): method get_instance (line 36) | def get_instance(cls): FILE: bitsandbytes_windows/main.py function check_cuda_result (line 24) | def check_cuda_result(cuda, result_val): function get_cuda_version (line 31) | def get_cuda_version(cuda, cudart_path): function get_cuda_lib_handle (line 52) | def get_cuda_lib_handle(): function get_compute_capabilities (line 65) | def get_compute_capabilities(cuda): function get_compute_capability (line 99) | def get_compute_capability(cuda): function evaluate_cuda_setup (line 112) | def evaluate_cuda_setup(): FILE: fine_tune.py function train (line 46) | def train(args): function setup_parser (line 518) | def setup_parser() -> argparse.ArgumentParser: FILE: finetune/blip/blip.py class BLIP_Base (line 29) | class BLIP_Base(nn.Module): method __init__ (line 30) | def __init__(self, method forward (line 52) | def forward(self, image, caption, mode): class BLIP_Decoder (line 84) | class BLIP_Decoder(nn.Module): method __init__ (line 85) | def __init__(self, method forward (line 111) | def forward(self, image, caption): method generate (line 134) | def generate(self, image, sample=False, num_beams=3, max_length=30, mi... function blip_decoder (line 179) | def blip_decoder(pretrained='',**kwargs): function blip_feature_extractor (line 186) | def blip_feature_extractor(pretrained='',**kwargs): function init_tokenizer (line 193) | def init_tokenizer(): function create_vit (line 201) | def create_vit(vit, image_size, use_grad_checkpointing=False, ckpt_layer... function is_url (line 218) | def is_url(url_or_filename): function load_checkpoint (line 222) | def load_checkpoint(model,url_or_filename): FILE: finetune/blip/med.py class BertEmbeddings (line 52) | class BertEmbeddings(nn.Module): method __init__ (line 55) | def __init__(self, config): method forward (line 71) | def forward( class BertSelfAttention (line 97) | class BertSelfAttention(nn.Module): method __init__ (line 98) | def __init__(self, config, is_cross_attention): method save_attn_gradients (line 126) | def save_attn_gradients(self, attn_gradients): method get_attn_gradients (line 129) | def get_attn_gradients(self): method save_attention_map (line 132) | def save_attention_map(self, attention_map): method get_attention_map (line 135) | def get_attention_map(self): method transpose_for_scores (line 138) | def transpose_for_scores(self, x): method forward (line 143) | def forward( class BertSelfOutput (line 228) | class BertSelfOutput(nn.Module): method __init__ (line 229) | def __init__(self, config): method forward (line 235) | def forward(self, hidden_states, input_tensor): class BertAttention (line 242) | class BertAttention(nn.Module): method __init__ (line 243) | def __init__(self, config, is_cross_attention=False): method prune_heads (line 249) | def prune_heads(self, heads): method forward (line 267) | def forward( class BertIntermediate (line 291) | class BertIntermediate(nn.Module): method __init__ (line 292) | def __init__(self, config): method forward (line 300) | def forward(self, hidden_states): class BertOutput (line 306) | class BertOutput(nn.Module): method __init__ (line 307) | def __init__(self, config): method forward (line 313) | def forward(self, hidden_states, input_tensor): class BertLayer (line 320) | class BertLayer(nn.Module): method __init__ (line 321) | def __init__(self, config, layer_num): method forward (line 333) | def forward( method feed_forward_chunk (line 380) | def feed_forward_chunk(self, attention_output): class BertEncoder (line 386) | class BertEncoder(nn.Module): method __init__ (line 387) | def __init__(self, config): method forward (line 393) | def forward( class BertPooler (line 486) | class BertPooler(nn.Module): method __init__ (line 487) | def __init__(self, config): method forward (line 492) | def forward(self, hidden_states): class BertPredictionHeadTransform (line 501) | class BertPredictionHeadTransform(nn.Module): method __init__ (line 502) | def __init__(self, config): method forward (line 511) | def forward(self, hidden_states): class BertLMPredictionHead (line 518) | class BertLMPredictionHead(nn.Module): method __init__ (line 519) | def __init__(self, config): method forward (line 532) | def forward(self, hidden_states): class BertOnlyMLMHead (line 538) | class BertOnlyMLMHead(nn.Module): method __init__ (line 539) | def __init__(self, config): method forward (line 543) | def forward(self, sequence_output): class BertPreTrainedModel (line 548) | class BertPreTrainedModel(PreTrainedModel): method _init_weights (line 558) | def _init_weights(self, module): class BertModel (line 571) | class BertModel(BertPreTrainedModel): method __init__ (line 581) | def __init__(self, config, add_pooling_layer=True): method get_input_embeddings (line 594) | def get_input_embeddings(self): method set_input_embeddings (line 597) | def set_input_embeddings(self, value): method _prune_heads (line 600) | def _prune_heads(self, heads_to_prune): method get_extended_attention_mask (line 609) | def get_extended_attention_mask(self, attention_mask: Tensor, input_sh... method forward (line 670) | def forward( class BertLMHeadModel (line 811) | class BertLMHeadModel(BertPreTrainedModel): method __init__ (line 816) | def __init__(self, config): method get_output_embeddings (line 824) | def get_output_embeddings(self): method set_output_embeddings (line 827) | def set_output_embeddings(self, new_embeddings): method forward (line 830) | def forward( method prepare_inputs_for_generation (line 932) | def prepare_inputs_for_generation(self, input_ids, past=None, attentio... method _reorder_cache (line 951) | def _reorder_cache(self, past, beam_idx): FILE: finetune/blip/vit.py class Mlp (line 23) | class Mlp(nn.Module): method __init__ (line 26) | def __init__(self, in_features, hidden_features=None, out_features=Non... method forward (line 35) | def forward(self, x): class Attention (line 44) | class Attention(nn.Module): method __init__ (line 45) | def __init__(self, dim, num_heads=8, qkv_bias=False, qk_scale=None, at... method save_attn_gradients (line 58) | def save_attn_gradients(self, attn_gradients): method get_attn_gradients (line 61) | def get_attn_gradients(self): method save_attention_map (line 64) | def save_attention_map(self, attention_map): method get_attention_map (line 67) | def get_attention_map(self): method forward (line 70) | def forward(self, x, register_hook=False): class Block (line 89) | class Block(nn.Module): method __init__ (line 91) | def __init__(self, dim, num_heads, mlp_ratio=4., qkv_bias=False, qk_sc... method forward (line 107) | def forward(self, x, register_hook=False): class VisionTransformer (line 113) | class VisionTransformer(nn.Module): method __init__ (line 118) | def __init__(self, img_size=224, patch_size=16, in_chans=3, num_classe... method _init_weights (line 167) | def _init_weights(self, m): method no_weight_decay (line 177) | def no_weight_decay(self): method forward (line 180) | def forward(self, x, register_blk=-1): method load_pretrained (line 197) | def load_pretrained(self, checkpoint_path, prefix=''): function _load_weights (line 202) | def _load_weights(model: VisionTransformer, checkpoint_path: str, prefix... function interpolate_pos_embed (line 281) | def interpolate_pos_embed(pos_embed_checkpoint, visual_encoder): FILE: finetune/clean_captions_and_tags.py function clean_tags (line 33) | def clean_tags(image_key, tags): function clean_caption (line 119) | def clean_caption(caption): function main (line 129) | def main(args): function setup_parser (line 170) | def setup_parser() -> argparse.ArgumentParser: FILE: finetune/hypernetwork_nai.py class HypernetworkModule (line 6) | class HypernetworkModule(torch.nn.Module): method __init__ (line 7) | def __init__(self, dim, multiplier=1.0): method forward (line 21) | def forward(self, x): class Hypernetwork (line 25) | class Hypernetwork(torch.nn.Module): method __init__ (line 29) | def __init__(self, multiplier=1.0) -> None: method apply_to_stable_diffusion (line 37) | def apply_to_stable_diffusion(self, text_encoder, vae, unet): method apply_to_diffusers (line 50) | def apply_to_diffusers(self, text_encoder, vae, unet): method forward (line 65) | def forward(self, x, context): method load_from_state_dict (line 71) | def load_from_state_dict(self, state_dict): method get_state_dict (line 90) | def get_state_dict(self): FILE: finetune/make_captions.py class ImageLoadingTransformDataset (line 43) | class ImageLoadingTransformDataset(torch.utils.data.Dataset): method __init__ (line 44) | def __init__(self, image_paths): method __len__ (line 47) | def __len__(self): method __getitem__ (line 50) | def __getitem__(self, idx): function collate_fn_remove_corrupted (line 64) | def collate_fn_remove_corrupted(batch): function main (line 74) | def main(args): function setup_parser (line 162) | def setup_parser() -> argparse.ArgumentParser: FILE: finetune/make_captions_by_git.py function remove_words (line 38) | def remove_words(captions, debug): function collate_fn_remove_corrupted (line 51) | def collate_fn_remove_corrupted(batch): function main (line 61) | def main(args): function setup_parser (line 150) | def setup_parser() -> argparse.ArgumentParser: FILE: finetune/merge_captions_to_metadata.py function main (line 16) | def main(args): function setup_parser (line 58) | def setup_parser() -> argparse.ArgumentParser: FILE: finetune/merge_dd_tags_to_metadata.py function main (line 16) | def main(args): function setup_parser (line 59) | def setup_parser() -> argparse.ArgumentParser: FILE: finetune/prepare_buckets_latents.py function collate_fn_remove_corrupted (line 38) | def collate_fn_remove_corrupted(batch): function get_npz_filename (line 48) | def get_npz_filename(data_dir, image_key, is_full_path, recursive): function main (line 62) | def main(args): function setup_parser (line 210) | def setup_parser() -> argparse.ArgumentParser: FILE: finetune/tag_images_by_wd14_tagger.py function preprocess_image (line 37) | def preprocess_image(image: Image.Image) -> np.ndarray: class ImageLoadingPrepDataset (line 67) | class ImageLoadingPrepDataset(torch.utils.data.Dataset): method __init__ (line 68) | def __init__(self, image_paths: list[str], batch_size: int): method __len__ (line 72) | def __len__(self): method __getitem__ (line 75) | def __getitem__(self, batch_index: int) -> tuple[str, np.ndarray, tupl... function collate_fn_no_op (line 100) | def collate_fn_no_op(batch): function main (line 105) | def main(args): function setup_parser (line 602) | def setup_parser() -> argparse.ArgumentParser: FILE: flux_minimal_inference.py function time_shift (line 37) | def time_shift(mu: float, sigma: float, t: torch.Tensor): function get_lin_function (line 41) | def get_lin_function(x1: float = 256, y1: float = 0.5, x2: float = 4096,... function get_schedule (line 47) | def get_schedule( function denoise (line 66) | def denoise( function do_sample (line 140) | def do_sample( function generate_image (line 201) | def generate_image( function is_fp8 (line 437) | def is_fp8(dt): FILE: flux_train.py function train (line 55) | def train(args): function setup_parser (line 785) | def setup_parser() -> argparse.ArgumentParser: FILE: flux_train_control_net.py function train (line 61) | def train(args): function setup_parser (line 819) | def setup_parser() -> argparse.ArgumentParser: FILE: flux_train_network.py class FluxNetworkTrainer (line 32) | class FluxNetworkTrainer(train_network.NetworkTrainer): method __init__ (line 33) | def __init__(self): method assert_extra_args (line 40) | def assert_extra_args( method load_target_model (line 99) | def load_target_model(self, args, weight_dtype, accelerator): method get_tokenize_strategy (line 162) | def get_tokenize_strategy(self, args): method get_tokenizers (line 182) | def get_tokenizers(self, tokenize_strategy: strategy_flux.FluxTokenize... method get_latents_caching_strategy (line 185) | def get_latents_caching_strategy(self, args): method get_text_encoding_strategy (line 189) | def get_text_encoding_strategy(self, args): method post_process_network (line 192) | def post_process_network(self, args, accelerator, network, text_encode... method get_models_for_text_encoding (line 201) | def get_models_for_text_encoding(self, args, accelerator, text_encoders): method get_text_encoders_train_flags (line 210) | def get_text_encoders_train_flags(self, args, text_encoders): method get_text_encoder_outputs_caching_strategy (line 213) | def get_text_encoder_outputs_caching_strategy(self, args): method cache_text_encoder_outputs_if_needed (line 226) | def cache_text_encoder_outputs_if_needed( method sample_images (line 293) | def sample_images(self, accelerator, args, epoch, global_step, device,... method get_noise_scheduler (line 301) | def get_noise_scheduler(self, args: argparse.Namespace, device: torch.... method encode_images_to_latents (line 306) | def encode_images_to_latents(self, args, vae, images): method shift_scale_latents (line 309) | def shift_scale_latents(self, args, latents): method get_noise_pred_and_target (line 312) | def get_noise_pred_and_target( method post_process_loss (line 436) | def post_process_loss(self, loss, args, timesteps, noise_scheduler): method get_sai_model_spec (line 439) | def get_sai_model_spec(self, args): method update_metadata (line 446) | def update_metadata(self, metadata, args): method is_text_encoder_not_needed_for_training (line 459) | def is_text_encoder_not_needed_for_training(self, args): method prepare_text_encoder_grad_ckpt_workaround (line 462) | def prepare_text_encoder_grad_ckpt_workaround(self, index, text_encoder): method prepare_text_encoder_fp8 (line 468) | def prepare_text_encoder_fp8(self, index, text_encoder, te_weight_dtyp... method on_validation_step_end (line 503) | def on_validation_step_end(self, args, accelerator, network, text_enco... method prepare_unet_with_accelerator (line 508) | def prepare_unet_with_accelerator( function setup_parser (line 523) | def setup_parser() -> argparse.ArgumentParser: FILE: gen_img.py function replace_unet_modules (line 94) | def replace_unet_modules(unet, mem_eff_attn, xformers, sdpa): function replace_vae_modules (line 115) | def replace_vae_modules(vae: diffusers.models.AutoencoderKL, mem_eff_att... function replace_vae_attn_to_memory_efficient (line 125) | def replace_vae_attn_to_memory_efficient(): function replace_vae_attn_to_xformers (line 181) | def replace_vae_attn_to_xformers(): function replace_vae_attn_to_sdpa (line 237) | def replace_vae_attn_to_sdpa(): class PipelineLike (line 298) | class PipelineLike: method __init__ (line 299) | def __init__( method add_token_replacement (line 366) | def add_token_replacement(self, text_encoder_index, target_token_id, r... method set_enable_control_net (line 369) | def set_enable_control_net(self, en: bool): method get_token_replacer (line 372) | def get_token_replacer(self, tokenizer): method set_control_nets (line 392) | def set_control_nets(self, ctrl_nets): method set_control_net_lllites (line 395) | def set_control_net_lllites(self, ctrl_net_lllites): method set_gradual_latent (line 398) | def set_gradual_latent(self, gradual_latent): method __call__ (line 407) | def __call__( function parse_prompt_attention (line 962) | def parse_prompt_attention(text): function get_prompts_with_weights (line 1051) | def get_prompts_with_weights(tokenizer: CLIPTokenizer, token_replacer, p... function pad_tokens_and_weights (line 1102) | def pad_tokens_and_weights(tokens, weights, max_length, bos, eos, pad, n... function get_unweighted_text_embeddings (line 1127) | def get_unweighted_text_embeddings( function get_weighted_text_embeddings (line 1194) | def get_weighted_text_embeddings( function preprocess_image (line 1338) | def preprocess_image(image): function preprocess_mask (line 1348) | def preprocess_mask(mask): function handle_dynamic_prompt_variants (line 1372) | def handle_dynamic_prompt_variants(prompt, repeat_count, seed_random, se... class BatchDataBase (line 1553) | class BatchDataBase(NamedTuple): class BatchDataExt (line 1567) | class BatchDataExt(NamedTuple): class BatchData (line 1585) | class BatchData(NamedTuple): class ListPrompter (line 1591) | class ListPrompter: method __init__ (line 1592) | def __init__(self, prompts: List[str]): method shuffle (line 1596) | def shuffle(self): method __len__ (line 1599) | def __len__(self): method __call__ (line 1602) | def __call__(self, *args, **kwargs): function main (line 1612) | def main(args): function setup_parser (line 3118) | def setup_parser() -> argparse.ArgumentParser: FILE: gen_img_diffusers.py function replace_unet_modules (line 146) | def replace_unet_modules(unet: diffusers.models.unet_2d_condition.UNet2D... function replace_vae_modules (line 167) | def replace_vae_modules(vae: diffusers.models.AutoencoderKL, mem_eff_att... function replace_vae_attn_to_memory_efficient (line 176) | def replace_vae_attn_to_memory_efficient(): function replace_vae_attn_to_xformers (line 232) | def replace_vae_attn_to_xformers(): function replace_vae_attn_to_sdpa (line 288) | def replace_vae_attn_to_sdpa(): class PipelineLike (line 349) | class PipelineLike: method __init__ (line 376) | def __init__( method add_token_replacement (line 461) | def add_token_replacement(self, target_token_id, rep_token_ids): method set_enable_control_net (line 464) | def set_enable_control_net(self, en: bool): method replace_token (line 467) | def replace_token(self, tokens, layer=None): method add_token_replacement_XTI (line 484) | def add_token_replacement_XTI(self, target_token_id, rep_token_ids): method set_control_nets (line 487) | def set_control_nets(self, ctrl_nets): method set_gradual_latent (line 490) | def set_gradual_latent(self, gradual_latent): method enable_xformers_memory_efficient_attention (line 500) | def enable_xformers_memory_efficient_attention(self): method disable_xformers_memory_efficient_attention (line 510) | def disable_xformers_memory_efficient_attention(self): method enable_attention_slicing (line 516) | def enable_attention_slicing(self, slice_size: Optional[Union[str, int... method disable_attention_slicing (line 533) | def disable_attention_slicing(self): method enable_sequential_cpu_offload (line 541) | def enable_sequential_cpu_offload(self): method __call__ (line 563) | def __call__( method text2img (line 1139) | def text2img( method img2img (line 1231) | def img2img( method inpaint (line 1322) | def inpaint( method cond_fn (line 1423) | def cond_fn( method cond_fn1 (line 1464) | def cond_fn1( method cond_fn_vgg16 (line 1534) | def cond_fn_vgg16(self, latents, timestep, index, text_embeddings, noi... method cond_fn_vgg16_b1 (line 1557) | def cond_fn_vgg16_b1(self, latents, timestep, index, text_embeddings, ... class MakeCutouts (line 1607) | class MakeCutouts(torch.nn.Module): method __init__ (line 1608) | def __init__(self, cut_size, cut_power=1.0): method forward (line 1614) | def forward(self, pixel_values, num_cutouts): function spherical_dist_loss (line 1628) | def spherical_dist_loss(x, y): function parse_prompt_attention (line 1654) | def parse_prompt_attention(text): function get_prompts_with_weights (line 1743) | def get_prompts_with_weights(pipe: PipelineLike, prompt: List[str], max_... function pad_tokens_and_weights (line 1794) | def pad_tokens_and_weights(tokens, weights, max_length, bos, eos, pad, n... function get_unweighted_text_embeddings (line 1819) | def get_unweighted_text_embeddings( function get_weighted_text_embeddings (line 1880) | def get_weighted_text_embeddings( function preprocess_guide_image (line 2024) | def preprocess_guide_image(image): function preprocess_vgg16_guide_image (line 2033) | def preprocess_vgg16_guide_image(image, size): function preprocess_image (line 2041) | def preprocess_image(image): function preprocess_mask (line 2051) | def preprocess_mask(mask): function handle_dynamic_prompt_variants (line 2075) | def handle_dynamic_prompt_variants(prompt, repeat_count): class BatchDataBase (line 2177) | class BatchDataBase(NamedTuple): class BatchDataExt (line 2190) | class BatchDataExt(NamedTuple): class BatchData (line 2202) | class BatchData(NamedTuple): function main (line 2208) | def main(args): function setup_parser (line 3489) | def setup_parser() -> argparse.ArgumentParser: FILE: hunyuan_image_minimal_inference.py class GenerationSettings (line 41) | class GenerationSettings: method __init__ (line 42) | def __init__(self, device: torch.device, dit_weight_dtype: Optional[to... function parse_args (line 47) | def parse_args() -> argparse.Namespace: function parse_prompt_line (line 169) | def parse_prompt_line(line: str) -> Dict[str, Any]: function apply_overrides (line 219) | def apply_overrides(args: argparse.Namespace, overrides: Dict[str, Any])... function check_inputs (line 242) | def check_inputs(args: argparse.Namespace) -> Tuple[int, int]: function load_dit_model (line 263) | def load_dit_model( function merge_lora_weights (line 374) | def merge_lora_weights( function decode_latent (line 464) | def decode_latent(vae: HunyuanVAE2D, latent: torch.Tensor, device: torch... function prepare_text_inputs (line 478) | def prepare_text_inputs( function generate (line 603) | def generate( function generate_body (line 655) | def generate_body( function get_time_flag (line 765) | def get_time_flag(): function save_latent (line 769) | def save_latent(latent: torch.Tensor, args: argparse.Namespace, height: ... function save_images (line 811) | def save_images(sample: torch.Tensor, args: argparse.Namespace, original... function save_output (line 842) | def save_output( function preprocess_prompts_for_batch (line 890) | def preprocess_prompts_for_batch(prompt_lines: List[str], base_args: arg... function load_shared_models (line 915) | def load_shared_models(args: argparse.Namespace) -> Dict: function process_batch_prompts (line 942) | def process_batch_prompts(prompts_data: List[Dict], args: argparse.Names... function process_interactive (line 1086) | def process_interactive(args: argparse.Namespace) -> None: function get_generation_settings (line 1155) | def get_generation_settings(args: argparse.Namespace) -> GenerationSetti... function main (line 1170) | def main(): FILE: hunyuan_image_train_network.py function sample_images (line 44) | def sample_images( function sample_image_inference (line 147) | def sample_image_inference( class HunyuanImageNetworkTrainer (line 309) | class HunyuanImageNetworkTrainer(train_network.NetworkTrainer): method __init__ (line 310) | def __init__(self): method assert_extra_args (line 316) | def assert_extra_args( method load_target_model (line 356) | def load_target_model(self, args, weight_dtype, accelerator): method load_unet_lazily (line 377) | def load_unet_lazily(self, args, weight_dtype, accelerator, text_encod... method get_tokenize_strategy (line 413) | def get_tokenize_strategy(self, args): method get_tokenizers (line 416) | def get_tokenizers(self, tokenize_strategy: strategy_hunyuan_image.Hun... method get_latents_caching_strategy (line 419) | def get_latents_caching_strategy(self, args): method get_text_encoding_strategy (line 422) | def get_text_encoding_strategy(self, args): method post_process_network (line 425) | def post_process_network(self, args, accelerator, network, text_encode... method get_models_for_text_encoding (line 428) | def get_models_for_text_encoding(self, args, accelerator, text_encoders): method get_text_encoders_train_flags (line 434) | def get_text_encoders_train_flags(self, args, text_encoders): method get_text_encoder_outputs_caching_strategy (line 438) | def get_text_encoder_outputs_caching_strategy(self, args): method cache_text_encoder_outputs_if_needed (line 446) | def cache_text_encoder_outputs_if_needed( method sample_images (line 504) | def sample_images(self, accelerator, args, epoch, global_step, device,... method get_noise_scheduler (line 510) | def get_noise_scheduler(self, args: argparse.Namespace, device: torch.... method encode_images_to_latents (line 515) | def encode_images_to_latents(self, args, vae: hunyuan_image_vae.Hunyua... method shift_scale_latents (line 518) | def shift_scale_latents(self, args, latents): method get_noise_pred_and_target (line 522) | def get_noise_pred_and_target( method post_process_loss (line 579) | def post_process_loss(self, loss, args, timesteps, noise_scheduler): method get_sai_model_spec (line 582) | def get_sai_model_spec(self, args): method update_metadata (line 585) | def update_metadata(self, metadata, args): method is_text_encoder_not_needed_for_training (line 594) | def is_text_encoder_not_needed_for_training(self, args): method prepare_text_encoder_grad_ckpt_workaround (line 597) | def prepare_text_encoder_grad_ckpt_workaround(self, index, text_encoder): method cast_text_encoder (line 601) | def cast_text_encoder(self, args): method cast_vae (line 604) | def cast_vae(self, args): method cast_unet (line 607) | def cast_unet(self, args): method prepare_text_encoder_fp8 (line 610) | def prepare_text_encoder_fp8(self, index, text_encoder, te_weight_dtyp... method on_validation_step_end (line 614) | def on_validation_step_end(self, args, accelerator, network, text_enco... method prepare_unet_with_accelerator (line 619) | def prepare_unet_with_accelerator( function setup_parser (line 634) | def setup_parser() -> argparse.ArgumentParser: FILE: library/adafactor_fused.py function copy_stochastic_ (line 8) | def copy_stochastic_(target: torch.Tensor, source: torch.Tensor): function adafactor_step_param (line 32) | def adafactor_step_param(self, p, group): function adafactor_step (line 117) | def adafactor_step(self, closure=None): function patch_adafactor_fused (line 136) | def patch_adafactor_fused(optimizer: Adafactor): FILE: library/anima_models.py function to_device (line 19) | def to_device(x, device): function to_cpu (line 30) | def to_cpu(x): function detach_variable (line 47) | def detach_variable(inputs, device=None): class UnslothOffloadedGradientCheckpointer (line 75) | class UnslothOffloadedGradientCheckpointer(torch.autograd.Function): method forward (line 84) | def forward(ctx, forward_function, hidden_states, *args): method backward (line 100) | def backward(ctx, *grads): function unsloth_checkpoint (line 122) | def unsloth_checkpoint(function, *args): function _rotate_half (line 136) | def _rotate_half(x: torch.Tensor, interleaved: bool) -> torch.Tensor: function _apply_rotary_pos_emb_base (line 146) | def _apply_rotary_pos_emb_base( function apply_rotary_pos_emb (line 175) | def apply_rotary_pos_emb( class RMSNorm (line 222) | class RMSNorm(torch.nn.Module): method __init__ (line 225) | def __init__(self, dim: int, eps: float = 1e-5) -> None: method reset_parameters (line 230) | def reset_parameters(self) -> None: method _norm (line 233) | def _norm(self, x: torch.Tensor) -> torch.Tensor: method forward (line 236) | def forward(self, x: torch.Tensor) -> torch.Tensor: class GPT2FeedForward (line 242) | class GPT2FeedForward(nn.Module): method __init__ (line 245) | def __init__(self, d_model: int, d_ff: int) -> None: method init_weights (line 256) | def init_weights(self) -> None: method forward (line 265) | def forward(self, x: torch.Tensor) -> torch.Tensor: class Attention (line 273) | class Attention(nn.Module): method __init__ (line 279) | def __init__( method init_weights (line 317) | def init_weights(self) -> None: method compute_qkv (line 331) | def compute_qkv( method forward (line 355) | def forward( class VideoPositionEmb (line 377) | class VideoPositionEmb(nn.Module): method __init__ (line 378) | def __init__(self) -> None: method seq_dim (line 382) | def seq_dim(self) -> int: method forward (line 385) | def forward(self, x_B_T_H_W_C: torch.Tensor, fps: Optional[torch.Tenso... method generate_embeddings (line 390) | def generate_embeddings(self, B_T_H_W_C: torch.Size, fps: Optional[tor... class VideoRopePosition3DEmb (line 394) | class VideoRopePosition3DEmb(VideoPositionEmb): method __init__ (line 397) | def __init__( method reset_parameters (line 442) | def reset_parameters(self) -> None: method generate_embeddings (line 450) | def generate_embeddings( method seq_dim (line 504) | def seq_dim(self) -> int: class LearnablePosEmbAxis (line 508) | class LearnablePosEmbAxis(VideoPositionEmb): method __init__ (line 511) | def __init__( method reset_parameters (line 533) | def reset_parameters(self) -> None: method generate_embeddings (line 539) | def generate_embeddings(self, B_T_H_W_C: torch.Size, fps: Optional[tor... class Timesteps (line 560) | class Timesteps(nn.Module): method __init__ (line 563) | def __init__(self, num_channels: int): method forward (line 567) | def forward(self, timesteps_B_T: torch.Tensor) -> torch.Tensor: class TimestepEmbedding (line 585) | class TimestepEmbedding(nn.Module): method __init__ (line 588) | def __init__(self, in_features: int, out_features: int, use_adaln_lora... method init_weights (line 602) | def init_weights(self) -> None: method forward (line 608) | def forward(self, sample: torch.Tensor) -> Tuple[torch.Tensor, Optiona... class PatchEmbed (line 650) | class PatchEmbed(nn.Module): method __init__ (line 653) | def __init__( method init_weights (line 677) | def init_weights(self) -> None: method forward (line 681) | def forward(self, x: torch.Tensor) -> torch.Tensor: class FinalLayer (line 693) | class FinalLayer(nn.Module): method __init__ (line 696) | def __init__( method init_weights (line 725) | def init_weights(self) -> None: method forward (line 736) | def forward( class Block (line 759) | class Block(nn.Module): method __init__ (line 765) | def __init__( method enable_gradient_checkpointing (line 823) | def enable_gradient_checkpointing(self, cpu_offload: bool = False, uns... method disable_gradient_checkpointing (line 828) | def disable_gradient_checkpointing(self): method reset_parameters (line 833) | def reset_parameters(self) -> None: method init_weights (line 851) | def init_weights(self) -> None: method _forward (line 857) | def _forward( method forward (line 947) | def forward( class Anima (line 1019) | class Anima(nn.Module): method __init__ (line 1027) | def __init__( method init_weights (line 1139) | def init_weights(self) -> None: method enable_gradient_checkpointing (line 1150) | def enable_gradient_checkpointing(self, cpu_offload: bool = False, uns... method disable_gradient_checkpointing (line 1154) | def disable_gradient_checkpointing(self): method device (line 1159) | def device(self): method dtype (line 1163) | def dtype(self): method build_patch_embed (line 1166) | def build_patch_embed(self) -> None: method build_pos_embed (line 1175) | def build_pos_embed(self) -> None: method prepare_embedded_sequence (line 1204) | def prepare_embedded_sequence( method unpatchify (line 1230) | def unpatchify(self, x_B_T_H_W_M: torch.Tensor) -> torch.Tensor: method enable_block_swap (line 1240) | def enable_block_swap(self, num_blocks: int, device: torch.device): method move_to_device_except_swap_blocks (line 1250) | def move_to_device_except_swap_blocks(self, device: torch.device): method switch_block_swap_for_inference (line 1261) | def switch_block_swap_for_inference(self): method switch_block_swap_for_training (line 1268) | def switch_block_swap_for_training(self): method prepare_block_swap_before_forward (line 1275) | def prepare_block_swap_before_forward(self): method forward_mini_train_dit (line 1280) | def forward_mini_train_dit( method forward (line 1345) | def forward( method _preprocess_text_embeds (line 1360) | def _preprocess_text_embeds( class LLMAdapterRMSNorm (line 1377) | class LLMAdapterRMSNorm(nn.Module): method __init__ (line 1380) | def __init__(self, hidden_size, eps=1e-6): method forward (line 1385) | def forward(self, hidden_states): function _adapter_rotate_half (line 1395) | def _adapter_rotate_half(x): function _adapter_apply_rotary_pos_emb (line 1401) | def _adapter_apply_rotary_pos_emb(x, cos, sin, unsqueeze_dim=1): class AdapterRotaryEmbedding (line 1408) | class AdapterRotaryEmbedding(nn.Module): method __init__ (line 1411) | def __init__(self, head_dim): method forward (line 1418) | def forward(self, x, position_ids): class LLMAdapterAttention (line 1432) | class LLMAdapterAttention(nn.Module): method __init__ (line 1435) | def __init__(self, query_dim, context_dim, n_heads, head_dim): method forward (line 1454) | def forward(self, x, mask=None, context=None, position_embeddings=None... class LLMAdapterTransformerBlock (line 1479) | class LLMAdapterTransformerBlock(nn.Module): method __init__ (line 1482) | def __init__(self, source_dim, model_dim, num_heads=16, mlp_ratio=4.0,... method forward (line 1508) | def forward( method init_weights (line 1541) | def init_weights(self): class LLMAdapter (line 1545) | class LLMAdapter(nn.Module): method __init__ (line 1551) | def __init__( method forward (line 1573) | def forward(self, source_hidden_states, target_input_ids, target_atten... FILE: library/anima_train_utils.py function add_anima_training_arguments (line 32) | def add_anima_training_arguments(parser: argparse.ArgumentParser): function compute_loss_weighting_for_anima (line 143) | def compute_loss_weighting_for_anima(weighting_scheme: str, sigmas: torc... function get_anima_param_groups (line 161) | def get_anima_param_groups( function save_anima_model_on_train_end (line 250) | def save_anima_model_on_train_end( function save_anima_model_on_epoch_end_or_stepwise (line 270) | def save_anima_model_on_epoch_end_or_stepwise( function do_sample (line 304) | def do_sample( function sample_images (line 384) | def sample_images( function _sample_image_inference (line 466) | def _sample_image_inference( FILE: library/anima_utils.py function load_anima_model (line 32) | def load_anima_model( function load_qwen3_tokenizer (line 151) | def load_qwen3_tokenizer(qwen3_path: str): function load_qwen3_text_encoder (line 181) | def load_qwen3_text_encoder( function load_t5_tokenizer (line 260) | def load_t5_tokenizer(t5_tokenizer_path: Optional[str] = None): function save_anima_model (line 286) | def save_anima_model( FILE: library/attention.py class AttentionParams (line 31) | class AttentionParams: method supports_fp32 (line 41) | def supports_fp32(self) -> bool: method requires_same_dtype (line 45) | def requires_same_dtype(self) -> bool: method create_attention_params (line 49) | def create_attention_params(attn_mode: Optional[str], split_attn: bool... method create_attention_params_from_mask (line 53) | def create_attention_params_from_mask( function attention (line 89) | def attention( FILE: library/attention_processors.py class FlashAttentionFunction (line 15) | class FlashAttentionFunction(torch.autograd.function.Function): method forward (line 18) | def forward(ctx, q, k, v, mask, causal, q_bucket_size, k_bucket_size): method backward (line 111) | def backward(ctx, do): class FlashAttnProcessor (line 182) | class FlashAttnProcessor: method __call__ (line 183) | def __call__( FILE: library/chroma_models.py function distribute_modulations (line 18) | def distribute_modulations(tensor: torch.Tensor, depth_single_blocks, de... class Approximator (line 103) | class Approximator(nn.Module): method __init__ (line 104) | def __init__(self, in_dim: int, out_dim: int, hidden_dim: int, n_layer... method device (line 112) | def device(self): method enable_gradient_checkpointing (line 116) | def enable_gradient_checkpointing(self): method disable_gradient_checkpointing (line 120) | def disable_gradient_checkpointing(self): method forward (line 124) | def forward(self, x: Tensor) -> Tensor: class ModulationOut (line 136) | class ModulationOut: function _modulation_shift_scale_fn (line 142) | def _modulation_shift_scale_fn(x, scale, shift): function _modulation_gate_fn (line 146) | def _modulation_gate_fn(x, gate, gate_params): class DoubleStreamBlock (line 150) | class DoubleStreamBlock(nn.Module): method __init__ (line 151) | def __init__( method device (line 194) | def device(self): method modulation_shift_scale_fn (line 198) | def modulation_shift_scale_fn(self, x, scale, shift): method modulation_gate_fn (line 201) | def modulation_gate_fn(self, x, gate, gate_params): method enable_gradient_checkpointing (line 204) | def enable_gradient_checkpointing(self): method disable_gradient_checkpointing (line 207) | def disable_gradient_checkpointing(self): method _forward (line 210) | def _forward( method forward (line 318) | def forward( class SingleStreamBlock (line 332) | class SingleStreamBlock(nn.Module): method __init__ (line 338) | def __init__( method device (line 367) | def device(self): method modulation_shift_scale_fn (line 371) | def modulation_shift_scale_fn(self, x, scale, shift): method modulation_gate_fn (line 374) | def modulation_gate_fn(self, x, gate, gate_params): method enable_gradient_checkpointing (line 377) | def enable_gradient_checkpointing(self): method disable_gradient_checkpointing (line 380) | def disable_gradient_checkpointing(self): method _forward (line 383) | def _forward(self, x: Tensor, pe: list[Tensor], distill_vec: list[Modu... method forward (line 429) | def forward(self, x: Tensor, pe: Tensor, distill_vec: list[ModulationO... class LastLayer (line 436) | class LastLayer(nn.Module): method __init__ (line 437) | def __init__( method device (line 448) | def device(self): method modulation_shift_scale_fn (line 452) | def modulation_shift_scale_fn(self, x, scale, shift): method forward (line 455) | def forward(self, x: Tensor, distill_vec: list[Tensor]) -> Tensor: class ChromaParams (line 467) | class ChromaParams: function modify_mask_to_attend_padding (line 504) | def modify_mask_to_attend_padding(mask, max_seq_length, num_extra_paddin... class Chroma (line 537) | class Chroma(Flux): method __init__ (line 542) | def __init__(self, params: ChromaParams): method get_model_type (line 621) | def get_model_type(self) -> str: method enable_gradient_checkpointing (line 624) | def enable_gradient_checkpointing(self, cpu_offload: bool = False): method disable_gradient_checkpointing (line 634) | def disable_gradient_checkpointing(self): method get_mod_vectors (line 644) | def get_mod_vectors(self, timesteps: Tensor, guidance: Tensor | None =... method forward (line 664) | def forward( FILE: library/config_util.py function add_config_arguments (line 45) | def add_config_arguments(parser: argparse.ArgumentParser): class BaseSubsetParams (line 55) | class BaseSubsetParams: class DreamBoothSubsetParams (line 82) | class DreamBoothSubsetParams(BaseSubsetParams): class FineTuningSubsetParams (line 91) | class FineTuningSubsetParams(BaseSubsetParams): class ControlNetSubsetParams (line 97) | class ControlNetSubsetParams(BaseSubsetParams): class BaseDatasetParams (line 104) | class BaseDatasetParams: class DreamBoothDatasetParams (line 113) | class DreamBoothDatasetParams(BaseDatasetParams): class FineTuningDatasetParams (line 123) | class FineTuningDatasetParams(BaseDatasetParams): class ControlNetDatasetParams (line 133) | class ControlNetDatasetParams(BaseDatasetParams): class SubsetBlueprint (line 143) | class SubsetBlueprint: class DatasetBlueprint (line 148) | class DatasetBlueprint: class DatasetGroupBlueprint (line 156) | class DatasetGroupBlueprint: class Blueprint (line 161) | class Blueprint: class ConfigSanitizer (line 165) | class ConfigSanitizer: method __validate_and_convert_twodim (line 168) | def __validate_and_convert_twodim(klass, value: Sequence) -> Tuple: method __validate_and_convert_scalar_or_twodim (line 174) | def __validate_and_convert_scalar_or_twodim(klass, value: Union[float,... method __init__ (line 266) | def __init__(self, support_dreambooth: bool, support_finetuning: bool,... method sanitize_user_config (line 370) | def sanitize_user_config(self, user_config: dict) -> dict: method sanitize_argparse_namespace (line 380) | def sanitize_argparse_namespace(self, argparse_namespace: argparse.Nam... method __merge_dict (line 392) | def __merge_dict(*dict_list: dict) -> dict: class BlueprintGenerator (line 401) | class BlueprintGenerator: method __init__ (line 404) | def __init__(self, sanitizer: ConfigSanitizer): method generate (line 408) | def generate(self, user_config: dict, argparse_namespace: argparse.Nam... method generate_params_by_fallbacks (line 454) | def generate_params_by_fallbacks(param_klass, fallbacks: Sequence[dict]): method search_value (line 465) | def search_value(key: str, fallbacks: Sequence[dict], default_value=No... function generate_dataset_group_by_blueprint (line 473) | def generate_dataset_group_by_blueprint(dataset_group_blueprint: Dataset... function generate_dreambooth_subsets_config_by_subdirs (line 607) | def generate_dreambooth_subsets_config_by_subdirs(train_data_dir: Option... function generate_controlnet_subsets_config_by_subdirs (line 647) | def generate_controlnet_subsets_config_by_subdirs( function load_user_config (line 675) | def load_user_config(file: str) -> dict: FILE: library/custom_offloading_utils.py function _clean_memory_on_device (line 10) | def _clean_memory_on_device(device: torch.device): function _synchronize_device (line 25) | def _synchronize_device(device: torch.device): function swap_weight_devices_cuda (line 34) | def swap_weight_devices_cuda(device: torch.device, layer_to_cpu: nn.Modu... function swap_weight_devices_no_cuda (line 78) | def swap_weight_devices_no_cuda(device: torch.device, layer_to_cpu: nn.M... function weighs_to_device (line 103) | def weighs_to_device(layer: nn.Module, device: torch.device): class Offloader (line 109) | class Offloader: method __init__ (line 114) | def __init__(self, num_blocks: int, blocks_to_swap: int, device: torch... method swap_weight_devices (line 124) | def swap_weight_devices(self, block_to_cpu: nn.Module, block_to_cuda: ... method _submit_move_blocks (line 130) | def _submit_move_blocks(self, blocks, block_idx_to_cpu, block_idx_to_c... method _wait_blocks_move (line 149) | def _wait_blocks_move(self, block_idx): class ModelOffloader (line 170) | class ModelOffloader(Offloader): method __init__ (line 175) | def __init__( method set_forward_only (line 197) | def set_forward_only(self, forward_only: bool): method __del__ (line 203) | def __del__(self): method create_backward_hook (line 208) | def create_backward_hook( method prepare_block_devices_before_forward (line 236) | def prepare_block_devices_before_forward(self, blocks: Union[list[nn.M... method wait_for_block (line 258) | def wait_for_block(self, block_idx: int): method submit_move_blocks (line 263) | def submit_move_blocks(self, blocks: Union[list[nn.Module], nn.ModuleL... function to_device (line 284) | def to_device(x: Any, device: torch.device) -> Any: function to_cpu (line 297) | def to_cpu(x: Any) -> Any: function create_cpu_offloading_wrapper (line 320) | def create_cpu_offloading_wrapper(func: Callable, device: torch.device) ... FILE: library/custom_train_functions.py function prepare_scheduler_for_custom_training (line 16) | def prepare_scheduler_for_custom_training(noise_scheduler, device): function fix_noise_scheduler_betas_for_zero_terminal_snr (line 30) | def fix_noise_scheduler_betas_for_zero_terminal_snr(noise_scheduler): function apply_snr_weight (line 68) | def apply_snr_weight(loss: torch.Tensor, timesteps: torch.IntTensor, noi... function scale_v_prediction_loss_like_noise_prediction (line 79) | def scale_v_prediction_loss_like_noise_prediction(loss: torch.Tensor, ti... function get_snr_scale (line 85) | def get_snr_scale(timesteps: torch.IntTensor, noise_scheduler: DDPMSched... function add_v_prediction_like_loss (line 94) | def add_v_prediction_like_loss(loss: torch.Tensor, timesteps: torch.IntT... function apply_debiased_estimation (line 101) | def apply_debiased_estimation(loss: torch.Tensor, timesteps: torch.IntTe... function add_custom_train_arguments (line 115) | def add_custom_train_arguments(parser: argparse.ArgumentParser, support_... function parse_prompt_attention (line 167) | def parse_prompt_attention(text): function get_prompts_with_weights (line 253) | def get_prompts_with_weights(tokenizer, prompt: List[str], max_length: i... function pad_tokens_and_weights (line 288) | def pad_tokens_and_weights(tokens, weights, max_length, bos, eos, no_bos... function get_unweighted_text_embeddings (line 313) | def get_unweighted_text_embeddings( function get_weighted_text_embeddings (line 375) | def get_weighted_text_embeddings( function pyramid_noise_like (line 458) | def pyramid_noise_like(noise, device, iterations=6, discount=0.4) -> tor... function apply_noise_offset (line 471) | def apply_noise_offset(latents, noise, noise_offset, adaptive_noise_scal... function apply_masked_loss (line 487) | def apply_masked_loss(loss, batch) -> torch.FloatTensor: FILE: library/deepspeed_utils.py function add_deepspeed_arguments (line 16) | def add_deepspeed_arguments(parser: argparse.ArgumentParser): function prepare_deepspeed_args (line 64) | def prepare_deepspeed_args(args: argparse.Namespace): function prepare_deepspeed_plugin (line 72) | def prepare_deepspeed_plugin(args: argparse.Namespace): function prepare_deepspeed_model (line 121) | def prepare_deepspeed_model(args: argparse.Namespace, **models): FILE: library/device_utils.py function clean_memory (line 32) | def clean_memory(): function clean_memory_on_device (line 42) | def clean_memory_on_device(device: Optional[Union[str, torch.device]]): function synchronize_device (line 60) | def synchronize_device(device: Optional[Union[str, torch.device]]): function get_preferred_device (line 74) | def get_preferred_device() -> torch.device: function init_ipex (line 90) | def init_ipex(): FILE: library/flux_models.py class FluxParams (line 28) | class FluxParams: class AutoEncoderParams (line 47) | class AutoEncoderParams: function swish (line 59) | def swish(x: Tensor) -> Tensor: class AttnBlock (line 63) | class AttnBlock(nn.Module): method __init__ (line 64) | def __init__(self, in_channels: int): method attention (line 75) | def attention(self, h_: Tensor) -> Tensor: method forward (line 89) | def forward(self, x: Tensor) -> Tensor: class ResnetBlock (line 93) | class ResnetBlock(nn.Module): method __init__ (line 94) | def __init__(self, in_channels: int, out_channels: int): method forward (line 107) | def forward(self, x): class Downsample (line 123) | class Downsample(nn.Module): method __init__ (line 124) | def __init__(self, in_channels: int): method forward (line 129) | def forward(self, x: Tensor): class Upsample (line 136) | class Upsample(nn.Module): method __init__ (line 137) | def __init__(self, in_channels: int): method forward (line 141) | def forward(self, x: Tensor): class Encoder (line 147) | class Encoder(nn.Module): method __init__ (line 148) | def __init__( method forward (line 197) | def forward(self, x: Tensor) -> Tensor: class Decoder (line 221) | class Decoder(nn.Module): method __init__ (line 222) | def __init__( method forward (line 275) | def forward(self, z: Tensor) -> Tensor: class DiagonalGaussian (line 300) | class DiagonalGaussian(nn.Module): method __init__ (line 301) | def __init__(self, sample: bool = True, chunk_dim: int = 1): method forward (line 306) | def forward(self, z: Tensor) -> Tensor: class AutoEncoder (line 315) | class AutoEncoder(nn.Module): method __init__ (line 316) | def __init__(self, params: AutoEncoderParams): method device (line 341) | def device(self) -> torch.device: method dtype (line 345) | def dtype(self) -> torch.dtype: method encode (line 348) | def encode(self, x: Tensor) -> Tensor: method decode (line 353) | def decode(self, z: Tensor) -> Tensor: method forward (line 357) | def forward(self, x: Tensor) -> Tensor: class ModelSpec (line 366) | class ModelSpec: function attention (line 449) | def attention(q: Tensor, k: Tensor, v: Tensor, pe: Tensor, attn_mask: Op... function rope (line 458) | def rope(pos: Tensor, dim: int, theta: int) -> Tensor: function apply_rope (line 468) | def apply_rope(xq: Tensor, xk: Tensor, freqs_cis: Tensor) -> tuple[Tenso... function to_cuda (line 485) | def to_cuda(x): function to_cpu (line 496) | def to_cpu(x): class EmbedND (line 507) | class EmbedND(nn.Module): method __init__ (line 508) | def __init__(self, dim: int, theta: int, axes_dim: list[int]): method forward (line 514) | def forward(self, ids: Tensor) -> Tensor: function timestep_embedding (line 524) | def timestep_embedding(t: Tensor, dim, max_period=10000, time_factor: fl... class MLPEmbedder (line 546) | class MLPEmbedder(nn.Module): method __init__ (line 547) | def __init__(self, in_dim: int, hidden_dim: int): method enable_gradient_checkpointing (line 555) | def enable_gradient_checkpointing(self): method disable_gradient_checkpointing (line 558) | def disable_gradient_checkpointing(self): method _forward (line 561) | def _forward(self, x: Tensor) -> Tensor: method forward (line 564) | def forward(self, *args, **kwargs): class RMSNorm (line 581) | class RMSNorm(torch.nn.Module): method __init__ (line 582) | def __init__(self, dim: int): method forward (line 586) | def forward(self, x: Tensor): class QKNorm (line 594) | class QKNorm(torch.nn.Module): method __init__ (line 595) | def __init__(self, dim: int): method forward (line 600) | def forward(self, q: Tensor, k: Tensor, v: Tensor) -> tuple[Tensor, Te... class SelfAttention (line 606) | class SelfAttention(nn.Module): method __init__ (line 607) | def __init__(self, dim: int, num_heads: int = 8, qkv_bias: bool = False): method forward (line 617) | def forward(self, x: Tensor, pe: Tensor) -> Tensor: class ModulationOut (line 627) | class ModulationOut: class Modulation (line 633) | class Modulation(nn.Module): method __init__ (line 634) | def __init__(self, dim: int, double: bool): method forward (line 640) | def forward(self, vec: Tensor) -> tuple[ModulationOut, ModulationOut |... class DoubleStreamBlock (line 649) | class DoubleStreamBlock(nn.Module): method __init__ (line 650) | def __init__(self, hidden_size: int, num_heads: int, mlp_ratio: float,... method enable_gradient_checkpointing (line 681) | def enable_gradient_checkpointing(self, cpu_offload: bool = False): method disable_gradient_checkpointing (line 685) | def disable_gradient_checkpointing(self): method _forward (line 689) | def _forward( method forward (line 738) | def forward( class SingleStreamBlock (line 762) | class SingleStreamBlock(nn.Module): method __init__ (line 768) | def __init__( method enable_gradient_checkpointing (line 798) | def enable_gradient_checkpointing(self, cpu_offload: bool = False): method disable_gradient_checkpointing (line 802) | def disable_gradient_checkpointing(self): method _forward (line 806) | def _forward(self, x: Tensor, vec: Tensor, pe: Tensor, txt_attention_m... method forward (line 839) | def forward(self, x: Tensor, vec: Tensor, pe: Tensor, txt_attention_ma... class LastLayer (line 861) | class LastLayer(nn.Module): method __init__ (line 862) | def __init__(self, hidden_size: int, patch_size: int, out_channels: int): method forward (line 868) | def forward(self, x: Tensor, vec: Tensor) -> Tensor: class Flux (line 878) | class Flux(nn.Module): method __init__ (line 883) | def __init__(self, params: FluxParams): method get_model_type (line 933) | def get_model_type(self) -> str: method device (line 937) | def device(self): method dtype (line 941) | def dtype(self): method enable_gradient_checkpointing (line 944) | def enable_gradient_checkpointing(self, cpu_offload: bool = False): method disable_gradient_checkpointing (line 958) | def disable_gradient_checkpointing(self): method enable_block_swap (line 972) | def enable_block_swap(self, num_blocks: int, device: torch.device): method move_to_device_except_swap_blocks (line 992) | def move_to_device_except_swap_blocks(self, device: torch.device): method prepare_block_swap_before_forward (line 1006) | def prepare_block_swap_before_forward(self): method get_mod_vectors (line 1012) | def get_mod_vectors(self, timesteps: Tensor, guidance: Tensor | None =... method forward (line 1015) | def forward( function zero_module (line 1092) | def zero_module(module): class ControlNetFlux (line 1098) | class ControlNetFlux(nn.Module): method __init__ (line 1103) | def __init__(self, params: FluxParams, controlnet_depth=2, controlnet_... method device (line 1183) | def device(self): method dtype (line 1187) | def dtype(self): method enable_gradient_checkpointing (line 1190) | def enable_gradient_checkpointing(self, cpu_offload: bool = False): method disable_gradient_checkpointing (line 1204) | def disable_gradient_checkpointing(self): method enable_block_swap (line 1218) | def enable_block_swap(self, num_blocks: int, device: torch.device): method move_to_device_except_swap_blocks (line 1238) | def move_to_device_except_swap_blocks(self, device: torch.device): method prepare_block_swap_before_forward (line 1252) | def prepare_block_swap_before_forward(self): method forward (line 1258) | def forward( FILE: library/flux_train_utils.py function sample_images (line 34) | def sample_images( function sample_image_inference (line 139) | def sample_image_inference( function time_shift (line 306) | def time_shift(mu: float, sigma: float, t: torch.Tensor): function get_lin_function (line 310) | def get_lin_function(x1: float = 256, y1: float = 0.5, x2: float = 4096,... function get_schedule (line 316) | def get_schedule( function denoise (line 335) | def denoise( function get_sigmas (line 423) | def get_sigmas(noise_scheduler, timesteps, device, n_dim=4, dtype=torch.... function compute_density_for_timestep_sampling (line 433) | def compute_density_for_timestep_sampling( function compute_loss_weighting_for_sd3 (line 454) | def compute_loss_weighting_for_sd3(weighting_scheme: str, sigmas=None): function get_noisy_model_input_and_timesteps (line 471) | def get_noisy_model_input_and_timesteps( function apply_model_prediction_type (line 532) | def apply_model_prediction_type(args, model_pred, noisy_model_input, sig... function save_models (line 550) | def save_models( function save_flux_model_on_train_end (line 574) | def save_flux_model_on_train_end( function save_flux_model_on_epoch_end_or_stepwise (line 586) | def save_flux_model_on_epoch_end_or_stepwise( function add_flux_train_arguments (line 617) | def add_flux_train_arguments(parser: argparse.ArgumentParser): FILE: library/flux_utils.py function analyze_checkpoint_state (line 29) | def analyze_checkpoint_state(ckpt_path: str) -> Tuple[bool, bool, Tuple[... function load_flow_model (line 95) | def load_flow_model( function load_ae (line 176) | def load_ae( function load_controlnet (line 191) | def load_controlnet( function dummy_clip_l (line 207) | def dummy_clip_l() -> torch.nn.Module: class DummyTextModel (line 214) | class DummyTextModel(torch.nn.Module): method __init__ (line 215) | def __init__(self): class DummyCLIPL (line 220) | class DummyCLIPL(torch.nn.Module): method __init__ (line 221) | def __init__(self): method device (line 232) | def device(self): method dtype (line 236) | def dtype(self): method forward (line 239) | def forward(self, *args, **kwargs): function load_clip_l (line 247) | def load_clip_l( function load_t5xxl (line 357) | def load_t5xxl( function get_t5xxl_actual_dtype (line 412) | def get_t5xxl_actual_dtype(t5xxl: T5EncoderModel) -> torch.dtype: function prepare_img_ids (line 417) | def prepare_img_ids(batch_size: int, packed_latent_height: int, packed_l... function unpack_latents (line 425) | def unpack_latents(x: torch.Tensor, packed_latent_height: int, packed_la... function pack_latents (line 433) | def pack_latents(x: torch.Tensor) -> torch.Tensor: function make_diffusers_to_bfl_map (line 503) | def make_diffusers_to_bfl_map(num_double_blocks: int, num_single_blocks:... function convert_diffusers_sd_to_bfl (line 525) | def convert_diffusers_sd_to_bfl( FILE: library/fp8_optimization_utils.py function calculate_fp8_maxval (line 21) | def calculate_fp8_maxval(exp_bits=4, mantissa_bits=3, sign_bits=1): function quantize_fp8 (line 60) | def quantize_fp8(tensor, scale, fp8_dtype, max_value, min_value): function optimize_state_dict_with_fp8 (line 88) | def optimize_state_dict_with_fp8( function quantize_weight (line 177) | def quantize_weight( function load_safetensors_with_fp8_optimization (line 239) | def load_safetensors_with_fp8_optimization( function fp8_linear_forward_patch (line 355) | def fp8_linear_forward_patch(self: nn.Linear, x, use_scaled_mm=False, ma... function apply_fp8_monkey_patch (line 428) | def apply_fp8_monkey_patch(model, optimized_state_dict, use_scaled_mm=Fa... FILE: library/huggingface_util.py function exists_repo (line 12) | def exists_repo(repo_id: str, repo_type: str, revision: str = "main", to... function upload (line 23) | def upload( function list_dir (line 72) | def list_dir( FILE: library/hunyuan_image_models.py class HYImageDiffusionTransformer (line 43) | class HYImageDiffusionTransformer(nn.Module): method __init__ (line 54) | def __init__(self, attn_mode: str = "torch", split_attn: bool = False): method device (line 147) | def device(self): method dtype (line 151) | def dtype(self): method enable_gradient_checkpointing (line 154) | def enable_gradient_checkpointing(self, cpu_offload: bool = False): method disable_gradient_checkpointing (line 163) | def disable_gradient_checkpointing(self): method enable_block_swap (line 172) | def enable_block_swap(self, num_blocks: int, device: torch.device, sup... method switch_block_swap_for_inference (line 193) | def switch_block_swap_for_inference(self): method switch_block_swap_for_training (line 200) | def switch_block_swap_for_training(self): method move_to_device_except_swap_blocks (line 207) | def move_to_device_except_swap_blocks(self, device: torch.device): method prepare_block_swap_before_forward (line 221) | def prepare_block_swap_before_forward(self): method get_rotary_pos_embed (line 227) | def get_rotary_pos_embed(self, rope_sizes): method reorder_txt_token (line 240) | def reorder_txt_token( method forward (line 291) | def forward( method unpatchify_2d (line 393) | def unpatchify_2d(self, x, h, w): function create_model (line 417) | def create_model(attn_mode: str, split_attn: bool, dtype: Optional[torch... function load_hunyuan_image_model (line 425) | def load_hunyuan_image_model( FILE: library/hunyuan_image_modules.py class ByT5Mapper (line 17) | class ByT5Mapper(nn.Module): method __init__ (line 32) | def __init__(self, in_dim, out_dim, hidden_dim, out_dim1, use_residual... method forward (line 43) | def forward(self, x): class PatchEmbed2D (line 65) | class PatchEmbed2D(nn.Module): method __init__ (line 78) | def __init__(self, patch_size=16, in_chans=3, embed_dim=768): method forward (line 85) | def forward(self, x): class TimestepEmbedder (line 92) | class TimestepEmbedder(nn.Module): method __init__ (line 106) | def __init__(self, hidden_size, act_layer, frequency_embedding_size=25... method forward (line 117) | def forward(self, t): class TextProjection (line 122) | class TextProjection(nn.Module): method __init__ (line 134) | def __init__(self, in_channels, hidden_size, act_layer): method forward (line 140) | def forward(self, caption): class MLP (line 147) | class MLP(nn.Module): method __init__ (line 164) | def __init__( method forward (line 190) | def forward(self, x): class IndividualTokenRefinerBlock (line 200) | class IndividualTokenRefinerBlock(nn.Module): method __init__ (line 218) | def __init__( method forward (line 252) | def forward(self, x: torch.Tensor, c: torch.Tensor, attn_params: Atten... class IndividualTokenRefiner (line 281) | class IndividualTokenRefiner(nn.Module): method __init__ (line 299) | def __init__( method forward (line 328) | def forward(self, x: torch.Tensor, c: torch.LongTensor, attn_params: A... class SingleTokenRefiner (line 345) | class SingleTokenRefiner(nn.Module): method __init__ (line 359) | def __init__(self, in_channels: int, hidden_size: int, heads_num: int,... method forward (line 385) | def forward(self, x: torch.Tensor, t: torch.LongTensor, attn_params: A... class FinalLayer (line 411) | class FinalLayer(nn.Module): method __init__ (line 425) | def __init__(self, hidden_size, patch_size, out_channels, act_layer): method forward (line 439) | def forward(self, x, c): class RMSNorm (line 447) | class RMSNorm(nn.Module): method __init__ (line 459) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 464) | def _norm(self, x): method reset_parameters (line 476) | def reset_parameters(self): method forward (line 479) | def forward(self, x): class ModulateDiT (line 520) | class ModulateDiT(nn.Module): method __init__ (line 533) | def __init__(self, hidden_size: int, factor: int, act_layer: Callable): method forward (line 538) | def forward(self, x: torch.Tensor) -> torch.Tensor: class MMDoubleStreamBlock (line 542) | class MMDoubleStreamBlock(nn.Module): method __init__ (line 560) | def __init__( method enable_gradient_checkpointing (line 608) | def enable_gradient_checkpointing(self, cpu_offload: bool = False): method disable_gradient_checkpointing (line 612) | def disable_gradient_checkpointing(self): method _forward (line 616) | def _forward( method forward (line 709) | def forward( class MMSingleStreamBlock (line 722) | class MMSingleStreamBlock(nn.Module): method __init__ (line 739) | def __init__( method enable_gradient_checkpointing (line 781) | def enable_gradient_checkpointing(self, cpu_offload: bool = False): method disable_gradient_checkpointing (line 785) | def disable_gradient_checkpointing(self): method _forward (line 789) | def _forward( method forward (line 846) | def forward( FILE: library/hunyuan_image_text_encoder.py function add_special_token (line 148) | def add_special_token(tokenizer: T5Tokenizer, text_encoder: T5Stack): function load_byt5 (line 170) | def load_byt5( function load_qwen2_5_vl (line 237) | def load_qwen2_5_vl( function get_qwen_prompt_embeds (line 507) | def get_qwen_prompt_embeds( function get_qwen_tokens (line 514) | def get_qwen_tokens(tokenizer: Qwen2Tokenizer, prompt: Union[str, list[s... function get_qwen_prompt_embeds_from_tokens (line 532) | def get_qwen_prompt_embeds_from_tokens( function format_prompt (line 571) | def format_prompt(texts, styles): function get_glyph_prompt_embeds (line 588) | def get_glyph_prompt_embeds( function get_byt5_prompt_embeds_from_tokens (line 595) | def get_byt5_prompt_embeds_from_tokens( function get_byt5_text_tokens (line 617) | def get_byt5_text_tokens(tokenizer, prompt): FILE: library/hunyuan_image_utils.py function _to_tuple (line 21) | def _to_tuple(x, dim=2): function get_meshgrid_nd (line 40) | def get_meshgrid_nd(start, dim=2): function get_nd_rotary_pos_embed (line 71) | def get_nd_rotary_pos_embed(rope_dim_list, start, theta=10000.0): function get_1d_rotary_pos_embed (line 100) | def get_1d_rotary_pos_embed( function timestep_embedding (line 124) | def timestep_embedding(t, dim, max_period=10000): function modulate (line 148) | def modulate(x, shift=None, scale=None): function apply_gate (line 173) | def apply_gate(x, gate=None, tanh=False): function reshape_for_broadcast (line 196) | def reshape_for_broadcast( function rotate_half (line 226) | def rotate_half(x): function apply_rotary_emb (line 243) | def apply_rotary_emb( function get_timesteps_sigmas (line 276) | def get_timesteps_sigmas(sampling_steps: int, shift: float, device: torc... function step (line 295) | def step(latents, noise_pred, sigmas, step_i): class MomentumBuffer (line 317) | class MomentumBuffer: method __init__ (line 322) | def __init__(self, momentum: float): method update (line 326) | def update(self, update_value: torch.Tensor): function normalized_guidance_apg (line 331) | def normalized_guidance_apg( class AdaptiveProjectedGuidance (line 387) | class AdaptiveProjectedGuidance: method __init__ (line 395) | def __init__( method __call__ (line 412) | def __call__(self, pred_cond: torch.Tensor, pred_uncond: Optional[torc... function rescale_noise_cfg (line 432) | def rescale_noise_cfg(guided_noise, conditional_noise, rescale_factor=0.0): function apply_classifier_free_guidance (line 467) | def apply_classifier_free_guidance( FILE: library/hunyuan_image_vae.py function swish (line 24) | def swish(x: Tensor) -> Tensor: class AttnBlock (line 29) | class AttnBlock(nn.Module): method __init__ (line 32) | def __init__(self, in_channels: int, chunk_size: Optional[int] = None): method attention (line 47) | def attention(self, x: Tensor) -> Tensor: method forward (line 61) | def forward(self, x: Tensor) -> Tensor: class ChunkedConv2d (line 65) | class ChunkedConv2d(nn.Conv2d): method __init__ (line 75) | def __init__(self, *args, **kwargs): method forward (line 89) | def forward(self, x: Tensor) -> Tensor: class ResnetBlock (line 146) | class ResnetBlock(nn.Module): method __init__ (line 159) | def __init__(self, in_channels: int, out_channels: int, chunk_size: Op... method forward (line 183) | def forward(self, x: Tensor) -> Tensor: class Downsample (line 200) | class Downsample(nn.Module): method __init__ (line 213) | def __init__(self, in_channels: int, out_channels: int, chunk_size: Op... method forward (line 226) | def forward(self, x: Tensor) -> Tensor: class Upsample (line 239) | class Upsample(nn.Module): method __init__ (line 252) | def __init__(self, in_channels: int, out_channels: int, chunk_size: Op... method forward (line 263) | def forward(self, x: Tensor) -> Tensor: class Encoder (line 275) | class Encoder(nn.Module): method __init__ (line 294) | def __init__( method forward (line 356) | def forward(self, x: Tensor) -> Tensor: class Decoder (line 384) | class Decoder(nn.Module): method __init__ (line 403) | def __init__( method forward (line 462) | def forward(self, z: Tensor) -> Tensor: class HunyuanVAE2D (line 488) | class HunyuanVAE2D(nn.Module): method __init__ (line 496) | def __init__(self, chunk_size: Optional[int] = None): method dtype (line 537) | def dtype(self): method device (line 542) | def device(self): method enable_spatial_tiling (line 546) | def enable_spatial_tiling(self, use_tiling: bool = True): method disable_spatial_tiling (line 550) | def disable_spatial_tiling(self): method enable_tiling (line 554) | def enable_tiling(self, use_tiling: bool = True): method disable_tiling (line 558) | def disable_tiling(self): method blend_h (line 562) | def blend_h(self, a: torch.Tensor, b: torch.Tensor, blend_extent: int)... method blend_v (line 580) | def blend_v(self, a: torch.Tensor, b: torch.Tensor, blend_extent: int)... method spatial_tiled_encode (line 598) | def spatial_tiled_encode(self, x: torch.Tensor) -> torch.Tensor: method spatial_tiled_decode (line 641) | def spatial_tiled_decode(self, z: torch.Tensor) -> torch.Tensor: method encode (line 679) | def encode(self, x: Tensor) -> DiagonalGaussianDistribution: method decode (line 712) | def decode(self, z: Tensor): function load_vae (line 745) | def load_vae(vae_path: str, device: torch.device, disable_mmap: bool = F... FILE: library/hypernetwork.py function apply_single_hypernetwork (line 19) | def apply_single_hypernetwork( function apply_hypernetworks (line 26) | def apply_hypernetworks(context_k, context_v, layer=None): function xformers_forward (line 39) | def xformers_forward( function sliced_attn_forward (line 90) | def sliced_attn_forward( function v2_0_forward (line 155) | def v2_0_forward( function replace_attentions_for_hypernetwork (line 214) | def replace_attentions_for_hypernetwork(): FILE: library/ipex/__init__.py function ipex_init (line 15) | def ipex_init(): # pylint: disable=too-many-statements FILE: library/ipex/attention.py function find_split_size (line 14) | def find_split_size(original_size, slice_block_size, slice_rate=2): function find_sdpa_slice_sizes (line 27) | def find_sdpa_slice_sizes(query_shape, key_shape, query_element_size, sl... function dynamic_scaled_dot_product_attention (line 60) | def dynamic_scaled_dot_product_attention(query, key, value, attn_mask=No... FILE: library/ipex/diffusers.py function fourier_filter (line 13) | def fourier_filter(x_in, threshold, scale): class FluxPosEmbed (line 19) | class FluxPosEmbed(torch.nn.Module): method __init__ (line 20) | def __init__(self, theta: int, axes_dim): method forward (line 25) | def forward(self, ids: torch.Tensor) -> torch.Tensor: function hidream_rope (line 46) | def hidream_rope(pos: torch.Tensor, dim: int, theta: int) -> torch.Tensor: function get_1d_sincos_pos_embed_from_grid (line 64) | def get_1d_sincos_pos_embed_from_grid(embed_dim, pos, output_type="np"): function apply_rotary_emb (line 84) | def apply_rotary_emb(x, freqs_cis, use_real: bool = True, use_real_unbin... function ipex_diffusers (line 113) | def ipex_diffusers(device_supports_fp64=False): FILE: library/ipex/hijacks.py class DummyDataParallel (line 27) | class DummyDataParallel(torch.nn.Module): # pylint: disable=missing-clas... method __new__ (line 28) | def __new__(cls, module, device_ids=None, output_device=None, dim=0): ... function return_null_context (line 33) | def return_null_context(*args, **kwargs): # pylint: disable=unused-argument function is_cuda (line 37) | def is_cuda(self): function check_device_type (line 40) | def check_device_type(device, device_type: str) -> bool: function check_cuda (line 46) | def check_cuda(device) -> bool: function return_xpu (line 49) | def return_xpu(device): # keep the device instance type, aka return stri... function autocast_init (line 56) | def autocast_init(self, device_type=None, dtype=None, enabled=True, cach... function GradScaler_init (line 65) | def GradScaler_init(self, device: str = None, init_scale: float = 2.0**1... function torch_is_autocast_enabled (line 74) | def torch_is_autocast_enabled(device_type=None): function torch_get_autocast_dtype (line 83) | def torch_get_autocast_dtype(device_type=None): function interpolate (line 94) | def interpolate(tensor, size=None, scale_factor=None, mode='nearest', al... function from_numpy (line 108) | def from_numpy(ndarray): function as_tensor (line 116) | def as_tensor(data, dtype=None, device=None): function scaled_dot_product_attention (line 135) | def scaled_dot_product_attention(query, key, value, attn_mask=None, drop... function torch_bmm (line 147) | def torch_bmm(input, mat2, *, out=None): function fft_fftn (line 155) | def fft_fftn(input, s=None, dim=None, norm=None, *, out=None): function fft_ifftn (line 162) | def fft_ifftn(input, s=None, dim=None, norm=None, *, out=None): function functional_group_norm (line 169) | def functional_group_norm(input, num_groups, weight=None, bias=None, eps... function functional_layer_norm (line 179) | def functional_layer_norm(input, normalized_shape, weight=None, bias=Non... function functional_linear (line 189) | def functional_linear(input, weight, bias=None): function functional_conv1d (line 198) | def functional_conv1d(input, weight, bias=None, stride=1, padding=0, dil... function functional_conv2d (line 207) | def functional_conv2d(input, weight, bias=None, stride=1, padding=0, dil... function functional_conv3d (line 217) | def functional_conv3d(input, weight, bias=None, stride=1, padding=0, dil... function functional_pad (line 227) | def functional_pad(input, pad, mode='constant', value=None): function torch_tensor (line 236) | def torch_tensor(data, *args, dtype=None, device=None, **kwargs): function Tensor_to (line 250) | def Tensor_to(self, device=None, *args, **kwargs): function Tensor_cuda (line 258) | def Tensor_cuda(self, device=None, *args, **kwargs): function Tensor_pin_memory (line 266) | def Tensor_pin_memory(self, device=None, *args, **kwargs): function UntypedStorage_init (line 274) | def UntypedStorage_init(*args, device=None, **kwargs): function UntypedStorage_to (line 283) | def UntypedStorage_to(self, *args, device=None, **kwargs): function UntypedStorage_cuda (line 291) | def UntypedStorage_cuda(self, device=None, non_blocking=False, **kwargs): function torch_empty (line 299) | def torch_empty(*args, device=None, **kwargs): function torch_randn (line 307) | def torch_randn(*args, device=None, dtype=None, **kwargs): function torch_ones (line 317) | def torch_ones(*args, device=None, **kwargs): function torch_zeros (line 325) | def torch_zeros(*args, device=None, **kwargs): function torch_full (line 333) | def torch_full(*args, device=None, **kwargs): function torch_linspace (line 341) | def torch_linspace(*args, device=None, **kwargs): function torch_eye (line 349) | def torch_eye(*args, device=None, **kwargs): function torch_load (line 357) | def torch_load(f, map_location=None, *args, **kwargs): function torch_cuda_synchronize (line 364) | def torch_cuda_synchronize(device=None): function torch_cuda_device (line 371) | def torch_cuda_device(device): function torch_cuda_set_device (line 378) | def torch_cuda_set_device(device): class torch_Generator (line 386) | class torch_Generator(original_torch_Generator): method __new__ (line 387) | def __new__(self, device=None): function ipex_hijacks (line 396) | def ipex_hijacks(): FILE: library/jpeg_xl_util.py class JXLBitstream (line 7) | class JXLBitstream: method __init__ (line 12) | def __init__(self, file, offset: int = 0, offsets: List[List[int]] = N... method get_bits (line 24) | def get_bits(self, length: int = 1) -> int: method partial_read (line 37) | def partial_read(self, current_length: int, length: int) -> None: function decode_codestream (line 49) | def decode_codestream(file, offset: int = 0, offsets: List[List[int]] = ... function decode_container (line 109) | def decode_container(file) -> Tuple[int,int]: function get_jxl_size (line 182) | def get_jxl_size(path: str) -> Tuple[int,int]: FILE: library/lora_utils.py function filter_lora_state_dict (line 17) | def filter_lora_state_dict( function load_safetensors_with_lora_and_fp8 (line 45) | def load_safetensors_with_lora_and_fp8( function load_safetensors_with_fp8_optimization_and_hook (line 213) | def load_safetensors_with_fp8_optimization_and_hook( FILE: library/lpw_stable_diffusion.py function parse_prompt_attention (line 63) | def parse_prompt_attention(text): function get_prompts_with_weights (line 149) | def get_prompts_with_weights(pipe: StableDiffusionPipeline, prompt: List... function pad_tokens_and_weights (line 184) | def pad_tokens_and_weights(tokens, weights, max_length, bos, eos, no_bos... function get_unweighted_text_embeddings (line 209) | def get_unweighted_text_embeddings( function get_weighted_text_embeddings (line 270) | def get_weighted_text_embeddings( function preprocess_image (line 405) | def preprocess_image(image): function preprocess_mask (line 415) | def preprocess_mask(mask, scale_factor=8): function prepare_controlnet_image (line 428) | def prepare_controlnet_image( class StableDiffusionLongPromptWeightingPipeline (line 480) | class StableDiffusionLongPromptWeightingPipeline(StableDiffusionPipeline): method __init__ (line 511) | def __init__( method __init__additional__ (line 539) | def __init__additional__(self): method _execution_device (line 544) | def _execution_device(self): method _encode_prompt (line 561) | def _encode_prompt( method check_inputs (line 620) | def check_inputs(self, prompt, height, width, strength, callback_steps): method get_timesteps (line 638) | def get_timesteps(self, num_inference_steps, strength, device, is_text... method run_safety_checker (line 651) | def run_safety_checker(self, image, device, dtype): method decode_latents (line 659) | def decode_latents(self, latents): method prepare_extra_step_kwargs (line 667) | def prepare_extra_step_kwargs(self, generator, eta): method prepare_latents (line 684) | def prepare_latents(self, image, timestep, batch_size, height, width, ... method __call__ (line 724) | def __call__( method latents_to_image (line 940) | def latents_to_image(self, latents): method text2img (line 946) | def text2img( method img2img (line 1041) | def img2img( method inpaint (line 1135) | def inpaint( FILE: library/lumina_models.py class RMSNorm (line 57) | class RMSNorm(torch.nn.Module): method __init__ (line 58) | def __init__(self, dim: int, eps: float = 1e-6): method _norm (line 75) | def _norm(self, x) -> Tensor: method forward (line 88) | def forward(self, x: Tensor): class LuminaParams (line 107) | class LuminaParams: method __post_init__ (line 126) | def __post_init__(self): method get_2b_config (line 133) | def get_2b_config(cls) -> "LuminaParams": method get_7b_config (line 149) | def get_7b_config(cls) -> "LuminaParams": class GradientCheckpointMixin (line 162) | class GradientCheckpointMixin(nn.Module): method __init__ (line 163) | def __init__(self, *args, **kwargs) -> None: method enable_gradient_checkpointing (line 169) | def enable_gradient_checkpointing(self, cpu_offload: bool = False): method disable_gradient_checkpointing (line 172) | def disable_gradient_checkpointing(self, cpu_offload: bool = False): method forward (line 175) | def forward(self, *args, **kwargs): function modulate (line 183) | def modulate(x, scale): class TimestepEmbedder (line 192) | class TimestepEmbedder(GradientCheckpointMixin): method __init__ (line 197) | def __init__(self, hidden_size, frequency_embedding_size=256): method timestep_embedding (line 220) | def timestep_embedding(t, dim, max_period=10000): method _forward (line 238) | def _forward(self, t): function to_cuda (line 244) | def to_cuda(x): function to_cpu (line 255) | def to_cpu(x): class JointAttention (line 271) | class JointAttention(nn.Module): method __init__ (line 274) | def __init__( method set_attention_processor (line 329) | def set_attention_processor(self, attention_processor): method get_attention_processor (line 332) | def get_attention_processor(self): method forward (line 335) | def forward( method _upad_input (line 402) | def _upad_input(self, query_layer, key_layer, value_layer, attention_m... method sage_attn (line 454) | def sage_attn(self, q: Tensor, k: Tensor, v: Tensor, x_mask: Tensor, s... method flash_attn (line 507) | def flash_attn( function apply_rope (line 553) | def apply_rope( class FeedForward (line 584) | class FeedForward(nn.Module): method __init__ (line 585) | def __init__( method _forward_silu_gating (line 630) | def _forward_silu_gating(self, x1, x3): method forward (line 633) | def forward(self, x): class JointTransformerBlock (line 637) | class JointTransformerBlock(GradientCheckpointMixin): method __init__ (line 638) | def __init__( method _forward (line 700) | def _forward( class FinalLayer (line 752) | class FinalLayer(GradientCheckpointMixin): method __init__ (line 757) | def __init__(self, hidden_size, patch_size, out_channels): method forward (line 791) | def forward(self, x, c): class RopeEmbedder (line 798) | class RopeEmbedder: method __init__ (line 799) | def __init__( method __call__ (line 811) | def __call__(self, ids: torch.Tensor): class NextDiT (line 822) | class NextDiT(nn.Module): method __init__ (line 827) | def __init__( method device (line 966) | def device(self): method dtype (line 970) | def dtype(self): method enable_gradient_checkpointing (line 973) | def enable_gradient_checkpointing(self, cpu_offload: bool = False): method disable_gradient_checkpointing (line 986) | def disable_gradient_checkpointing(self): method unpatchify (line 999) | def unpatchify( method patchify_and_embed (line 1037) | def patchify_and_embed( method forward (line 1133) | def forward(self, x: Tensor, t: Tensor, cap_feats: Tensor, cap_mask: T... method forward_with_cfg (line 1167) | def forward_with_cfg( method precompute_freqs_cis (line 1222) | def precompute_freqs_cis( method parameter_count (line 1258) | def parameter_count(self) -> int: method get_fsdp_wrap_module_list (line 1271) | def get_fsdp_wrap_module_list(self) -> List[nn.Module]: method get_checkpointing_wrap_module_list (line 1274) | def get_checkpointing_wrap_module_list(self) -> List[nn.Module]: method enable_block_swap (line 1277) | def enable_block_swap(self, blocks_to_swap: int, device: torch.device): method move_to_device_except_swap_blocks (line 1298) | def move_to_device_except_swap_blocks(self, device: torch.device): method prepare_block_swap_before_forward (line 1315) | def prepare_block_swap_before_forward(self): function NextDiT_2B_GQA_patch2_Adaln_Refiner (line 1330) | def NextDiT_2B_GQA_patch2_Adaln_Refiner(params: Optional[LuminaParams] =... function NextDiT_3B_GQA_patch2_Adaln_Refiner (line 1351) | def NextDiT_3B_GQA_patch2_Adaln_Refiner(**kwargs): function NextDiT_4B_GQA_patch2_Adaln_Refiner (line 1364) | def NextDiT_4B_GQA_patch2_Adaln_Refiner(**kwargs): function NextDiT_7B_GQA_patch2_Adaln_Refiner (line 1377) | def NextDiT_7B_GQA_patch2_Adaln_Refiner(**kwargs): FILE: library/lumina_train_util.py function batchify (line 36) | def batchify( function sample_images (line 102) | def sample_images( function sample_image_inference (line 249) | def sample_image_inference( function time_shift (line 480) | def time_shift(mu: float, sigma: float, t: torch.Tensor): function get_lin_function (line 486) | def get_lin_function( function get_schedule (line 507) | def get_schedule( function retrieve_timesteps (line 542) | def retrieve_timesteps( function denoise (line 606) | def denoise( function get_sigmas (line 714) | def get_sigmas( function compute_density_for_timestep_sampling (line 745) | def compute_density_for_timestep_sampling( function compute_loss_weighting_for_sd3 (line 783) | def compute_loss_weighting_for_sd3(weighting_scheme: str, sigmas=None) -... function get_noisy_model_input_and_timesteps (line 807) | def get_noisy_model_input_and_timesteps( function apply_model_prediction_type (line 876) | def apply_model_prediction_type( function save_models (line 910) | def save_models( function save_lumina_model_on_train_end (line 946) | def save_lumina_model_on_train_end( function save_lumina_model_on_epoch_end_or_stepwise (line 972) | def save_lumina_model_on_epoch_end_or_stepwise( function add_lumina_train_arguments (line 1025) | def add_lumina_train_arguments(parser: argparse.ArgumentParser): FILE: library/lumina_util.py function load_lumina_model (line 24) | def load_lumina_model( function load_ae (line 67) | def load_ae( function load_gemma2 (line 104) | def load_gemma2( function unpack_latents (line 188) | def unpack_latents(x: torch.Tensor, packed_latent_height: int, packed_la... function pack_latents (line 196) | def pack_latents(x: torch.Tensor) -> torch.Tensor: function convert_diffusers_sd_to_alpha_vllm (line 234) | def convert_diffusers_sd_to_alpha_vllm(sd: dict, num_double_blocks: int)... FILE: library/model_util.py function shave_segments (line 62) | def shave_segments(path, n_shave_prefix_segments=1): function renew_resnet_paths (line 72) | def renew_resnet_paths(old_list, n_shave_prefix_segments=0): function renew_vae_resnet_paths (line 94) | def renew_vae_resnet_paths(old_list, n_shave_prefix_segments=0): function renew_attention_paths (line 110) | def renew_attention_paths(old_list, n_shave_prefix_segments=0): function renew_vae_attention_paths (line 131) | def renew_vae_attention_paths(old_list, n_shave_prefix_segments=0): function assign_to_checkpoint (line 174) | def assign_to_checkpoint( function conv_attn_to_linear (line 234) | def conv_attn_to_linear(checkpoint): function linear_transformer_to_conv (line 246) | def linear_transformer_to_conv(checkpoint): function convert_ldm_unet_checkpoint (line 255) | def convert_ldm_unet_checkpoint(v2, checkpoint, config): function convert_ldm_vae_checkpoint (line 404) | def convert_ldm_vae_checkpoint(checkpoint, config): function create_unet_diffusers_config (line 508) | def create_unet_diffusers_config(v2, use_linear_projection_in_v2=False): function create_vae_diffusers_config (line 548) | def create_vae_diffusers_config(): function convert_ldm_clip_checkpoint_v1 (line 571) | def convert_ldm_clip_checkpoint_v1(checkpoint): function convert_ldm_clip_checkpoint_v2 (line 585) | def convert_ldm_clip_checkpoint_v2(checkpoint, max_length): function conv_transformer_to_linear (line 668) | def conv_transformer_to_linear(checkpoint): function convert_unet_state_dict_to_sd (line 677) | def convert_unet_state_dict_to_sd(v2, unet_state_dict): function controlnet_conversion_map (line 773) | def controlnet_conversion_map(): function convert_controlnet_state_dict_to_sd (line 834) | def convert_controlnet_state_dict_to_sd(controlnet_state_dict): function convert_controlnet_state_dict_to_diffusers (line 853) | def convert_controlnet_state_dict_to_diffusers(controlnet_state_dict): function reshape_weight_for_sd (line 877) | def reshape_weight_for_sd(w): function convert_vae_state_dict (line 882) | def convert_vae_state_dict(vae_state_dict): function is_safetensors (line 964) | def is_safetensors(path): function load_checkpoint_with_text_encoder_conversion (line 968) | def load_checkpoint_with_text_encoder_conversion(ckpt_path, device="cpu"): function load_models_from_stable_diffusion_checkpoint (line 1002) | def load_models_from_stable_diffusion_checkpoint(v2, ckpt_path, device="... function get_model_version_str_for_sd1_sd2 (line 1081) | def get_model_version_str_for_sd1_sd2(v2, v_parameterization): function convert_text_encoder_state_dict_to_sd_v2 (line 1093) | def convert_text_encoder_state_dict_to_sd_v2(checkpoint, make_dummy_weig... function save_stable_diffusion_checkpoint (line 1164) | def save_stable_diffusion_checkpoint( function save_diffusers_checkpoint (line 1235) | def save_diffusers_checkpoint(v2, output_dir, text_encoder, unet, pretra... function load_vae (line 1269) | def load_vae(vae_id, dtype): function make_bucket_resolutions (line 1316) | def make_bucket_resolutions(max_reso, min_size=256, max_size=1024, divis... FILE: library/original_unet.py function exists (line 153) | def exists(val): function default (line 157) | def default(val, d): class FlashAttentionFunction (line 166) | class FlashAttentionFunction(torch.autograd.Function): method forward (line 169) | def forward(ctx, q, k, v, mask, causal, q_bucket_size, k_bucket_size): method backward (line 249) | def backward(ctx, do): function get_parameter_dtype (line 321) | def get_parameter_dtype(parameter: torch.nn.Module): function get_parameter_device (line 325) | def get_parameter_device(parameter: torch.nn.Module): function get_timestep_embedding (line 329) | def get_timestep_embedding( function resize_like (line 371) | def resize_like(x, target, mode="bicubic", align_corners=False): class SampleOutput (line 387) | class SampleOutput: method __init__ (line 388) | def __init__(self, sample): class TimestepEmbedding (line 392) | class TimestepEmbedding(nn.Module): method __init__ (line 393) | def __init__(self, in_channels: int, time_embed_dim: int, act_fn: str ... method forward (line 409) | def forward(self, sample): class Timesteps (line 419) | class Timesteps(nn.Module): method __init__ (line 420) | def __init__(self, num_channels: int, flip_sin_to_cos: bool, downscale... method forward (line 426) | def forward(self, timesteps): class ResnetBlock2D (line 436) | class ResnetBlock2D(nn.Module): method __init__ (line 437) | def __init__( method forward (line 464) | def forward(self, input_tensor, temb): class DownBlock2D (line 488) | class DownBlock2D(nn.Module): method __init__ (line 489) | def __init__( method set_use_memory_efficient_attention (line 517) | def set_use_memory_efficient_attention(self, xformers, mem_eff): method set_use_sdpa (line 520) | def set_use_sdpa(self, sdpa): method forward (line 523) | def forward(self, hidden_states, temb=None): class Downsample2D (line 552) | class Downsample2D(nn.Module): method __init__ (line 553) | def __init__(self, channels, out_channels): method forward (line 561) | def forward(self, hidden_states): class CrossAttention (line 568) | class CrossAttention(nn.Module): method __init__ (line 569) | def __init__( method set_use_memory_efficient_attention (line 600) | def set_use_memory_efficient_attention(self, xformers, mem_eff): method set_use_sdpa (line 604) | def set_use_sdpa(self, sdpa): method reshape_heads_to_batch_dim (line 607) | def reshape_heads_to_batch_dim(self, tensor): method reshape_batch_dim_to_heads (line 614) | def reshape_batch_dim_to_heads(self, tensor): method set_processor (line 621) | def set_processor(self): method get_processor (line 624) | def get_processor(self): method forward (line 627) | def forward(self, hidden_states, context=None, mask=None, **kwargs): method _attention (line 660) | def _attention(self, query, key, value): method forward_memory_efficient_xformers (line 685) | def forward_memory_efficient_xformers(self, x, context=None, mask=None): method forward_memory_efficient_mem_eff (line 708) | def forward_memory_efficient_mem_eff(self, x, context=None, mask=None): method forward_sdpa (line 731) | def forward_sdpa(self, x, context=None, mask=None): function translate_attention_names_from_diffusers (line 750) | def translate_attention_names_from_diffusers( class GEGLU (line 768) | class GEGLU(nn.Module): method __init__ (line 777) | def __init__(self, dim_in: int, dim_out: int): method gelu (line 781) | def gelu(self, gate): method forward (line 787) | def forward(self, hidden_states): class FeedForward (line 792) | class FeedForward(nn.Module): method __init__ (line 793) | def __init__( method forward (line 808) | def forward(self, hidden_states): class BasicTransformerBlock (line 814) | class BasicTransformerBlock(nn.Module): method __init__ (line 815) | def __init__( method set_use_memory_efficient_attention (line 845) | def set_use_memory_efficient_attention(self, xformers: bool, mem_eff: ... method set_use_sdpa (line 849) | def set_use_sdpa(self, sdpa: bool): method forward (line 853) | def forward(self, hidden_states, context=None, timestep=None): class Transformer2DModel (line 869) | class Transformer2DModel(nn.Module): method __init__ (line 870) | def __init__( method set_use_memory_efficient_attention (line 910) | def set_use_memory_efficient_attention(self, xformers, mem_eff): method set_use_sdpa (line 914) | def set_use_sdpa(self, sdpa): method forward (line 918) | def forward(self, hidden_states, encoder_hidden_states=None, timestep=... class CrossAttnDownBlock2D (line 953) | class CrossAttnDownBlock2D(nn.Module): method __init__ (line 954) | def __init__( method set_use_memory_efficient_attention (line 995) | def set_use_memory_efficient_attention(self, xformers, mem_eff): method set_use_sdpa (line 999) | def set_use_sdpa(self, sdpa): method forward (line 1003) | def forward(self, hidden_states, temb=None, encoder_hidden_states=None): class UNetMidBlock2DCrossAttn (line 1039) | class UNetMidBlock2DCrossAttn(nn.Module): method __init__ (line 1040) | def __init__( method set_use_memory_efficient_attention (line 1078) | def set_use_memory_efficient_attention(self, xformers, mem_eff): method set_use_sdpa (line 1082) | def set_use_sdpa(self, sdpa): method forward (line 1086) | def forward(self, hidden_states, temb=None, encoder_hidden_states=None): class Upsample2D (line 1117) | class Upsample2D(nn.Module): method __init__ (line 1118) | def __init__(self, channels, out_channels): method forward (line 1124) | def forward(self, hidden_states, output_size): class UpBlock2D (line 1153) | class UpBlock2D(nn.Module): method __init__ (line 1154) | def __init__( method set_use_memory_efficient_attention (line 1186) | def set_use_memory_efficient_attention(self, xformers, mem_eff): method set_use_sdpa (line 1189) | def set_use_sdpa(self, sdpa): method forward (line 1192) | def forward(self, hidden_states, res_hidden_states_tuple, temb=None, u... class CrossAttnUpBlock2D (line 1221) | class CrossAttnUpBlock2D(nn.Module): method __init__ (line 1222) | def __init__( method set_use_memory_efficient_attention (line 1271) | def set_use_memory_efficient_attention(self, xformers, mem_eff): method set_use_sdpa (line 1275) | def set_use_sdpa(self, sdpa): method forward (line 1279) | def forward( function get_down_block (line 1322) | def get_down_block( function get_up_block (line 1350) | def get_up_block( class UNet2DConditionModel (line 1381) | class UNet2DConditionModel(nn.Module): method __init__ (line 1384) | def __init__( method prepare_config (line 1491) | def prepare_config(self, *args, **kwargs): method dtype (line 1495) | def dtype(self) -> torch.dtype: method device (line 1500) | def device(self) -> torch.device: method set_attention_slice (line 1504) | def set_attention_slice(self, slice_size): method is_gradient_checkpointing (line 1507) | def is_gradient_checkpointing(self) -> bool: method enable_gradient_checkpointing (line 1510) | def enable_gradient_checkpointing(self): method disable_gradient_checkpointing (line 1513) | def disable_gradient_checkpointing(self): method set_use_memory_efficient_attention (line 1516) | def set_use_memory_efficient_attention(self, xformers: bool, mem_eff: ... method set_use_sdpa (line 1521) | def set_use_sdpa(self, sdpa: bool) -> None: method set_gradient_checkpointing (line 1526) | def set_gradient_checkpointing(self, value=False): method forward (line 1534) | def forward( method handle_unusual_timesteps (line 1656) | def handle_unusual_timesteps(self, sample, timesteps): class InferUNet2DConditionModel (line 1678) | class InferUNet2DConditionModel: method __init__ (line 1679) | def __init__(self, original_unet: UNet2DConditionModel): method __getattr__ (line 1716) | def __getattr__(self, name): method __call__ (line 1719) | def __call__(self, *args, **kwargs): method set_deep_shrink (line 1722) | def set_deep_shrink(self, ds_depth_1, ds_timesteps_1=650, ds_depth_2=N... method up_block_forward (line 1740) | def up_block_forward(self, _self, hidden_states, res_hidden_states_tup... method cross_attn_up_block_forward (line 1759) | def cross_attn_up_block_forward( method forward (line 1787) | def forward( FILE: library/qwen_image_autoencoder_kl.py class DiagonalGaussianDistribution (line 49) | class DiagonalGaussianDistribution(object): method __init__ (line 50) | def __init__(self, parameters: torch.Tensor, deterministic: bool = Fal... method sample (line 60) | def sample(self, generator: Optional[torch.Generator] = None) -> torch... method kl (line 72) | def kl(self, other: "DiagonalGaussianDistribution" = None) -> torch.Te... method nll (line 87) | def nll(self, sample: torch.Tensor, dims: Tuple[int, ...] = [1, 2, 3])... method mode (line 96) | def mode(self) -> torch.Tensor: class ChunkedConv2d (line 103) | class ChunkedConv2d(nn.Conv2d): method __init__ (line 115) | def __init__(self, *args, **kwargs): method forward (line 129) | def forward(self, x: torch.Tensor) -> torch.Tensor: class QwenImageCausalConv3d (line 191) | class QwenImageCausalConv3d(nn.Conv3d): method __init__ (line 206) | def __init__( method _forward_chunked_height (line 231) | def _forward_chunked_height(self, x: torch.Tensor) -> torch.Tensor: method forward (line 263) | def forward(self, x, cache_x=None): class QwenImageRMS_norm (line 273) | class QwenImageRMS_norm(nn.Module): method __init__ (line 285) | def __init__(self, dim: int, channel_first: bool = True, images: bool ... method forward (line 295) | def forward(self, x): class QwenImageUpsample (line 299) | class QwenImageUpsample(nn.Upsample): method forward (line 310) | def forward(self, x): class QwenImageResample (line 314) | class QwenImageResample(nn.Module): method __init__ (line 328) | def __init__(self, dim: int, mode: str) -> None: method forward (line 355) | def forward(self, x, feat_cache=None, feat_idx=[0]): class QwenImageResidualBlock (line 399) | class QwenImageResidualBlock(nn.Module): method __init__ (line 410) | def __init__( method forward (line 431) | def forward(self, x, feat_cache=None, feat_idx=[0]): class QwenImageAttentionBlock (line 474) | class QwenImageAttentionBlock(nn.Module): method __init__ (line 482) | def __init__(self, dim): method forward (line 491) | def forward(self, x): class QwenImageMidBlock (line 519) | class QwenImageMidBlock(nn.Module): method __init__ (line 529) | def __init__(self, dim: int, dropout: float = 0.0, non_linearity: str ... method forward (line 544) | def forward(self, x, feat_cache=None, feat_idx=[0]): class QwenImageEncoder3d (line 558) | class QwenImageEncoder3d(nn.Module): method __init__ (line 574) | def __init__( method forward (line 628) | def forward(self, x, feat_cache=None, feat_idx=[0]): class QwenImageUpBlock (line 668) | class QwenImageUpBlock(nn.Module): method __init__ (line 681) | def __init__( method forward (line 711) | def forward(self, x, feat_cache=None, feat_idx=[0]): class QwenImageDecoder3d (line 737) | class QwenImageDecoder3d(nn.Module): method __init__ (line 753) | def __init__( method forward (line 819) | def forward(self, x, feat_cache=None, feat_idx=[0]): class AutoencoderKLQwenImage (line 857) | class AutoencoderKLQwenImage(nn.Module): # ModelMixin, ConfigMixin, Fro... method __init__ (line 868) | def __init__( method dtype (line 969) | def dtype(self): method device (line 973) | def device(self): method enable_tiling (line 976) | def enable_tiling( method disable_tiling (line 1006) | def disable_tiling(self) -> None: method enable_slicing (line 1013) | def enable_slicing(self) -> None: method disable_slicing (line 1020) | def disable_slicing(self) -> None: method enable_spatial_chunking (line 1027) | def enable_spatial_chunking(self, spatial_chunk_size: int) -> None: method disable_spatial_chunking (line 1040) | def disable_spatial_chunking(self) -> None: method disable_cache (line 1051) | def disable_cache(self) -> None: method clear_cache (line 1060) | def clear_cache(self): method _encode (line 1076) | def _encode(self, x: torch.Tensor): method encode (line 1102) | def encode( method _decode (line 1127) | def _decode(self, z: torch.Tensor, return_dict: bool = True): method decode (line 1154) | def decode(self, z: torch.Tensor, return_dict: bool = True) -> Union[D... method decode_to_pixels (line 1178) | def decode_to_pixels(self, latents: torch.Tensor) -> torch.Tensor: method encode_pixels_to_latents (line 1194) | def encode_pixels_to_latents(self, pixels: torch.Tensor) -> torch.Tensor: method blend_v (line 1229) | def blend_v(self, a: torch.Tensor, b: torch.Tensor, blend_extent: int)... method blend_h (line 1235) | def blend_h(self, a: torch.Tensor, b: torch.Tensor, blend_extent: int)... method tiled_encode (line 1241) | def tiled_encode(self, x: torch.Tensor) -> torch.Tensor: method tiled_decode (line 1307) | def tiled_decode(self, z: torch.Tensor, return_dict: bool = True) -> U... method forward (line 1370) | def forward( function convert_comfyui_state_dict (line 1399) | def convert_comfyui_state_dict(sd): function load_vae (line 1542) | def load_vae( function encode_decode_image (line 1665) | def encode_decode_image(image_path, output_path): function process_directory (line 1688) | def process_directory(input_dir, output_dir): FILE: library/safetensors_utils.py function mem_eff_save_file (line 15) | def mem_eff_save_file(tensors: Dict[str, torch.Tensor], filename: str, m... class MemoryEfficientSafeOpen (line 86) | class MemoryEfficientSafeOpen: method __init__ (line 93) | def __init__(self, filename, disable_numpy_memmap=False): method __enter__ (line 105) | def __enter__(self): method __exit__ (line 109) | def __exit__(self, exc_type, exc_val, exc_tb): method keys (line 113) | def keys(self): method metadata (line 121) | def metadata(self) -> Dict[str, str]: method _read_header (line 129) | def _read_header(self): method get_tensor (line 141) | def get_tensor(self, key: str, device: Optional[torch.device] = None, ... method _deserialize_tensor (line 217) | def _deserialize_tensor(self, byte_tensor: torch.Tensor, metadata: Dict): method _get_torch_dtype (line 238) | def _get_torch_dtype(dtype_str): method _convert_float8 (line 268) | def _convert_float8(byte_tensor, dtype_str, shape): function load_safetensors (line 292) | def load_safetensors( function get_split_weight_filenames (line 321) | def get_split_weight_filenames(file_path: str) -> Optional[list[str]]: function load_split_weights (line 344) | def load_split_weights( function find_key (line 364) | def find_key(safetensors_file: str, starts_with: Optional[str] = None, e... class WeightTransformHooks (line 379) | class WeightTransformHooks: class TensorWeightAdapter (line 385) | class TensorWeightAdapter: method __init__ (line 403) | def __init__(self, weight_convert_hook: WeightTransformHooks, original... method keys (line 447) | def keys(self) -> list[str]: method get_tensor (line 450) | def get_tensor(self, new_key: str, device: Optional[torch.device] = No... FILE: library/sai_model_spec.py class ModelSpecMetadata (line 104) | class ModelSpecMetadata: method to_metadata_dict (line 142) | def to_metadata_dict(self) -> dict[str, str]: method from_args (line 161) | def from_args(cls, args, **kwargs) -> "ModelSpecMetadata": function determine_architecture (line 193) | def determine_architecture( function determine_implementation (line 246) | def determine_implementation( function get_implementation_version (line 272) | def get_implementation_version() -> str: function file_to_data_url (line 296) | def file_to_data_url(file_path: str) -> str: function determine_resolution (line 316) | def determine_resolution( function load_bytes_in_safetensors (line 349) | def load_bytes_in_safetensors(tensors): function precalculate_safetensors_hashes (line 363) | def precalculate_safetensors_hashes(state_dict): function update_hash_sha256 (line 374) | def update_hash_sha256(metadata: dict, state_dict: dict): function build_metadata_dataclass (line 378) | def build_metadata_dataclass( function build_metadata (line 501) | def build_metadata( function get_title (line 559) | def get_title(metadata: dict) -> str | None: function load_metadata_from_safetensors (line 563) | def load_metadata_from_safetensors(model: str) -> dict: function build_merged_from (line 574) | def build_merged_from(models: list[str]) -> str: function add_model_spec_arguments (line 586) | def add_model_spec_arguments(parser: argparse.ArgumentParser): FILE: library/sd3_models.py class SD3Params (line 48) | class SD3Params: function get_2d_sincos_pos_embed (line 61) | def get_2d_sincos_pos_embed( function get_2d_sincos_pos_embed_from_grid (line 81) | def get_2d_sincos_pos_embed_from_grid(embed_dim, grid): function get_scaled_2d_sincos_pos_embed (line 92) | def get_scaled_2d_sincos_pos_embed(embed_dim, grid_size, cls_token=False... function get_1d_sincos_pos_embed_from_grid (line 164) | def get_1d_sincos_pos_embed_from_grid(embed_dim, pos): function get_1d_sincos_pos_embed_from_grid_torch (line 185) | def get_1d_sincos_pos_embed_from_grid_torch( function get_2d_sincos_pos_embed_torch (line 199) | def get_2d_sincos_pos_embed_torch( function modulate (line 222) | def modulate(x, shift, scale): function default (line 228) | def default(x, default_value): function timestep_embedding (line 234) | def timestep_embedding(t, dim, max_period=10000): class PatchEmbed (line 249) | class PatchEmbed(nn.Module): method __init__ (line 250) | def __init__( method forward (line 280) | def forward(self, x): class UnPatch (line 296) | class UnPatch(nn.Module): method __init__ (line 297) | def __init__(self, hidden_size=512, patch_size=4, out_channels=3): method forward (line 310) | def forward(self, x: torch.Tensor, cmod, H=None, W=None): class MLP (line 332) | class MLP(nn.Module): method __init__ (line 333) | def __init__( method forward (line 355) | def forward(self, x): class TimestepEmbedding (line 363) | class TimestepEmbedding(nn.Module): method __init__ (line 364) | def __init__(self, hidden_size, freq_embed_size=256): method forward (line 373) | def forward(self, t, dtype=None, **kwargs): class Embedder (line 379) | class Embedder(nn.Module): method __init__ (line 380) | def __init__(self, input_dim, hidden_size): method forward (line 388) | def forward(self, x): function rmsnorm (line 392) | def rmsnorm(x, eps=1e-6): class RMSNorm (line 396) | class RMSNorm(torch.nn.Module): method __init__ (line 397) | def __init__( method forward (line 422) | def forward(self, x): class SwiGLUFeedForward (line 437) | class SwiGLUFeedForward(nn.Module): method __init__ (line 438) | def __init__( method forward (line 456) | def forward(self, x): class AttentionLinears (line 461) | class AttentionLinears(nn.Module): method __init__ (line 462) | def __init__( method pre_attention (line 491) | def pre_attention(self, x: torch.Tensor) -> torch.Tensor: method post_attention (line 503) | def post_attention(self, x: torch.Tensor) -> torch.Tensor: function vanilla_attention (line 532) | def vanilla_attention(q, k, v, mask, scale=None): function attention (line 545) | def attention(q, k, v, head_dim, mask=None, scale=None, mode="xformers"): class SingleDiTBlock (line 569) | class SingleDiTBlock(nn.Module): method __init__ (line 574) | def __init__( method pre_attention (line 633) | def pre_attention(self, x: torch.Tensor, c: torch.Tensor) -> torch.Ten... method pre_attention_x (line 652) | def pre_attention_x(self, x: torch.Tensor, c: torch.Tensor) -> torch.T... method post_attention (line 662) | def post_attention(self, attn, x, gate_msa, shift_mlp, scale_mlp, gate... method post_attention_x (line 668) | def post_attention_x(self, attn, attn2, x, gate_msa, shift_mlp, scale_... class MMDiTBlock (line 685) | class MMDiTBlock(nn.Module): method __init__ (line 686) | def __init__(self, *args, **kwargs): method enable_gradient_checkpointing (line 698) | def enable_gradient_checkpointing(self): method _forward (line 701) | def _forward(self, context, x, c): method forward (line 733) | def forward(self, *args, **kwargs): class MMDiT (line 740) | class MMDiT(nn.Module): method __init__ (line 748) | def __init__( method enable_scaled_pos_embed (line 869) | def enable_scaled_pos_embed(self, use_scaled_pos_embed: bool, latent_s... method model_type (line 910) | def model_type(self): method device (line 914) | def device(self): method dtype (line 918) | def dtype(self): method enable_gradient_checkpointing (line 921) | def enable_gradient_checkpointing(self): method disable_gradient_checkpointing (line 926) | def disable_gradient_checkpointing(self): method initialize_weights (line 931) | def initialize_weights(self): method set_pos_emb_random_crop_rate (line 977) | def set_pos_emb_random_crop_rate(self, rate: float): method cropped_pos_embed (line 980) | def cropped_pos_embed(self, h, w, device=None, random_crop: bool = Fal... method cropped_scaled_pos_embed (line 1008) | def cropped_scaled_pos_embed(self, h, w, device=None, dtype=None, rand... method enable_block_swap (line 1075) | def enable_block_swap(self, num_blocks: int, device: torch.device): method move_to_device_except_swap_blocks (line 1087) | def move_to_device_except_swap_blocks(self, device: torch.device): method prepare_block_swap_before_forward (line 1098) | def prepare_block_swap_before_forward(self): method forward (line 1103) | def forward( function create_sd3_mmdit (line 1159) | def create_sd3_mmdit(params: SD3Params, attn_mode: str = "torch") -> MMDiT: function Normalize (line 1187) | def Normalize(in_channels, num_groups=32, dtype=torch.float32, device=No... class ResnetBlock (line 1191) | class ResnetBlock(torch.nn.Module): method __init__ (line 1192) | def __init__(self, *, in_channels, out_channels=None, dtype=torch.floa... method forward (line 1210) | def forward(self, x): class AttnBlock (line 1223) | class AttnBlock(torch.nn.Module): method __init__ (line 1224) | def __init__(self, in_channels, dtype=torch.float32, device=None): method forward (line 1232) | def forward(self, x): class Downsample (line 1245) | class Downsample(torch.nn.Module): method __init__ (line 1246) | def __init__(self, in_channels, dtype=torch.float32, device=None): method forward (line 1250) | def forward(self, x): class Upsample (line 1257) | class Upsample(torch.nn.Module): method __init__ (line 1258) | def __init__(self, in_channels, dtype=torch.float32, device=None): method forward (line 1262) | def forward(self, x): class VAEEncoder (line 1273) | class VAEEncoder(torch.nn.Module): method __init__ (line 1274) | def __init__( method forward (line 1309) | def forward(self, x): class VAEDecoder (line 1330) | class VAEDecoder(torch.nn.Module): method __init__ (line 1331) | def __init__( method forward (line 1373) | def forward(self, z): class SDVAE (line 1393) | class SDVAE(torch.nn.Module): method __init__ (line 1394) | def __init__(self, dtype=torch.float32, device=None): method device (line 1400) | def device(self): method dtype (line 1404) | def dtype(self): method decode (line 1408) | def decode(self, latent): method encode (line 1412) | def encode(self, image): method process_in (line 1420) | def process_in(latent): method process_out (line 1424) | def process_out(latent): FILE: library/sd3_train_utils.py function save_models (line 34) | def save_models( function save_sd3_model_on_train_end (line 88) | def save_sd3_model_on_train_end( function save_sd3_model_on_epoch_end_or_stepwise (line 110) | def save_sd3_model_on_epoch_end_or_stepwise( function add_sd3_training_arguments (line 144) | def add_sd3_training_arguments(parser: argparse.ArgumentParser): function verify_sdxl_training_args (line 245) | def verify_sdxl_training_args(args: argparse.Namespace, supportTextEncod... function get_all_sigmas (line 282) | def get_all_sigmas(sampling: sd3_utils.ModelSamplingDiscreteFlow, steps): function max_denoise (line 294) | def max_denoise(model_sampling, sigmas): function do_sample (line 300) | def do_sample( function sample_images (line 374) | def sample_images( function sample_image_inference (line 473) | def sample_image_inference( class FlowMatchEulerDiscreteSchedulerOutput (line 614) | class FlowMatchEulerDiscreteSchedulerOutput(BaseOutput): class FlowMatchEulerDiscreteScheduler (line 627) | class FlowMatchEulerDiscreteScheduler(SchedulerMixin, ConfigMixin): method __init__ (line 648) | def __init__( method step_index (line 669) | def step_index(self): method begin_index (line 676) | def begin_index(self): method set_begin_index (line 683) | def set_begin_index(self, begin_index: int = 0): method scale_noise (line 693) | def scale_noise( method _sigma_to_t (line 720) | def _sigma_to_t(self, sigma): method set_timesteps (line 723) | def set_timesteps(self, num_inference_steps: int, device: Union[str, t... method index_for_timestep (line 748) | def index_for_timestep(self, timestep, schedule_timesteps=None): method _init_step_index (line 762) | def _init_step_index(self, timestep): method step (line 770) | def step( method __len__ (line 861) | def __len__(self): function get_sigmas (line 865) | def get_sigmas(noise_scheduler, timesteps, device, n_dim=4, dtype=torch.... function compute_density_for_timestep_sampling (line 877) | def compute_density_for_timestep_sampling( function compute_loss_weighting_for_sd3 (line 898) | def compute_loss_weighting_for_sd3(weighting_scheme: str, sigmas=None): function get_noisy_model_input_and_timesteps (line 918) | def get_noisy_model_input_and_timesteps(args, latents, noise, device, dt... FILE: library/sd3_utils.py function analyze_state_dict_state (line 30) | def analyze_state_dict_state(state_dict: Dict, prefix: str = ""): function load_mmdit (line 78) | def load_mmdit( function load_clip_l (line 100) | def load_clip_l( function load_clip_g (line 160) | def load_clip_g( function load_t5xxl (line 215) | def load_t5xxl( function load_vae (line 239) | def load_vae( class ModelSamplingDiscreteFlow (line 270) | class ModelSamplingDiscreteFlow: method __init__ (line 273) | def __init__(self, shift=1.0): method sigma_min (line 279) | def sigma_min(self): method sigma_max (line 283) | def sigma_max(self): method timestep (line 286) | def timestep(self, sigma): method sigma (line 289) | def sigma(self, timestep: torch.Tensor): method calculate_denoised (line 295) | def calculate_denoised(self, sigma, model_output, model_input): method noise_scaling (line 299) | def noise_scaling(self, sigma, noise, latent_image, max_denoise=False): FILE: library/sdxl_lpw_stable_diffusion.py function parse_prompt_attention (line 75) | def parse_prompt_attention(text): function get_prompts_with_weights (line 161) | def get_prompts_with_weights(pipe: StableDiffusionPipeline, prompt: List... function pad_tokens_and_weights (line 196) | def pad_tokens_and_weights(tokens, weights, max_length, bos, eos, pad, n... function get_hidden_states (line 221) | def get_hidden_states(text_encoder, input_ids, is_sdxl_text_encoder2: bo... function get_unweighted_text_embeddings (line 239) | def get_unweighted_text_embeddings( function get_weighted_text_embeddings (line 296) | def get_weighted_text_embeddings( function preprocess_image (line 437) | def preprocess_image(image): function preprocess_mask (line 447) | def preprocess_mask(mask, scale_factor=8): function prepare_controlnet_image (line 460) | def prepare_controlnet_image( class SdxlStableDiffusionLongPromptWeightingPipeline (line 512) | class SdxlStableDiffusionLongPromptWeightingPipeline: method __init__ (line 543) | def __init__( method to (line 578) | def to(self, device=None, dtype=None): method _execution_device (line 588) | def _execution_device(self): method check_inputs (line 605) | def check_inputs(self, prompt, height, width, strength, callback_steps): method get_timesteps (line 622) | def get_timesteps(self, num_inference_steps, strength, device, is_text... method run_safety_checker (line 635) | def run_safety_checker(self, image, device, dtype): method decode_latents (line 643) | def decode_latents(self, latents): method prepare_extra_step_kwargs (line 660) | def prepare_extra_step_kwargs(self, generator, eta): method prepare_latents (line 677) | def prepare_latents(self, image, timestep, batch_size, height, width, ... method __call__ (line 717) | def __call__( method latents_to_image (line 962) | def latents_to_image(self, latents): method numpy_to_pil (line 969) | def numpy_to_pil(self, images: np.ndarray) -> Image.Image: method text2img (line 984) | def text2img( method img2img (line 1079) | def img2img( method inpaint (line 1173) | def inpaint( FILE: library/sdxl_model_util.py function convert_sdxl_text_encoder_2_checkpoint (line 73) | def convert_sdxl_text_encoder_2_checkpoint(checkpoint, max_length): function _load_state_dict_on_device (line 148) | def _load_state_dict_on_device(model, state_dict, device, dtype=None): function load_models_from_sdxl_checkpoint (line 169) | def load_models_from_sdxl_checkpoint(model_version, ckpt_path, map_locat... function make_unet_conversion_map (line 299) | def make_unet_conversion_map(): function convert_diffusers_unet_state_dict_to_sdxl (line 383) | def convert_diffusers_unet_state_dict_to_sdxl(du_sd): function convert_unet_state_dict (line 390) | def convert_unet_state_dict(src_sd, conversion_map): function convert_sdxl_unet_state_dict_to_diffusers (line 408) | def convert_sdxl_unet_state_dict_to_diffusers(sd): function convert_text_encoder_2_state_dict_to_sdxl (line 415) | def convert_text_encoder_2_state_dict_to_sdxl(checkpoint, logit_scale): function save_stable_diffusion_checkpoint (line 479) | def save_stable_diffusion_checkpoint( function save_diffusers_checkpoint (line 534) | def save_diffusers_checkpoint( FILE: library/sdxl_original_control_net.py class ControlNetConditioningEmbedding (line 22) | class ControlNetConditioningEmbedding(nn.Module): method __init__ (line 23) | def __init__(self): method forward (line 41) | def forward(self, x): class SdxlControlNet (line 51) | class SdxlControlNet(sdxl_original_unet.SdxlUNet2DConditionModel): method __init__ (line 52) | def __init__(self, multiplier: Optional[float] = None, **kwargs): method init_from_unet (line 73) | def init_from_unet(self, unet: sdxl_original_unet.SdxlUNet2DConditionM... method load_state_dict (line 81) | def load_state_dict(self, state_dict: dict, strict: bool = True, assig... method state_dict (line 91) | def state_dict(self, destination=None, prefix="", keep_vars=False): method forward (line 102) | def forward( class SdxlControlledUNet (line 148) | class SdxlControlledUNet(sdxl_original_unet.SdxlUNet2DConditionModel): method __init__ (line 153) | def __init__(self, **kwargs): method forward (line 156) | def forward(self, x, timesteps=None, context=None, y=None, input_resi_... FILE: library/sdxl_original_unet.py function exists (line 62) | def exists(val): function default (line 66) | def default(val, d): class FlashAttentionFunction (line 75) | class FlashAttentionFunction(torch.autograd.Function): method forward (line 78) | def forward(ctx, q, k, v, mask, causal, q_bucket_size, k_bucket_size): method backward (line 158) | def backward(ctx, do): function get_parameter_dtype (line 230) | def get_parameter_dtype(parameter: torch.nn.Module): function get_parameter_device (line 234) | def get_parameter_device(parameter: torch.nn.Module): function get_timestep_embedding (line 238) | def get_timestep_embedding( function resize_like (line 275) | def resize_like(x, target, mode="bicubic", align_corners=False): class GroupNorm32 (line 291) | class GroupNorm32(nn.GroupNorm): method forward (line 292) | def forward(self, x): class ResnetBlock2D (line 298) | class ResnetBlock2D(nn.Module): method __init__ (line 299) | def __init__( method forward_body (line 330) | def forward_body(self, x, emb): method forward (line 338) | def forward(self, x, emb): class Downsample2D (line 355) | class Downsample2D(nn.Module): method __init__ (line 356) | def __init__(self, channels, out_channels): method forward_body (line 366) | def forward_body(self, hidden_states): method forward (line 372) | def forward(self, hidden_states): class CrossAttention (line 391) | class CrossAttention(nn.Module): method __init__ (line 392) | def __init__( method set_use_memory_efficient_attention (line 420) | def set_use_memory_efficient_attention(self, xformers, mem_eff): method set_use_sdpa (line 424) | def set_use_sdpa(self, sdpa): method reshape_heads_to_batch_dim (line 427) | def reshape_heads_to_batch_dim(self, tensor): method reshape_batch_dim_to_heads (line 434) | def reshape_batch_dim_to_heads(self, tensor): method forward (line 441) | def forward(self, hidden_states, context=None, mask=None): method _attention (line 465) | def _attention(self, query, key, value): method forward_memory_efficient_xformers (line 490) | def forward_memory_efficient_xformers(self, x, context=None, mask=None): method forward_memory_efficient_mem_eff (line 514) | def forward_memory_efficient_mem_eff(self, x, context=None, mask=None): method forward_sdpa (line 537) | def forward_sdpa(self, x, context=None, mask=None): class GEGLU (line 557) | class GEGLU(nn.Module): method __init__ (line 566) | def __init__(self, dim_in: int, dim_out: int): method gelu (line 570) | def gelu(self, gate): method forward (line 576) | def forward(self, hidden_states): class FeedForward (line 581) | class FeedForward(nn.Module): method __init__ (line 582) | def __init__( method forward (line 597) | def forward(self, hidden_states): class BasicTransformerBlock (line 603) | class BasicTransformerBlock(nn.Module): method __init__ (line 604) | def __init__( method set_use_memory_efficient_attention (line 636) | def set_use_memory_efficient_attention(self, xformers: bool, mem_eff: ... method set_use_sdpa (line 640) | def set_use_sdpa(self, sdpa: bool): method forward_body (line 644) | def forward_body(self, hidden_states, context=None, timestep=None): method forward (line 659) | def forward(self, hidden_states, context=None, timestep=None): class Transformer2DModel (line 678) | class Transformer2DModel(nn.Module): method __init__ (line 679) | def __init__( method set_use_memory_efficient_attention (line 725) | def set_use_memory_efficient_attention(self, xformers, mem_eff): method set_use_sdpa (line 729) | def set_use_sdpa(self, sdpa): method forward (line 733) | def forward(self, hidden_states, encoder_hidden_states=None, timestep=... class Upsample2D (line 765) | class Upsample2D(nn.Module): method __init__ (line 766) | def __init__(self, channels, out_channels): method forward_body (line 774) | def forward_body(self, hidden_states, output_size=None): method forward (line 802) | def forward(self, hidden_states, output_size=None): class SdxlUNet2DConditionModel (line 821) | class SdxlUNet2DConditionModel(nn.Module): method __init__ (line 824) | def __init__( method prepare_config (line 1022) | def prepare_config(self): method dtype (line 1026) | def dtype(self) -> torch.dtype: method device (line 1031) | def device(self) -> torch.device: method set_attention_slice (line 1035) | def set_attention_slice(self, slice_size): method is_gradient_checkpointing (line 1038) | def is_gradient_checkpointing(self) -> bool: method enable_gradient_checkpointing (line 1041) | def enable_gradient_checkpointing(self): method disable_gradient_checkpointing (line 1045) | def disable_gradient_checkpointing(self): method set_use_memory_efficient_attention (line 1049) | def set_use_memory_efficient_attention(self, xformers: bool, mem_eff: ... method set_use_sdpa (line 1057) | def set_use_sdpa(self, sdpa: bool) -> None: method set_gradient_checkpointing (line 1064) | def set_gradient_checkpointing(self, value=False): method forward (line 1074) | def forward(self, x, timesteps=None, context=None, y=None, **kwargs): class InferSdxlUNet2DConditionModel (line 1119) | class InferSdxlUNet2DConditionModel: method __init__ (line 1120) | def __init__(self, original_unet: SdxlUNet2DConditionModel, **kwargs): method __getattr__ (line 1135) | def __getattr__(self, name): method __call__ (line 1138) | def __call__(self, *args, **kwargs): method set_deep_shrink (line 1141) | def set_deep_shrink(self, ds_depth_1, ds_timesteps_1=650, ds_depth_2=N... method forward (line 1159) | def forward(self, x, timesteps=None, context=None, y=None, input_resi_... FILE: library/sdxl_train_util.py function load_target_model (line 28) | def load_target_model(args, accelerator, model_version: str, weight_dtype): function _load_target_model (line 65) | def _load_target_model( function load_tokenizers (line 136) | def load_tokenizers(args: argparse.Namespace): function match_mixed_precision (line 167) | def match_mixed_precision(args, weight_dtype): function timestep_embedding (line 182) | def timestep_embedding(timesteps, dim, max_period=10000): function get_timestep_embedding (line 202) | def get_timestep_embedding(x, outdim): function get_size_embeddings (line 211) | def get_size_embeddings(orig_size, crop_size, target_size, device): function save_sd_model_on_train_end (line 219) | def save_sd_model_on_train_end( function save_sd_model_on_epoch_end_or_stepwise (line 269) | def save_sd_model_on_epoch_end_or_stepwise( function add_sdxl_training_arguments (line 329) | def add_sdxl_training_arguments(parser: argparse.ArgumentParser, support... function verify_sdxl_training_args (line 348) | def verify_sdxl_training_args(args: argparse.Namespace, support_text_enc... function sample_images (line 380) | def sample_images(*args, **kwargs): FILE: library/slicing_vae.py function slice_h (line 34) | def slice_h(x, num_slices): function cat_h (line 53) | def cat_h(sliced): function resblock_forward (line 68) | def resblock_forward(_self, num_slices, input_tensor, temb, **kwargs): class SlicingEncoder (line 177) | class SlicingEncoder(nn.Module): method __init__ (line 178) | def __init__( method forward (line 268) | def forward(self, x): method downsample_forward (line 310) | def downsample_forward(self, _self, num_slices, hidden_states): class SlicingDecoder (line 360) | class SlicingDecoder(nn.Module): method __init__ (line 361) | def __init__( method forward (line 451) | def forward(self, z): method upsample_forward (line 489) | def upsample_forward(self, _self, num_slices, hidden_states, output_si... class SlicingAutoencoderKL (line 541) | class SlicingAutoencoderKL(ModelMixin, ConfigMixin): method __init__ (line 563) | def __init__( method encode (line 608) | def encode(self, x: torch.FloatTensor, return_dict: bool = True) -> Au... method _decode (line 618) | def _decode(self, z: torch.FloatTensor, return_dict: bool = True) -> U... method enable_slicing (line 628) | def enable_slicing(self): method disable_slicing (line 637) | def disable_slicing(self): method decode (line 644) | def decode(self, z: torch.FloatTensor, return_dict: bool = True) -> Un... method forward (line 656) | def forward( FILE: library/strategy_anima.py class AnimaTokenizeStrategy (line 22) | class AnimaTokenizeStrategy(TokenizeStrategy): method __init__ (line 31) | def __init__( method tokenize (line 53) | def tokenize(self, text: Union[str, List[str]]) -> List[torch.Tensor]: class AnimaTextEncodingStrategy (line 72) | class AnimaTextEncodingStrategy(TextEncodingStrategy): method __init__ (line 79) | def __init__(self) -> None: method encode_tokens (line 82) | def encode_tokens( method drop_cached_text_encoder_outputs (line 109) | def drop_cached_text_encoder_outputs( class AnimaTextEncoderOutputsCachingStrategy (line 151) | class AnimaTextEncoderOutputsCachingStrategy(TextEncoderOutputsCachingSt... method __init__ (line 159) | def __init__( method get_outputs_npz_path (line 168) | def get_outputs_npz_path(self, image_abs_path: str) -> str: method is_disk_cached_outputs_expected (line 171) | def is_disk_cached_outputs_expected(self, npz_path: str) -> bool: method load_outputs_npz (line 197) | def load_outputs_npz(self, npz_path: str) -> List[np.ndarray]: method cache_batch_outputs (line 206) | def cache_batch_outputs( class AnimaLatentsCachingStrategy (line 250) | class AnimaLatentsCachingStrategy(LatentsCachingStrategy): method __init__ (line 259) | def __init__(self, cache_to_disk: bool, batch_size: int, skip_disk_cac... method cache_suffix (line 263) | def cache_suffix(self) -> str: method get_latents_npz_path (line 266) | def get_latents_npz_path(self, absolute_path: str, image_size: Tuple[i... method is_disk_cached_latents_expected (line 269) | def is_disk_cached_latents_expected(self, bucket_reso: Tuple[int, int]... method load_latents_from_disk (line 272) | def load_latents_from_disk( method cache_batch_latents (line 277) | def cache_batch_latents(self, vae, image_infos: List, flip_aug: bool, ... FILE: library/strategy_base.py class TokenizeStrategy (line 23) | class TokenizeStrategy: method set_strategy (line 45) | def set_strategy(cls, strategy): method get_strategy (line 51) | def get_strategy(cls) -> Optional["TokenizeStrategy"]: method _load_tokenizer (line 54) | def _load_tokenizer( method tokenize (line 73) | def tokenize(self, text: Union[str, List[str]]) -> List[torch.Tensor]: method tokenize_with_weights (line 76) | def tokenize_with_weights(self, text: Union[str, List[str]]) -> Tuple[... method _get_weighted_input_ids (line 82) | def _get_weighted_input_ids( method _get_input_ids (line 221) | def _get_input_ids( class TextEncodingStrategy (line 287) | class TextEncodingStrategy: method set_strategy (line 291) | def set_strategy(cls, strategy): method get_strategy (line 297) | def get_strategy(cls) -> Optional["TextEncodingStrategy"]: method encode_tokens (line 300) | def encode_tokens( method encode_tokens_with_weights (line 310) | def encode_tokens_with_weights( class TextEncoderOutputsCachingStrategy (line 322) | class TextEncoderOutputsCachingStrategy: method __init__ (line 325) | def __init__( method set_strategy (line 340) | def set_strategy(cls, strategy): method get_strategy (line 346) | def get_strategy(cls) -> Optional["TextEncoderOutputsCachingStrategy"]: method cache_to_disk (line 350) | def cache_to_disk(self): method batch_size (line 354) | def batch_size(self): method is_partial (line 358) | def is_partial(self): method is_weighted (line 362) | def is_weighted(self): method get_outputs_npz_path (line 365) | def get_outputs_npz_path(self, image_abs_path: str) -> str: method load_outputs_npz (line 368) | def load_outputs_npz(self, npz_path: str) -> List[np.ndarray]: method is_disk_cached_outputs_expected (line 371) | def is_disk_cached_outputs_expected(self, npz_path: str) -> bool: method cache_batch_outputs (line 374) | def cache_batch_outputs( class LatentsCachingStrategy (line 380) | class LatentsCachingStrategy: method __init__ (line 385) | def __init__(self, cache_to_disk: bool, batch_size: int, skip_disk_cac... method set_strategy (line 391) | def set_strategy(cls, strategy): method get_strategy (line 397) | def get_strategy(cls) -> Optional["LatentsCachingStrategy"]: method cache_to_disk (line 401) | def cache_to_disk(self): method batch_size (line 405) | def batch_size(self): method cache_suffix (line 409) | def cache_suffix(self): method get_image_size_from_disk_cache_path (line 412) | def get_image_size_from_disk_cache_path(self, absolute_path: str, npz_... method get_latents_npz_path (line 416) | def get_latents_npz_path(self, absolute_path: str, image_size: Tuple[i... method is_disk_cached_latents_expected (line 419) | def is_disk_cached_latents_expected( method cache_batch_latents (line 424) | def cache_batch_latents(self, model: Any, batch: List, flip_aug: bool,... method _default_is_disk_cached_latents_expected (line 427) | def _default_is_disk_cached_latents_expected( method _default_cache_batch_latents (line 475) | def _default_cache_batch_latents( method load_latents_from_disk (line 542) | def load_latents_from_disk( method _default_load_latents_from_disk (line 563) | def _default_load_latents_from_disk( method save_latents_to_disk (line 598) | def save_latents_to_disk( FILE: library/strategy_flux.py class FluxTokenizeStrategy (line 23) | class FluxTokenizeStrategy(TokenizeStrategy): method __init__ (line 24) | def __init__(self, t5xxl_max_length: int = 512, tokenizer_cache_dir: O... method tokenize (line 29) | def tokenize(self, text: Union[str, List[str]]) -> List[torch.Tensor]: class FluxTextEncodingStrategy (line 42) | class FluxTextEncodingStrategy(TextEncodingStrategy): method __init__ (line 43) | def __init__(self, apply_t5_attn_mask: Optional[bool] = None) -> None: method encode_tokens (line 50) | def encode_tokens( class FluxTextEncoderOutputsCachingStrategy (line 88) | class FluxTextEncoderOutputsCachingStrategy(TextEncoderOutputsCachingStr... method __init__ (line 91) | def __init__( method get_outputs_npz_path (line 104) | def get_outputs_npz_path(self, image_abs_path: str) -> str: method is_disk_cached_outputs_expected (line 107) | def is_disk_cached_outputs_expected(self, npz_path: str): method load_outputs_npz (line 136) | def load_outputs_npz(self, npz_path: str) -> List[np.ndarray]: method cache_batch_outputs (line 145) | def cache_batch_outputs( class FluxLatentsCachingStrategy (line 197) | class FluxLatentsCachingStrategy(LatentsCachingStrategy): method __init__ (line 200) | def __init__(self, cache_to_disk: bool, batch_size: int, skip_disk_cac... method cache_suffix (line 204) | def cache_suffix(self) -> str: method get_latents_npz_path (line 207) | def get_latents_npz_path(self, absolute_path: str, image_size: Tuple[i... method is_disk_cached_latents_expected (line 214) | def is_disk_cached_latents_expected(self, bucket_reso: Tuple[int, int]... method load_latents_from_disk (line 217) | def load_latents_from_disk( method cache_batch_latents (line 223) | def cache_batch_latents(self, vae, image_infos: List, flip_aug: bool, ... FILE: library/strategy_hunyuan_image.py class HunyuanImageTokenizeStrategy (line 18) | class HunyuanImageTokenizeStrategy(TokenizeStrategy): method __init__ (line 19) | def __init__(self, tokenizer_cache_dir: Optional[str] = None) -> None: method tokenize (line 27) | def tokenize(self, text: Union[str, List[str]]) -> List[torch.Tensor]: class HunyuanImageTextEncodingStrategy (line 49) | class HunyuanImageTextEncodingStrategy(TextEncodingStrategy): method __init__ (line 50) | def __init__(self) -> None: method encode_tokens (line 53) | def encode_tokens( class HunyuanImageTextEncoderOutputsCachingStrategy (line 82) | class HunyuanImageTextEncoderOutputsCachingStrategy(TextEncoderOutputsCa... method __init__ (line 85) | def __init__( method get_outputs_npz_path (line 90) | def get_outputs_npz_path(self, image_abs_path: str) -> str: method is_disk_cached_outputs_expected (line 96) | def is_disk_cached_outputs_expected(self, npz_path: str): method load_outputs_npz (line 122) | def load_outputs_npz(self, npz_path: str) -> List[np.ndarray]: method cache_batch_outputs (line 131) | def cache_batch_outputs( class HunyuanImageLatentsCachingStrategy (line 174) | class HunyuanImageLatentsCachingStrategy(LatentsCachingStrategy): method __init__ (line 177) | def __init__(self, cache_to_disk: bool, batch_size: int, skip_disk_cac... method cache_suffix (line 181) | def cache_suffix(self) -> str: method get_latents_npz_path (line 184) | def get_latents_npz_path(self, absolute_path: str, image_size: Tuple[i... method is_disk_cached_latents_expected (line 191) | def is_disk_cached_latents_expected(self, bucket_reso: Tuple[int, int]... method load_latents_from_disk (line 194) | def load_latents_from_disk( method cache_batch_latents (line 200) | def cache_batch_latents( FILE: library/strategy_lumina.py class LuminaTokenizeStrategy (line 26) | class LuminaTokenizeStrategy(TokenizeStrategy): method __init__ (line 27) | def __init__( method tokenize (line 46) | def tokenize( method tokenize_with_weights (line 74) | def tokenize_with_weights( class LuminaTextEncodingStrategy (line 91) | class LuminaTextEncodingStrategy(TextEncodingStrategy): method __init__ (line 92) | def __init__(self) -> None: method encode_tokens (line 95) | def encode_tokens( method encode_tokens_with_weights (line 125) | def encode_tokens_with_weights( class LuminaTextEncoderOutputsCachingStrategy (line 147) | class LuminaTextEncoderOutputsCachingStrategy(TextEncoderOutputsCachingS... method __init__ (line 150) | def __init__( method get_outputs_npz_path (line 164) | def get_outputs_npz_path(self, image_abs_path: str) -> str: method is_disk_cached_outputs_expected (line 170) | def is_disk_cached_outputs_expected(self, npz_path: str) -> bool: method load_outputs_npz (line 199) | def load_outputs_npz(self, npz_path: str) -> List[np.ndarray]: method cache_batch_outputs (line 213) | def cache_batch_outputs( class LuminaLatentsCachingStrategy (line 284) | class LuminaLatentsCachingStrategy(LatentsCachingStrategy): method __init__ (line 287) | def __init__( method cache_suffix (line 293) | def cache_suffix(self) -> str: method get_latents_npz_path (line 296) | def get_latents_npz_path( method is_disk_cached_latents_expected (line 305) | def is_disk_cached_latents_expected( method load_latents_from_disk (line 323) | def load_latents_from_disk( method cache_batch_latents (line 351) | def cache_batch_latents( FILE: library/strategy_sd.py class SdTokenizeStrategy (line 21) | class SdTokenizeStrategy(TokenizeStrategy): method __init__ (line 22) | def __init__(self, v2: bool, max_length: Optional[int], tokenizer_cach... method tokenize (line 39) | def tokenize(self, text: Union[str, List[str]]) -> List[torch.Tensor]: method tokenize_with_weights (line 43) | def tokenize_with_weights(self, text: str | List[str]) -> Tuple[List[t... class SdTextEncodingStrategy (line 54) | class SdTextEncodingStrategy(TextEncodingStrategy): method __init__ (line 55) | def __init__(self, clip_skip: Optional[int] = None) -> None: method encode_tokens (line 58) | def encode_tokens( method encode_tokens_with_weights (line 108) | def encode_tokens_with_weights( class SdSdxlLatentsCachingStrategy (line 133) | class SdSdxlLatentsCachingStrategy(LatentsCachingStrategy): method __init__ (line 141) | def __init__(self, sd: bool, cache_to_disk: bool, batch_size: int, ski... method cache_suffix (line 149) | def cache_suffix(self) -> str: method get_latents_npz_path (line 152) | def get_latents_npz_path(self, absolute_path: str, image_size: Tuple[i... method is_disk_cached_latents_expected (line 159) | def is_disk_cached_latents_expected(self, bucket_reso: Tuple[int, int]... method cache_batch_latents (line 163) | def cache_batch_latents(self, vae, image_infos: List, flip_aug: bool, ... FILE: library/strategy_sd3.py class Sd3TokenizeStrategy (line 26) | class Sd3TokenizeStrategy(TokenizeStrategy): method __init__ (line 27) | def __init__(self, t5xxl_max_length: int = 256, tokenizer_cache_dir: O... method tokenize (line 34) | def tokenize(self, text: Union[str, List[str]]) -> List[torch.Tensor]: class Sd3TextEncodingStrategy (line 51) | class Sd3TextEncodingStrategy(TextEncodingStrategy): method __init__ (line 52) | def __init__( method encode_tokens (line 70) | def encode_tokens( method drop_cached_text_encoder_outputs (line 212) | def drop_cached_text_encoder_outputs( method concat_encodings (line 247) | def concat_encodings( class Sd3TextEncoderOutputsCachingStrategy (line 256) | class Sd3TextEncoderOutputsCachingStrategy(TextEncoderOutputsCachingStra... method __init__ (line 259) | def __init__( method get_outputs_npz_path (line 272) | def get_outputs_npz_path(self, image_abs_path: str) -> str: method is_disk_cached_outputs_expected (line 275) | def is_disk_cached_outputs_expected(self, npz_path: str): method load_outputs_npz (line 311) | def load_outputs_npz(self, npz_path: str) -> List[np.ndarray]: method cache_batch_outputs (line 324) | def cache_batch_outputs( class Sd3LatentsCachingStrategy (line 384) | class Sd3LatentsCachingStrategy(LatentsCachingStrategy): method __init__ (line 387) | def __init__(self, cache_to_disk: bool, batch_size: int, skip_disk_cac... method cache_suffix (line 391) | def cache_suffix(self) -> str: method get_latents_npz_path (line 394) | def get_latents_npz_path(self, absolute_path: str, image_size: Tuple[i... method is_disk_cached_latents_expected (line 401) | def is_disk_cached_latents_expected(self, bucket_reso: Tuple[int, int]... method load_latents_from_disk (line 404) | def load_latents_from_disk( method cache_batch_latents (line 410) | def cache_batch_latents(self, vae, image_infos: List, flip_aug: bool, ... FILE: library/strategy_sdxl.py class SdxlTokenizeStrategy (line 22) | class SdxlTokenizeStrategy(TokenizeStrategy): method __init__ (line 23) | def __init__(self, max_length: Optional[int], tokenizer_cache_dir: Opt... method tokenize (line 33) | def tokenize(self, text: Union[str, List[str]]) -> List[torch.Tensor]: method tokenize_with_weights (line 40) | def tokenize_with_weights(self, text: str | List[str]) -> Tuple[List[t... class SdxlTextEncodingStrategy (line 57) | class SdxlTextEncodingStrategy(TextEncodingStrategy): method __init__ (line 58) | def __init__(self) -> None: method _pool_workaround (line 61) | def _pool_workaround( method _get_hidden_states_sdxl (line 105) | def _get_hidden_states_sdxl( method encode_tokens (line 171) | def encode_tokens( method encode_tokens_with_weights (line 195) | def encode_tokens_with_weights( class SdxlTextEncoderOutputsCachingStrategy (line 222) | class SdxlTextEncoderOutputsCachingStrategy(TextEncoderOutputsCachingStr... method __init__ (line 225) | def __init__( method get_outputs_npz_path (line 235) | def get_outputs_npz_path(self, image_abs_path: str) -> str: method is_disk_cached_outputs_expected (line 238) | def is_disk_cached_outputs_expected(self, npz_path: str): method load_outputs_npz (line 256) | def load_outputs_npz(self, npz_path: str) -> List[np.ndarray]: method cache_batch_outputs (line 263) | def cache_batch_outputs( FILE: library/train_util.py function split_train_val (line 142) | def split_train_val( class ImageInfo (line 181) | class ImageInfo: method __init__ (line 182) | def __init__( class BucketManager (line 216) | class BucketManager: method __init__ (line 217) | def __init__(self, no_upscale, max_reso, min_size, max_size, reso_step... method add_image (line 240) | def add_image(self, reso, image_or_info): method shuffle (line 244) | def shuffle(self): method sort (line 248) | def sort(self): method make_buckets (line 264) | def make_buckets(self): method set_predefined_resos (line 268) | def set_predefined_resos(self, resos): method add_if_new_reso (line 274) | def add_if_new_reso(self, reso): method round_to_steps (line 282) | def round_to_steps(self, x): method select_bucket (line 286) | def select_bucket(self, image_width, image_height): method get_crop_ltrb (line 349) | def get_crop_ltrb(bucket_reso: Tuple[int, int], image_size: Tuple[int,... class BucketBatchIndex (line 369) | class BucketBatchIndex(NamedTuple): class AugHelper (line 375) | class AugHelper: method __init__ (line 378) | def __init__(self): method color_aug (line 381) | def color_aug(self, image: np.ndarray): method get_augmentor (line 408) | def get_augmentor(self, use_color_aug: bool): # -> Optional[Callable[... class BaseSubset (line 412) | class BaseSubset: method __init__ (line 413) | def __init__( class DreamBoothSubset (line 472) | class DreamBoothSubset(BaseSubset): method __init__ (line 473) | def __init__( method __eq__ (line 540) | def __eq__(self, other) -> bool: class FineTuningSubset (line 546) | class FineTuningSubset(BaseSubset): method __init__ (line 547) | def __init__( method __eq__ (line 606) | def __eq__(self, other) -> bool: class ControlNetSubset (line 612) | class ControlNetSubset(BaseSubset): method __init__ (line 613) | def __init__( method __eq__ (line 677) | def __eq__(self, other) -> bool: class BaseDataset (line 683) | class BaseDataset(torch.utils.data.Dataset): method __init__ (line 684) | def __init__( method set_current_strategies (line 742) | def set_current_strategies(self): method adjust_min_max_bucket_reso_by_steps (line 747) | def adjust_min_max_bucket_reso_by_steps( method set_seed (line 775) | def set_seed(self, seed): method set_caching_mode (line 778) | def set_caching_mode(self, mode): method set_current_epoch (line 781) | def set_current_epoch(self, epoch): method set_current_step (line 794) | def set_current_step(self, step): method set_max_train_steps (line 797) | def set_max_train_steps(self, max_train_steps): method set_tag_frequency (line 800) | def set_tag_frequency(self, dir_name, captions): method disable_token_padding (line 811) | def disable_token_padding(self): method enable_XTI (line 814) | def enable_XTI(self, layers=None, token_strings=None): method add_replacement (line 818) | def add_replacement(self, str_from, str_to): method process_caption (line 821) | def process_caption(self, subset: BaseSubset, caption): method get_input_ids (line 934) | def get_input_ids(self, caption, tokenizer=None): method register_image (line 983) | def register_image(self, info: ImageInfo, subset: BaseSubset): method make_buckets (line 987) | def make_buckets(self): method shuffle_buckets (line 1086) | def shuffle_buckets(self): method verify_bucket_reso_steps (line 1093) | def verify_bucket_reso_steps(self, min_steps: int): method is_latent_cacheable (line 1099) | def is_latent_cacheable(self): method is_text_encoder_output_cacheable (line 1102) | def is_text_encoder_output_cacheable(self, cache_supports_dropout: boo... method new_cache_latents (line 1115) | def new_cache_latents(self, model: Any, accelerator: Accelerator): method cache_latents (line 1222) | def cache_latents(self, vae, vae_batch_size=1, cache_to_disk=False, is... method new_cache_text_encoder_outputs (line 1297) | def new_cache_text_encoder_outputs(self, models: List[Any], accelerato... method cache_text_encoder_outputs (line 1356) | def cache_text_encoder_outputs( method cache_text_encoder_outputs_sd3 (line 1365) | def cache_text_encoder_outputs_sd3( method cache_text_encoder_outputs_common (line 1380) | def cache_text_encoder_outputs_common( method get_image_size (line 1478) | def get_image_size(self, image_path): method load_image_with_face_info (line 1493) | def load_image_with_face_info(self, subset: BaseSubset, image_path: st... method crop_target (line 1508) | def crop_target(self, subset: BaseSubset, image, face_cx, face_cy, fac... method __len__ (line 1555) | def __len__(self): method __getitem__ (line 1558) | def __getitem__(self, index): method get_item_for_caching (line 1828) | def get_item_for_caching(self, bucket, bucket_batch_size, image_index): class DreamBoothDataset (line 1895) | class DreamBoothDataset(BaseDataset): method __init__ (line 1901) | def __init__( class FineTuningDataset (line 2187) | class FineTuningDataset(BaseDataset): method __init__ (line 2188) | def __init__( class ControlNetDataset (line 2374) | class ControlNetDataset(BaseDataset): method __init__ (line 2375) | def __init__( method set_current_strategies (line 2496) | def set_current_strategies(self): method make_buckets (line 2499) | def make_buckets(self): method cache_latents (line 2504) | def cache_latents(self, vae, vae_batch_size=1, cache_to_disk=False, is... method new_cache_latents (line 2507) | def new_cache_latents(self, model: Any, accelerator: Accelerator): method new_cache_text_encoder_outputs (line 2510) | def new_cache_text_encoder_outputs(self, models: List[Any], is_main_pr... method __len__ (line 2513) | def __len__(self): method __getitem__ (line 2516) | def __getitem__(self, index): class DatasetGroup (line 2583) | class DatasetGroup(torch.utils.data.ConcatDataset): method __init__ (line 2584) | def __init__(self, datasets: Sequence[Union[DreamBoothDataset, FineTun... method add_replacement (line 2601) | def add_replacement(self, str_from, str_to): method set_text_encoder_output_caching_strategy (line 2609) | def set_text_encoder_output_caching_strategy(self, strategy: TextEncod... method enable_XTI (line 2616) | def enable_XTI(self, *args, **kwargs): method cache_latents (line 2620) | def cache_latents(self, vae, vae_batch_size=1, cache_to_disk=False, is... method new_cache_latents (line 2625) | def new_cache_latents(self, model: Any, accelerator: Accelerator): method cache_text_encoder_outputs (line 2631) | def cache_text_encoder_outputs( method cache_text_encoder_outputs_sd3 (line 2638) | def cache_text_encoder_outputs_sd3( method new_cache_text_encoder_outputs (line 2647) | def new_cache_text_encoder_outputs(self, models: List[Any], accelerato... method set_caching_mode (line 2653) | def set_caching_mode(self, caching_mode): method verify_bucket_reso_steps (line 2657) | def verify_bucket_reso_steps(self, min_steps: int): method get_resolutions (line 2661) | def get_resolutions(self) -> List[Tuple[int, int]]: method is_latent_cacheable (line 2664) | def is_latent_cacheable(self) -> bool: method is_text_encoder_output_cacheable (line 2667) | def is_text_encoder_output_cacheable(self, cache_supports_dropout: boo... method set_current_strategies (line 2670) | def set_current_strategies(self): method set_current_epoch (line 2674) | def set_current_epoch(self, epoch): method set_current_step (line 2678) | def set_current_step(self, step): method set_max_train_steps (line 2682) | def set_max_train_steps(self, max_train_steps): method disable_token_padding (line 2686) | def disable_token_padding(self): function is_disk_cached_latents_is_expected (line 2691) | def is_disk_cached_latents_is_expected(reso, npz_path: str, flip_aug: bo... function debug_dataset (line 2757) | def debug_dataset(train_dataset, show_input_ids=False): function glob_images (line 2847) | def glob_images(directory, base="*"): function glob_images_pathlib (line 2859) | def glob_images_pathlib(dir_path, recursive): class MinimalDataset (line 2872) | class MinimalDataset(BaseDataset): method __init__ (line 2873) | def __init__(self, resolution, network_multiplier, debug_dataset=False): method verify_bucket_reso_steps (line 2888) | def verify_bucket_reso_steps(self, min_steps: int): method is_latent_cacheable (line 2891) | def is_latent_cacheable(self) -> bool: method __len__ (line 2894) | def __len__(self): method set_current_epoch (line 2898) | def set_current_epoch(self, epoch): method __getitem__ (line 2901) | def __getitem__(self, idx): method get_resolutions (line 2935) | def get_resolutions(self) -> List[Tuple[int, int]]: function load_arbitrary_dataset (line 2939) | def load_arbitrary_dataset(args, tokenizer=None) -> MinimalDataset: function load_image (line 2948) | def load_image(image_path, alpha=False): function trim_and_resize_if_required (line 2965) | def trim_and_resize_if_required( function load_images_and_masks_for_caching (line 2997) | def load_images_and_masks_for_caching( function cache_batch_latents (line 3043) | def cache_batch_latents( function cache_batch_text_encoder_outputs (line 3120) | def cache_batch_text_encoder_outputs( function cache_batch_text_encoder_outputs_sd3 (line 3152) | def cache_batch_text_encoder_outputs_sd3( function save_text_encoder_outputs_to_disk (line 3180) | def save_text_encoder_outputs_to_disk(npz_path, hidden_state1, hidden_st... function load_text_encoder_outputs_from_disk (line 3189) | def load_text_encoder_outputs_from_disk(npz_path): function exists (line 3215) | def exists(val): function default (line 3219) | def default(val, d): function model_hash (line 3223) | def model_hash(filename): function calculate_sha256 (line 3240) | def calculate_sha256(filename): function precalculate_safetensors_hashes (line 3259) | def precalculate_safetensors_hashes(tensors, metadata): function addnet_hash_legacy (line 3276) | def addnet_hash_legacy(b): function addnet_hash_safetensors (line 3285) | def addnet_hash_safetensors(b): function get_git_revision_hash (line 3302) | def get_git_revision_hash() -> str: function replace_unet_modules (line 3362) | def replace_unet_modules(unet: UNet2DConditionModel, mem_eff_attn, xform... function load_metadata_from_safetensors (line 3439) | def load_metadata_from_safetensors(safetensors_file: str) -> dict: function build_minimum_network_metadata (line 3472) | def build_minimum_network_metadata( function get_sai_model_spec (line 3495) | def get_sai_model_spec( function get_sai_model_spec_dataclass (line 3573) | def get_sai_model_spec_dataclass( function add_sd_models_arguments (line 3641) | def add_sd_models_arguments(parser: argparse.ArgumentParser): function add_optimizer_arguments (line 3663) | def add_optimizer_arguments(parser: argparse.ArgumentParser): function add_training_arguments (line 3794) | def add_training_arguments(parser: argparse.ArgumentParser, support_drea... function add_masked_loss_arguments (line 4237) | def add_masked_loss_arguments(parser: argparse.ArgumentParser): function add_dit_training_arguments (line 4251) | def add_dit_training_arguments(parser: argparse.ArgumentParser): function get_sanitized_config_or_none (line 4317) | def get_sanitized_config_or_none(args: argparse.Namespace): function verify_command_line_training_args (line 4354) | def verify_command_line_training_args(args: argparse.Namespace): function enable_high_vram (line 4407) | def enable_high_vram(args: argparse.Namespace): function verify_training_args (line 4414) | def verify_training_args(args: argparse.Namespace): function add_dataset_arguments (line 4475) | def add_dataset_arguments( function add_sd_saving_arguments (line 4685) | def add_sd_saving_arguments(parser: argparse.ArgumentParser): function read_config_from_file (line 4700) | def read_config_from_file(args: argparse.Namespace, parser: argparse.Arg... function resume_from_local_or_hf_if_specified (line 4772) | def resume_from_local_or_hf_if_specified(accelerator, args): function get_optimizer (line 4825) | def get_optimizer(args, trainable_params) -> tuple[str, str, object]: function get_optimizer_train_eval_fn (line 5228) | def get_optimizer_train_eval_fn(optimizer: Optimizer, args: argparse.Nam... function is_schedulefree_optimizer (line 5240) | def is_schedulefree_optimizer(optimizer: Optimizer, args: argparse.Names... function get_dummy_scheduler (line 5244) | def get_dummy_scheduler(optimizer: Optimizer) -> Any: function get_scheduler_fix (line 5265) | def get_scheduler_fix(args, optimizer: Optimizer, num_processes: int): function prepare_dataset_args (line 5402) | def prepare_dataset_args(args: argparse.Namespace, support_metadata: bool): function prepare_accelerator (line 5432) | def prepare_accelerator(args: argparse.Namespace): function prepare_dtype (line 5507) | def prepare_dtype(args: argparse.Namespace): function _load_target_model (line 5525) | def _load_target_model(args: argparse.Namespace, weight_dtype, device="c... function load_target_model (line 5571) | def load_target_model(args, weight_dtype, accelerator, unet_use_linear_p... function patch_accelerator_for_fp16_training (line 5593) | def patch_accelerator_for_fp16_training(accelerator): function get_hidden_states (line 5608) | def get_hidden_states(args: argparse.Namespace, input_ids, tokenizer, te... function pool_workaround (line 5657) | def pool_workaround( function get_hidden_states_sdxl (line 5700) | def get_hidden_states_sdxl( function default_if_none (line 5767) | def default_if_none(value, default): function get_epoch_ckpt_name (line 5771) | def get_epoch_ckpt_name(args: argparse.Namespace, ext: str, epoch_no: int): function get_step_ckpt_name (line 5776) | def get_step_ckpt_name(args: argparse.Namespace, ext: str, step_no: int): function get_last_ckpt_name (line 5781) | def get_last_ckpt_name(args: argparse.Namespace, ext: str): function get_remove_epoch_no (line 5786) | def get_remove_epoch_no(args: argparse.Namespace, epoch_no: int): function get_remove_step_no (line 5796) | def get_remove_step_no(args: argparse.Namespace, step_no: int): function save_sd_model_on_epoch_end_or_stepwise (line 5811) | def save_sd_model_on_epoch_end_or_stepwise( function save_sd_model_on_epoch_end_or_stepwise_common (line 5851) | def save_sd_model_on_epoch_end_or_stepwise_common( function save_and_remove_state_on_epoch_end (line 5938) | def save_and_remove_state_on_epoch_end(args: argparse.Namespace, acceler... function save_and_remove_state_stepwise (line 5960) | def save_and_remove_state_stepwise(args: argparse.Namespace, accelerator... function save_state_on_train_end (line 5986) | def save_state_on_train_end(args: argparse.Namespace, accelerator): function save_sd_model_on_train_end (line 6001) | def save_sd_model_on_train_end( function save_sd_model_on_train_end_common (line 6029) | def save_sd_model_on_train_end_common( function get_timesteps (line 6062) | def get_timesteps(min_timestep: int, max_timestep: int, b_size: int, dev... function get_noise_noisy_latents_and_timesteps (line 6071) | def get_noise_noisy_latents_and_timesteps( function get_huber_threshold_if_needed (line 6110) | def get_huber_threshold_if_needed(args, timesteps: torch.Tensor, noise_s... function conditional_loss (line 6133) | def conditional_loss( function append_lr_to_logs (line 6168) | def append_lr_to_logs(logs, lr_scheduler, optimizer_type, including_unet... function append_lr_to_logs_with_names (line 6179) | def append_lr_to_logs_with_names(logs, lr_scheduler, optimizer_type, nam... function get_my_scheduler (line 6199) | def get_my_scheduler( function sample_images (line 6250) | def sample_images(*args, **kwargs): function line_to_prompt_dict (line 6254) | def line_to_prompt_dict(line: str) -> dict: function load_prompts (line 6329) | def load_prompts(prompt_file: str) -> List[Dict]: function sample_images_common (line 6360) | def sample_images_common( function sample_image_inference (line 6493) | def sample_image_inference( function init_trackers (line 6589) | def init_trackers(accelerator: Accelerator, args: argparse.Namespace, de... class ImageLoadingDataset (line 6623) | class ImageLoadingDataset(torch.utils.data.Dataset): method __init__ (line 6624) | def __init__(self, image_paths): method __len__ (line 6627) | def __len__(self): method __getitem__ (line 6630) | def __getitem__(self, idx): class collator_class (line 6648) | class collator_class: method __init__ (line 6649) | def __init__(self, epoch, step, dataset): method __call__ (line 6654) | def __call__(self, examples): class LossRecorder (line 6668) | class LossRecorder: method __init__ (line 6669) | def __init__(self): method add (line 6673) | def add(self, *, epoch: int, step: int, loss: float) -> None: method moving_average (line 6684) | def moving_average(self) -> float: FILE: library/utils.py function fire_in_thread (line 17) | def fire_in_thread(f, *args, **kwargs): function add_logging_arguments (line 24) | def add_logging_arguments(parser): function setup_logging (line 41) | def setup_logging(args=None, log_level=None, reset=False): function swap_weight_devices (line 98) | def swap_weight_devices(layer_to_cpu: nn.Module, layer_to_cuda: nn.Module): function weighs_to_device (line 126) | def weighs_to_device(layer: nn.Module, device: torch.device): function str_to_dtype (line 132) | def str_to_dtype(s: Optional[str], default_dtype: Optional[torch.dtype] ... function pil_resize (line 197) | def pil_resize(image, size, interpolation): function resize_image (line 216) | def resize_image( function get_cv2_interpolation (line 267) | def get_cv2_interpolation(interpolation: Optional[str]) -> Optional[int]: function get_pil_interpolation (line 298) | def get_pil_interpolation(interpolation: Optional[str]) -> Optional[Imag... function validate_interpolation_fn (line 330) | def validate_interpolation_fn(interpolation_str: str) -> bool: class GradualLatent (line 343) | class GradualLatent: method __init__ (line 344) | def __init__( method __str__ (line 366) | def __str__(self) -> str: method apply_unshark_mask (line 374) | def apply_unshark_mask(self, x: torch.Tensor): method interpolate (line 383) | def interpolate(self, x: torch.Tensor, resized_size, unsharp=True): class EulerAncestralDiscreteSchedulerGL (line 397) | class EulerAncestralDiscreteSchedulerGL(EulerAncestralDiscreteScheduler): method __init__ (line 398) | def __init__(self, *args, **kwargs): method set_gradual_latent_params (line 403) | def set_gradual_latent_params(self, size, gradual_latent: GradualLatent): method step (line 407) | def step( FILE: lumina_minimal_inference.py function generate_image (line 39) | def generate_image( function setup_parser (line 183) | def setup_parser() -> argparse.ArgumentParser: FILE: lumina_train.py function train (line 57) | def train(args): function setup_parser (line 909) | def setup_parser() -> argparse.ArgumentParser: FILE: lumina_train_network.py class LuminaNetworkTrainer (line 33) | class LuminaNetworkTrainer(train_network.NetworkTrainer): method __init__ (line 34) | def __init__(self): method assert_extra_args (line 39) | def assert_extra_args(self, args, train_dataset_group, val_dataset_gro... method load_target_model (line 52) | def load_target_model(self, args, weight_dtype, accelerator): method get_tokenize_strategy (line 88) | def get_tokenize_strategy(self, args): method get_tokenizers (line 91) | def get_tokenizers(self, tokenize_strategy: strategy_lumina.LuminaToke... method get_latents_caching_strategy (line 94) | def get_latents_caching_strategy(self, args): method get_text_encoding_strategy (line 97) | def get_text_encoding_strategy(self, args): method get_text_encoders_train_flags (line 100) | def get_text_encoders_train_flags(self, args, text_encoders): method get_text_encoder_outputs_caching_strategy (line 103) | def get_text_encoder_outputs_caching_strategy(self, args): method cache_text_encoder_outputs_if_needed (line 115) | def cache_text_encoder_outputs_if_needed( method sample_images (line 200) | def sample_images( method get_noise_scheduler (line 226) | def get_noise_scheduler(self, args: argparse.Namespace, device: torch.... method encode_images_to_latents (line 231) | def encode_images_to_latents(self, args, vae, images): method shift_scale_latents (line 235) | def shift_scale_latents(self, args, latents): method get_noise_pred_and_target (line 238) | def get_noise_pred_and_target( method post_process_loss (line 324) | def post_process_loss(self, loss, args, timesteps, noise_scheduler): method get_sai_model_spec (line 327) | def get_sai_model_spec(self, args): method update_metadata (line 330) | def update_metadata(self, metadata, args): method is_text_encoder_not_needed_for_training (line 340) | def is_text_encoder_not_needed_for_training(self, args): method prepare_text_encoder_grad_ckpt_workaround (line 343) | def prepare_text_encoder_grad_ckpt_workaround(self, index, text_encoder): method prepare_text_encoder_fp8 (line 346) | def prepare_text_encoder_fp8(self, index, text_encoder, te_weight_dtyp... method prepare_unet_with_accelerator (line 351) | def prepare_unet_with_accelerator( method on_validation_step_end (line 366) | def on_validation_step_end(self, args, accelerator, network, text_enco... function setup_parser (line 372) | def setup_parser() -> argparse.ArgumentParser: FILE: networks/check_lora_weights.py function main (line 10) | def main(file): function setup_parser (line 35) | def setup_parser() -> argparse.ArgumentParser: FILE: networks/control_net_lllite.py class LLLiteModule (line 38) | class LLLiteModule(torch.nn.Module): method __init__ (line 39) | def __init__(self, depth, cond_emb_dim, name, org_module, mlp_dim, dro... method set_cond_image (line 121) | def set_cond_image(self, cond_image): method set_batch_cond_only (line 139) | def set_batch_cond_only(self, cond_only, zeros): method apply_to (line 143) | def apply_to(self): method forward (line 147) | def forward(self, x): class ControlNetLLLite (line 186) | class ControlNetLLLite(torch.nn.Module): method __init__ (line 190) | def __init__( method forward (line 294) | def forward(self, x): method set_cond_image (line 297) | def set_cond_image(self, cond_image): method set_batch_cond_only (line 305) | def set_batch_cond_only(self, cond_only, zeros): method set_multiplier (line 309) | def set_multiplier(self, multiplier): method load_weights (line 313) | def load_weights(self, file): method apply_to (line 324) | def apply_to(self): method is_mergeable (line 331) | def is_mergeable(self): method merge_to (line 334) | def merge_to(self, text_encoder, unet, weights_sd, dtype, device): method enable_gradient_checkpointing (line 337) | def enable_gradient_checkpointing(self): method prepare_optimizer_params (line 341) | def prepare_optimizer_params(self): method prepare_grad_etc (line 345) | def prepare_grad_etc(self): method on_epoch_start (line 348) | def on_epoch_start(self): method get_trainable_params (line 351) | def get_trainable_params(self): method save_weights (line 354) | def save_weights(self, file, dtype, metadata): FILE: networks/control_net_lllite_for_train.py function add_lllite_modules (line 47) | def add_lllite_modules(module: torch.nn.Module, in_dim: int, depth, cond... class LLLiteLinear (line 92) | class LLLiteLinear(ORIGINAL_LINEAR): method __init__ (line 93) | def __init__(self, in_features: int, out_features: int, **kwargs): method set_lllite (line 97) | def set_lllite(self, depth, cond_emb_dim, name, mlp_dim, dropout=None,... method set_cond_image (line 109) | def set_cond_image(self, cond_image): method forward (line 112) | def forward(self, x): class LLLiteConv2d (line 134) | class LLLiteConv2d(ORIGINAL_CONV2D): method __init__ (line 135) | def __init__(self, in_channels: int, out_channels: int, kernel_size, *... method set_lllite (line 139) | def set_lllite(self, depth, cond_emb_dim, name, mlp_dim, dropout=None,... method set_cond_image (line 152) | def set_cond_image(self, cond_image): method forward (line 156) | def forward(self, x): # , cond_image=None): class SdxlUNet2DConditionModelControlNetLLLite (line 174) | class SdxlUNet2DConditionModelControlNetLLLite(sdxl_original_unet.SdxlUN... method __init__ (line 179) | def __init__(self, **kwargs): method apply_lllite (line 182) | def apply_lllite( method prepare_params (line 275) | def prepare_params(self): method get_trainable_params (line 304) | def get_trainable_params(self): method save_lllite_weights (line 307) | def save_lllite_weights(self, file, dtype, metadata): method load_lllite_weights (line 338) | def load_lllite_weights(self, file, non_lllite_unet_sd=None): method forward (line 402) | def forward(self, x, timesteps=None, context=None, y=None, cond_image=... function replace_unet_linear_and_conv2d (line 408) | def replace_unet_linear_and_conv2d(): FILE: networks/convert_anima_lora_to_comfy.py function main (line 18) | def main(args): FILE: networks/convert_flux_lora.py function convert_to_sd_scripts (line 125) | def convert_to_sd_scripts(sds_sd, ait_sd, sds_key, ait_key): function convert_to_sd_scripts_cat (line 138) | def convert_to_sd_scripts_cat(sds_sd, ait_sd, sds_key, ait_keys): function convert_ai_toolkit_to_sd_scripts (line 170) | def convert_ai_toolkit_to_sd_scripts(ait_sd): function convert_to_ai_toolkit (line 242) | def convert_to_ai_toolkit(sds_sd, ait_sd, sds_key, ait_key): function convert_to_ai_toolkit_cat (line 265) | def convert_to_ai_toolkit_cat(sds_sd, ait_sd, sds_key, ait_keys, dims=No... function convert_sd_scripts_to_ai_toolkit (line 328) | def convert_sd_scripts_to_ai_toolkit(sds_sd): function main (line 401) | def main(args): FILE: networks/convert_hunyuan_image_lora_to_comfy.py function main (line 16) | def main(args): FILE: networks/dylora.py class DyLoRAModule (line 28) | class DyLoRAModule(torch.nn.Module): method __init__ (line 34) | def __init__(self, lora_name, org_module: torch.nn.Module, multiplier=... method apply_to (line 76) | def apply_to(self): method forward (line 81) | def forward(self, x): method state_dict (line 123) | def state_dict(self, destination=None, prefix="", keep_vars=False): method _load_from_state_dict (line 151) | def _load_from_state_dict(self, state_dict, prefix, local_metadata, st... function create_network (line 176) | def create_network( function create_network_from_weights (line 231) | def create_network_from_weights(multiplier, file, vae, text_encoder, une... class DyLoRANetwork (line 268) | class DyLoRANetwork(torch.nn.Module): method __init__ (line 275) | def __init__( method set_loraplus_lr_ratio (line 366) | def set_loraplus_lr_ratio(self, loraplus_lr_ratio, loraplus_unet_lr_ra... method set_multiplier (line 374) | def set_multiplier(self, multiplier): method load_weights (line 379) | def load_weights(self, file): method apply_to (line 390) | def apply_to(self, text_encoder, unet, apply_text_encoder=True, apply_... method prepare_optimizer_params (line 435) | def prepare_optimizer_params(self, text_encoder_lr, unet_lr, default_lr): method enable_gradient_checkpointing (line 484) | def enable_gradient_checkpointing(self): method prepare_grad_etc (line 488) | def prepare_grad_etc(self, text_encoder, unet): method on_epoch_start (line 491) | def on_epoch_start(self, text_encoder, unet): method get_trainable_params (line 494) | def get_trainable_params(self): method save_weights (line 497) | def save_weights(self, file, dtype, metadata): method set_region (line 525) | def set_region(self, sub_prompt_index, is_last_network, mask): method set_current_generation (line 528) | def set_current_generation(self, batch_size, num_sub_prompts, width, h... FILE: networks/extract_lora_from_dylora.py function load_state_dict (line 18) | def load_state_dict(file_name): function save_to_file (line 30) | def save_to_file(file_name, model, metadata): function split_lora_model (line 37) | def split_lora_model(lora_sd, unit): function split (line 74) | def split(args): function setup_parser (line 104) | def setup_parser() -> argparse.ArgumentParser: FILE: networks/extract_lora_from_models.py function save_to_file (line 23) | def save_to_file(file_name, model, state_dict, dtype): function svd (line 35) | def svd( function setup_parser (line 266) | def setup_parser() -> argparse.ArgumentParser: FILE: networks/flux_extract_lora.py function save_to_file (line 27) | def save_to_file(file_name, state_dict, metadata, dtype): function svd (line 36) | def svd( function setup_parser (line 152) | def setup_parser() -> argparse.ArgumentParser: FILE: networks/flux_merge_lora.py function load_state_dict (line 24) | def load_state_dict(file_name, dtype): function save_to_file (line 39) | def save_to_file(file_name, state_dict: Dict[str, Union[Any, torch.Tenso... function merge_to_flux_model (line 53) | def merge_to_flux_model( function merge_to_flux_model_diffusers (line 195) | def merge_to_flux_model_diffusers( function merge_lora_models (line 447) | def merge_lora_models(models, ratios, merge_dtype, concat=False, shuffle... function merge (line 556) | def merge(args): function setup_parser (line 676) | def setup_parser() -> argparse.ArgumentParser: FILE: networks/lora.py class LoRAModule (line 25) | class LoRAModule(torch.nn.Module): method __init__ (line 30) | def __init__( method apply_to (line 85) | def apply_to(self): method forward (line 90) | def forward(self, x): class LoRAInfModule (line 124) | class LoRAInfModule(LoRAModule): method __init__ (line 125) | def __init__( method set_network (line 158) | def set_network(self, network): method merge_to (line 162) | def merge_to(self, sd, dtype, device): method get_weight (line 194) | def get_weight(self, multiplier=None): method set_region (line 220) | def set_region(self, region): method default_forward (line 224) | def default_forward(self, x): method forward (line 228) | def forward(self, x): method get_mask_for_x (line 242) | def get_mask_for_x(self, x): method regional_forward (line 261) | def regional_forward(self, x): method postp_to_q (line 284) | def postp_to_q(self, x): method sub_prompt_forward (line 305) | def sub_prompt_forward(self, x): method to_out_forward (line 324) | def to_out_forward(self, x): function parse_block_lr_kwargs (line 389) | def parse_block_lr_kwargs(is_sdxl: bool, nw_kwargs: Dict) -> Optional[Li... function create_network (line 416) | def create_network( function get_block_dims_and_alphas (line 515) | def get_block_dims_and_alphas( function get_block_lr_weight (line 589) | def get_block_lr_weight( function remove_block_dims_and_alphas (line 706) | def remove_block_dims_and_alphas( function get_block_index (line 719) | def get_block_index(lora_name: str, is_sdxl: bool = False) -> int: function convert_diffusers_to_sai_if_needed (line 758) | def convert_diffusers_to_sai_if_needed(weights_sd): function create_network_from_weights (line 805) | def create_network_from_weights(multiplier, file, vae, text_encoder, une... class LoRANetwork (line 861) | class LoRANetwork(torch.nn.Module): method __init__ (line 877) | def __init__( method set_multiplier (line 1062) | def set_multiplier(self, multiplier): method set_enabled (line 1067) | def set_enabled(self, is_enabled): method load_weights (line 1071) | def load_weights(self, file): method apply_to (line 1082) | def apply_to(self, text_encoder, unet, apply_text_encoder=True, apply_... method is_mergeable (line 1098) | def is_mergeable(self): method merge_to (line 1102) | def merge_to(self, text_encoder, unet, weights_sd, dtype, device): method set_block_lr_weight (line 1130) | def set_block_lr_weight(self, block_lr_weight: Optional[List[float]]): method get_lr_weight (line 1134) | def get_lr_weight(self, block_idx: int) -> float: method set_loraplus_lr_ratio (line 1139) | def set_loraplus_lr_ratio(self, loraplus_lr_ratio, loraplus_unet_lr_ra... method prepare_optimizer_params (line 1148) | def prepare_optimizer_params(self, text_encoder_lr, unet_lr, default_lr): method enable_gradient_checkpointing (line 1242) | def enable_gradient_checkpointing(self): method prepare_grad_etc (line 1246) | def prepare_grad_etc(self, text_encoder, unet): method on_epoch_start (line 1249) | def on_epoch_start(self, text_encoder, unet): method get_trainable_params (line 1252) | def get_trainable_params(self): method save_weights (line 1255) | def save_weights(self, file, dtype, metadata): method set_region (line 1283) | def set_region(self, sub_prompt_index, is_last_network, mask): method set_current_generation (line 1294) | def set_current_generation(self, batch_size, num_sub_prompts, width, h... method backup_weights (line 1332) | def backup_weights(self): method restore_weights (line 1342) | def restore_weights(self): method pre_calculation (line 1353) | def pre_calculation(self): method apply_max_norm_regularization (line 1369) | def apply_max_norm_regularization(self, max_norm_value, device): FILE: networks/lora_anima.py function create_network (line 16) | def create_network( function create_network_from_weights (line 130) | def create_network_from_weights(multiplier, file, ae, text_encoders, une... class LoRANetwork (line 170) | class LoRANetwork(torch.nn.Module): method __init__ (line 181) | def __init__( method set_multiplier (line 355) | def set_multiplier(self, multiplier): method set_enabled (line 360) | def set_enabled(self, is_enabled): method load_weights (line 364) | def load_weights(self, file): method apply_to (line 375) | def apply_to(self, text_encoders, unet, apply_text_encoder=True, apply... method is_mergeable (line 390) | def is_mergeable(self): method merge_to (line 393) | def merge_to(self, text_encoders, unet, weights_sd, dtype=None, device... method set_loraplus_lr_ratio (line 420) | def set_loraplus_lr_ratio(self, loraplus_lr_ratio, loraplus_unet_lr_ra... method prepare_optimizer_params_with_multiple_te_lrs (line 428) | def prepare_optimizer_params_with_multiple_te_lrs(self, text_encoder_l... method enable_gradient_checkpointing (line 526) | def enable_gradient_checkpointing(self): method prepare_grad_etc (line 529) | def prepare_grad_etc(self, text_encoder, unet): method on_epoch_start (line 532) | def on_epoch_start(self, text_encoder, unet): method get_trainable_params (line 535) | def get_trainable_params(self): method save_weights (line 538) | def save_weights(self, file, dtype, metadata): method backup_weights (line 564) | def backup_weights(self): method restore_weights (line 573) | def restore_weights(self): method pre_calculation (line 583) | def pre_calculation(self): method apply_max_norm_regularization (line 598) | def apply_max_norm_regularization(self, max_norm_value, device): FILE: networks/lora_diffusers.py function make_unet_conversion_map (line 22) | def make_unet_conversion_map() -> Dict[str, str]: class LoRAModule (line 110) | class LoRAModule(torch.nn.Module): method __init__ (line 115) | def __init__( method apply_to (line 163) | def apply_to(self, multiplier=None): method unapply_to (line 171) | def unapply_to(self): method forward (line 177) | def forward(self, x, scale=1.0): method set_network (line 182) | def set_network(self, network): method merge_to (line 186) | def merge_to(self, multiplier=1.0): method restore_from (line 200) | def restore_from(self, multiplier=1.0): method get_weight (line 214) | def get_weight(self, multiplier=None): function create_network_from_weights (line 242) | def create_network_from_weights( function merge_lora_weights (line 268) | def merge_lora_weights(pipe, weights_sd: Dict, multiplier: float = 1.0): class LoRANetwork (line 278) | class LoRANetwork(torch.nn.Module): method __init__ (line 289) | def __init__( method convert_unet_modules (line 397) | def convert_unet_modules(self, modules_dim, modules_alpha): method set_multiplier (line 423) | def set_multiplier(self, multiplier): method apply_to (line 428) | def apply_to(self, multiplier=1.0, apply_text_encoder=True, apply_unet... method unapply_to (line 438) | def unapply_to(self): method merge_to (line 442) | def merge_to(self, multiplier=1.0): method restore_from (line 448) | def restore_from(self, multiplier=1.0): method load_state_dict (line 454) | def load_state_dict(self, state_dict: Mapping[str, Any], strict: bool ... function detach_and_move_to_cpu (line 532) | def detach_and_move_to_cpu(state_dict): function seed_everything (line 547) | def seed_everything(seed): FILE: networks/lora_fa.py class LoRAModule (line 25) | class LoRAModule(torch.nn.Module): method __init__ (line 30) | def __init__( method get_trainable_params (line 89) | def get_trainable_params(self): method requires_grad_ (line 97) | def requires_grad_(self, requires_grad: bool = True): method apply_to (line 102) | def apply_to(self): method forward (line 107) | def forward(self, x): class LoRAInfModule (line 141) | class LoRAInfModule(LoRAModule): method __init__ (line 142) | def __init__( method set_network (line 175) | def set_network(self, network): method merge_to (line 179) | def merge_to(self, sd, dtype, device): method get_weight (line 211) | def get_weight(self, multiplier=None): method set_region (line 237) | def set_region(self, region): method default_forward (line 241) | def default_forward(self, x): method forward (line 245) | def forward(self, x): method get_mask_for_x (line 259) | def get_mask_for_x(self, x): method regional_forward (line 274) | def regional_forward(self, x): method postp_to_q (line 295) | def postp_to_q(self, x): method sub_prompt_forward (line 316) | def sub_prompt_forward(self, x): method to_out_forward (line 335) | def to_out_forward(self, x): function parse_block_lr_kwargs (line 399) | def parse_block_lr_kwargs(nw_kwargs): function create_network (line 428) | def create_network( function get_block_dims_and_alphas (line 514) | def get_block_dims_and_alphas( function get_block_lr_weight (line 580) | def get_block_lr_weight( function remove_block_dims_and_alphas (line 657) | def remove_block_dims_and_alphas( function get_block_index (line 683) | def get_block_index(lora_name: str) -> int: function create_network_from_weights (line 710) | def create_network_from_weights(multiplier, file, vae, text_encoder, une... class LoRANetwork (line 753) | class LoRANetwork(torch.nn.Module): method __init__ (line 766) | def __init__( method set_multiplier (line 942) | def set_multiplier(self, multiplier): method load_weights (line 947) | def load_weights(self, file): method apply_to (line 958) | def apply_to(self, text_encoder, unet, apply_text_encoder=True, apply_... method is_mergeable (line 974) | def is_mergeable(self): method merge_to (line 978) | def merge_to(self, text_encoder, unet, weights_sd, dtype, device): method set_block_lr_weight (line 1006) | def set_block_lr_weight( method get_lr_weight (line 1017) | def get_lr_weight(self, lora: LoRAModule) -> float: method prepare_optimizer_params (line 1036) | def prepare_optimizer_params(self, text_encoder_lr, unet_lr, default_lr): method enable_gradient_checkpointing (line 1083) | def enable_gradient_checkpointing(self): method prepare_grad_etc (line 1087) | def prepare_grad_etc(self, text_encoder, unet): method on_epoch_start (line 1090) | def on_epoch_start(self, text_encoder, unet): method get_trainable_params (line 1093) | def get_trainable_params(self): method save_weights (line 1096) | def save_weights(self, file, dtype, metadata): method set_region (line 1124) | def set_region(self, sub_prompt_index, is_last_network, mask): method set_current_generation (line 1135) | def set_current_generation(self, batch_size, num_sub_prompts, width, h... method backup_weights (line 1166) | def backup_weights(self): method restore_weights (line 1176) | def restore_weights(self): method pre_calculation (line 1187) | def pre_calculation(self): method apply_max_norm_regularization (line 1203) | def apply_max_norm_regularization(self, max_norm_value, device): FILE: networks/lora_flux.py class LoRAModule (line 33) | class LoRAModule(torch.nn.Module): method __init__ (line 38) | def __init__( method apply_to (line 120) | def apply_to(self): method forward (line 126) | def forward(self, x): method initialize_norm_cache (line 204) | def initialize_norm_cache(self, org_module_weight: Tensor): method validate_norm_approximation (line 230) | def validate_norm_approximation(self, org_module_weight: Tensor, verbo... method update_norms (line 266) | def update_norms(self): method update_grad_norms (line 284) | def update_grad_norms(self): method device (line 305) | def device(self): method dtype (line 309) | def dtype(self): class LoRAInfModule (line 313) | class LoRAInfModule(LoRAModule): method __init__ (line 314) | def __init__( method set_network (line 330) | def set_network(self, network): method merge_to (line 334) | def merge_to(self, sd, dtype, device): method get_weight (line 393) | def get_weight(self, multiplier=None): method set_region (line 419) | def set_region(self, region): method default_forward (line 423) | def default_forward(self, x): method forward (line 434) | def forward(self, x): function create_network (line 440) | def create_network( function create_network_from_weights (line 659) | def create_network_from_weights(multiplier, file, ae, text_encoders, flu... class LoRANetwork (line 707) | class LoRANetwork(torch.nn.Module): method get_qkv_mlp_split_dims (line 717) | def get_qkv_mlp_split_dims(cls) -> List[int]: method __init__ (line 720) | def __init__( method set_multiplier (line 986) | def set_multiplier(self, multiplier): method set_enabled (line 991) | def set_enabled(self, is_enabled): method update_norms (line 995) | def update_norms(self): method update_grad_norms (line 999) | def update_grad_norms(self): method grad_norms (line 1003) | def grad_norms(self) -> Tensor | None: method weight_norms (line 1010) | def weight_norms(self) -> Tensor | None: method combined_weight_norms (line 1017) | def combined_weight_norms(self) -> Tensor | None: method load_weights (line 1024) | def load_weights(self, file): method load_state_dict (line 1035) | def load_state_dict(self, state_dict, strict=True): method state_dict (line 1090) | def state_dict(self, destination=None, prefix="", keep_vars=False): method apply_to (line 1140) | def apply_to(self, text_encoders, flux, apply_text_encoder=True, apply... method is_mergeable (line 1156) | def is_mergeable(self): method merge_to (line 1160) | def merge_to(self, text_encoders, flux, weights_sd, dtype=None, device... method set_loraplus_lr_ratio (line 1187) | def set_loraplus_lr_ratio(self, loraplus_lr_ratio, loraplus_unet_lr_ra... method prepare_optimizer_params_with_multiple_te_lrs (line 1195) | def prepare_optimizer_params_with_multiple_te_lrs(self, text_encoder_l... method enable_gradient_checkpointing (line 1330) | def enable_gradient_checkpointing(self): method prepare_grad_etc (line 1334) | def prepare_grad_etc(self, text_encoder, unet): method on_epoch_start (line 1337) | def on_epoch_start(self, text_encoder, unet): method get_trainable_params (line 1340) | def get_trainable_params(self): method save_weights (line 1343) | def save_weights(self, file, dtype, metadata): method backup_weights (line 1370) | def backup_weights(self): method restore_weights (line 1380) | def restore_weights(self): method pre_calculation (line 1391) | def pre_calculation(self): method apply_max_norm_regularization (line 1407) | def apply_max_norm_regularization(self, max_norm_value, device): FILE: networks/lora_hunyuan_image.py function create_network (line 32) | def create_network( function create_network_from_weights (line 153) | def create_network_from_weights(multiplier, file, ae, text_encoders, flu... class HunyuanImageLoRANetwork (line 193) | class HunyuanImageLoRANetwork(lora_flux.LoRANetwork): method get_qkv_mlp_split_dims (line 199) | def get_qkv_mlp_split_dims(cls) -> List[int]: method __init__ (line 202) | def __init__( FILE: networks/lora_interrogator.py function interrogate (line 26) | def interrogate(args): function setup_parser (line 125) | def setup_parser() -> argparse.ArgumentParser: FILE: networks/lora_lumina.py class LoRAModule (line 25) | class LoRAModule(torch.nn.Module): method __init__ (line 30) | def __init__( method apply_to (line 104) | def apply_to(self): method forward (line 109) | def forward(self, x): class LoRAInfModule (line 169) | class LoRAInfModule(LoRAModule): method __init__ (line 170) | def __init__( method set_network (line 186) | def set_network(self, network): method merge_to (line 190) | def merge_to(self, sd, dtype, device): method get_weight (line 246) | def get_weight(self, multiplier=None): method set_region (line 283) | def set_region(self, region): method default_forward (line 287) | def default_forward(self, x): method forward (line 298) | def forward(self, x): function create_network (line 304) | def create_network( function create_network_from_weights (line 412) | def create_network_from_weights(multiplier, file, ae, text_encoders, lum... class LoRANetwork (line 469) | class LoRANetwork(torch.nn.Module): method __init__ (line 475) | def __init__( method set_multiplier (line 695) | def set_multiplier(self, multiplier): method set_enabled (line 700) | def set_enabled(self, is_enabled): method load_weights (line 704) | def load_weights(self, file): method load_state_dict (line 715) | def load_state_dict(self, state_dict, strict=True): method state_dict (line 764) | def state_dict(self, destination=None, prefix="", keep_vars=False): method apply_to (line 814) | def apply_to(self, text_encoders, flux, apply_text_encoder=True, apply... method is_mergeable (line 830) | def is_mergeable(self): method merge_to (line 834) | def merge_to(self, text_encoders, flux, weights_sd, dtype=None, device... method set_loraplus_lr_ratio (line 861) | def set_loraplus_lr_ratio(self, loraplus_lr_ratio, loraplus_unet_lr_ra... method prepare_optimizer_params_with_multiple_te_lrs (line 869) | def prepare_optimizer_params_with_multiple_te_lrs(self, text_encoder_l... method enable_gradient_checkpointing (line 938) | def enable_gradient_checkpointing(self): method prepare_grad_etc (line 942) | def prepare_grad_etc(self, text_encoder, unet): method on_epoch_start (line 945) | def on_epoch_start(self, text_encoder, unet): method get_trainable_params (line 948) | def get_trainable_params(self): method save_weights (line 951) | def save_weights(self, file, dtype, metadata): method backup_weights (line 978) | def backup_weights(self): method restore_weights (line 988) | def restore_weights(self): method pre_calculation (line 999) | def pre_calculation(self): method apply_max_norm_regularization (line 1015) | def apply_max_norm_regularization(self, max_norm_value, device): FILE: networks/lora_sd3.py function create_network (line 27) | def create_network( function create_network_from_weights (line 181) | def create_network_from_weights(multiplier, file, ae, text_encoders, mmd... class LoRANetwork (line 230) | class LoRANetwork(torch.nn.Module): method __init__ (line 238) | def __init__( method set_multiplier (line 474) | def set_multiplier(self, multiplier): method set_enabled (line 479) | def set_enabled(self, is_enabled): method load_weights (line 483) | def load_weights(self, file): method load_state_dict (line 494) | def load_state_dict(self, state_dict, strict=True): method state_dict (line 528) | def state_dict(self, destination=None, prefix="", keep_vars=False): method apply_to (line 575) | def apply_to(self, text_encoders, mmdit, apply_text_encoder=True, appl... method is_mergeable (line 591) | def is_mergeable(self): method merge_to (line 595) | def merge_to(self, text_encoders, mmdit, weights_sd, dtype=None, devic... method set_loraplus_lr_ratio (line 626) | def set_loraplus_lr_ratio(self, loraplus_lr_ratio, loraplus_unet_lr_ra... method prepare_optimizer_params_with_multiple_te_lrs (line 634) | def prepare_optimizer_params_with_multiple_te_lrs(self, text_encoder_l... method enable_gradient_checkpointing (line 721) | def enable_gradient_checkpointing(self): method prepare_grad_etc (line 725) | def prepare_grad_etc(self, text_encoder, unet): method on_epoch_start (line 728) | def on_epoch_start(self, text_encoder, unet): method get_trainable_params (line 731) | def get_trainable_params(self): method save_weights (line 734) | def save_weights(self, file, dtype, metadata): method backup_weights (line 761) | def backup_weights(self): method restore_weights (line 771) | def restore_weights(self): method pre_calculation (line 782) | def pre_calculation(self): method apply_max_norm_regularization (line 798) | def apply_max_norm_regularization(self, max_norm_value, device): FILE: networks/merge_lora.py function load_state_dict (line 15) | def load_state_dict(file_name, dtype): function save_to_file (line 30) | def save_to_file(file_name, model, state_dict, dtype, metadata): function merge_to_sd_model (line 42) | def merge_to_sd_model(text_encoder, unet, models, ratios, merge_dtype): function merge_lora_models (line 116) | def merge_lora_models(models, ratios, merge_dtype, concat=False, shuffle... function merge (line 227) | def merge(args): function setup_parser (line 304) | def setup_parser() -> argparse.ArgumentParser: FILE: networks/merge_lora_old.py function load_state_dict (line 14) | def load_state_dict(file_name, dtype): function save_to_file (line 25) | def save_to_file(file_name, model, state_dict, dtype): function merge_to_sd_model (line 37) | def merge_to_sd_model(text_encoder, unet, models, ratios, merge_dtype): function merge_lora_models (line 96) | def merge_lora_models(models, ratios, merge_dtype): function merge (line 130) | def merge(args): function setup_parser (line 166) | def setup_parser() -> argparse.ArgumentParser: FILE: networks/oft.py class OFTModule (line 23) | class OFTModule(torch.nn.Module): method __init__ (line 28) | def __init__( method apply_to (line 69) | def apply_to(self): method get_weight (line 73) | def get_weight(self, multiplier=None): method forward (line 89) | def forward(self, x, scale=None): class OFTInfModule (line 113) | class OFTInfModule(OFTModule): method __init__ (line 114) | def __init__( method set_network (line 128) | def set_network(self, network): method forward (line 131) | def forward(self, x, scale=None): method merge_to (line 136) | def merge_to(self, multiplier=None): function create_network (line 155) | def create_network( function create_network_from_weights (line 199) | def create_network_from_weights(multiplier, file, vae, text_encoder, une... class OFTNetwork (line 245) | class OFTNetwork(torch.nn.Module): method __init__ (line 251) | def __init__( method set_multiplier (line 319) | def set_multiplier(self, multiplier): method load_weights (line 324) | def load_weights(self, file): method apply_to (line 335) | def apply_to(self, text_encoder, unet, apply_text_encoder=True, apply_... method is_mergeable (line 343) | def is_mergeable(self): method merge_to (line 347) | def merge_to(self, text_encoder, unet, weights_sd, dtype, device): method prepare_optimizer_params (line 361) | def prepare_optimizer_params(self, text_encoder_lr, unet_lr, default_lr): method enable_gradient_checkpointing (line 384) | def enable_gradient_checkpointing(self): method prepare_grad_etc (line 388) | def prepare_grad_etc(self, text_encoder, unet): method on_epoch_start (line 391) | def on_epoch_start(self, text_encoder, unet): method get_trainable_params (line 394) | def get_trainable_params(self): method save_weights (line 397) | def save_weights(self, file, dtype, metadata): method backup_weights (line 424) | def backup_weights(self): method restore_weights (line 434) | def restore_weights(self): method pre_calculation (line 445) | def pre_calculation(self): FILE: networks/oft_flux.py class OFTModule (line 21) | class OFTModule(torch.nn.Module): method __init__ (line 26) | def __init__( method apply_to (line 76) | def apply_to(self): method get_weight (line 80) | def get_weight(self, multiplier=None): method forward (line 102) | def forward(self, x, scale=None): class OFTInfModule (line 133) | class OFTInfModule(OFTModule): method __init__ (line 134) | def __init__( method set_network (line 149) | def set_network(self, network): method forward (line 152) | def forward(self, x, scale=None): method merge_to (line 157) | def merge_to(self, multiplier=None): function create_network (line 186) | def create_network( function create_network_from_weights (line 230) | def create_network_from_weights(multiplier, file, vae, text_encoder, une... class OFTNetwork (line 272) | class OFTNetwork(torch.nn.Module): method __init__ (line 277) | def __init__( method set_multiplier (line 342) | def set_multiplier(self, multiplier): method load_weights (line 347) | def load_weights(self, file): method apply_to (line 358) | def apply_to(self, text_encoder, unet, apply_text_encoder=True, apply_... method is_mergeable (line 366) | def is_mergeable(self): method merge_to (line 370) | def merge_to(self, text_encoder, unet, weights_sd, dtype, device): method prepare_optimizer_params (line 384) | def prepare_optimizer_params(self, text_encoder_lr, unet_lr, default_lr): method enable_gradient_checkpointing (line 407) | def enable_gradient_checkpointing(self): method prepare_grad_etc (line 411) | def prepare_grad_etc(self, text_encoder, unet): method on_epoch_start (line 414) | def on_epoch_start(self, text_encoder, unet): method get_trainable_params (line 417) | def get_trainable_params(self): method save_weights (line 420) | def save_weights(self, file, dtype, metadata): method backup_weights (line 447) | def backup_weights(self): method restore_weights (line 457) | def restore_weights(self): method pre_calculation (line 468) | def pre_calculation(self): FILE: networks/resize_lora.py function load_state_dict (line 33) | def load_state_dict(file_name, dtype): function save_to_file (line 49) | def save_to_file(file_name, state_dict, metadata): function index_sv_cumulative (line 59) | def index_sv_cumulative(S, target): function index_sv_fro (line 68) | def index_sv_fro(S, target): function index_sv_ratio (line 78) | def index_sv_ratio(S, target): function extract_conv (line 88) | def extract_conv(weight, lora_rank, dynamic_method, dynamic_param, devic... function extract_linear (line 106) | def extract_linear(weight, lora_rank, dynamic_method, dynamic_param, dev... function merge_conv (line 125) | def merge_conv(lora_down, lora_up, device): function merge_linear (line 139) | def merge_linear(lora_down, lora_up, device): function rank_resize (line 155) | def rank_resize(S, rank, dynamic_method, dynamic_param, scale=1): function resize_lora_model (line 201) | def resize_lora_model(lora_sd, new_rank, new_conv_rank, save_dtype, devi... function resize (line 306) | def resize(args): function setup_parser (line 374) | def setup_parser() -> argparse.ArgumentParser: FILE: networks/sdxl_merge_lora.py function load_state_dict (line 23) | def load_state_dict(file_name, dtype): function save_to_file (line 38) | def save_to_file(file_name, model, metadata): function detect_method_from_training_model (line 45) | def detect_method_from_training_model(models, dtype): function merge_to_sd_model (line 56) | def merge_to_sd_model(text_encoder1, text_encoder2, unet, models, ratios... function merge_lora_models (line 237) | def merge_lora_models(models, ratios, lbws, merge_dtype, concat=False, s... function merge (line 373) | def merge(args): function setup_parser (line 452) | def setup_parser() -> argparse.ArgumentParser: FILE: networks/svd_merge_lora.py function get_lbw_block_index (line 149) | def get_lbw_block_index(lora_name: str, is_sdxl: bool = False) -> int: function load_state_dict (line 204) | def load_state_dict(file_name, dtype): function save_to_file (line 219) | def save_to_file(file_name, state_dict, metadata): function format_lbws (line 226) | def format_lbws(lbws): function merge_lora_models (line 253) | def merge_lora_models(models, ratios, lbws, new_rank, new_conv_rank, dev... function merge (line 401) | def merge(args): function setup_parser (line 461) | def setup_parser() -> argparse.ArgumentParser: FILE: pytorch_lightning/callbacks/model_checkpoint.py class ModelCheckpoint (line 3) | class ModelCheckpoint: FILE: sd3_minimal_inference.py function get_noise (line 34) | def get_noise(seed, latent, device="cpu"): function get_sigmas (line 41) | def get_sigmas(sampling: sd3_utils.ModelSamplingDiscreteFlow, steps): function max_denoise (line 53) | def max_denoise(model_sampling, sigmas): function do_sample (line 59) | def do_sample( function generate_image (line 136) | def generate_image( FILE: sd3_train.py function train (line 58) | def train(args): function setup_parser (line 987) | def setup_parser() -> argparse.ArgumentParser: FILE: sd3_train_network.py class Sd3NetworkTrainer (line 25) | class Sd3NetworkTrainer(train_network.NetworkTrainer): method __init__ (line 26) | def __init__(self): method assert_extra_args (line 30) | def assert_extra_args( method load_target_model (line 74) | def load_target_model(self, args, weight_dtype, accelerator): method get_tokenize_strategy (line 146) | def get_tokenize_strategy(self, args): method get_tokenizers (line 150) | def get_tokenizers(self, tokenize_strategy: strategy_sd3.Sd3TokenizeSt... method get_latents_caching_strategy (line 153) | def get_latents_caching_strategy(self, args): method get_text_encoding_strategy (line 159) | def get_text_encoding_strategy(self, args): method post_process_network (line 168) | def post_process_network(self, args, accelerator, network, text_encode... method get_models_for_text_encoding (line 177) | def get_models_for_text_encoding(self, args, accelerator, text_encoders): method get_text_encoders_train_flags (line 186) | def get_text_encoders_train_flags(self, args, text_encoders): method get_text_encoder_outputs_caching_strategy (line 189) | def get_text_encoder_outputs_caching_strategy(self, args): method cache_text_encoder_outputs_if_needed (line 203) | def cache_text_encoder_outputs_if_needed( method sample_images (line 295) | def sample_images(self, accelerator, args, epoch, global_step, device,... method get_noise_scheduler (line 303) | def get_noise_scheduler(self, args: argparse.Namespace, device: torch.... method encode_images_to_latents (line 308) | def encode_images_to_latents(self, args, vae, images): method shift_scale_latents (line 311) | def shift_scale_latents(self, args, latents): method get_noise_pred_and_target (line 314) | def get_noise_pred_and_target( method post_process_loss (line 395) | def post_process_loss(self, loss, args, timesteps, noise_scheduler): method get_sai_model_spec (line 398) | def get_sai_model_spec(self, args): method update_metadata (line 401) | def update_metadata(self, metadata, args): method is_text_encoder_not_needed_for_training (line 409) | def is_text_encoder_not_needed_for_training(self, args): method prepare_text_encoder_grad_ckpt_workaround (line 412) | def prepare_text_encoder_grad_ckpt_workaround(self, index, text_encoder): method prepare_text_encoder_fp8 (line 418) | def prepare_text_encoder_fp8(self, index, text_encoder, te_weight_dtyp... method on_step_start (line 454) | def on_step_start(self, args, accelerator, network, text_encoders, une... method on_validation_step_end (line 462) | def on_validation_step_end(self, args, accelerator, network, text_enco... method prepare_unet_with_accelerator (line 467) | def prepare_unet_with_accelerator( function setup_parser (line 482) | def setup_parser() -> argparse.ArgumentParser: FILE: sdxl_gen_img.py function replace_unet_modules (line 89) | def replace_unet_modules(unet: UNet2DConditionModel, mem_eff_attn, xform... function replace_vae_modules (line 110) | def replace_vae_modules(vae: diffusers.models.AutoencoderKL, mem_eff_att... function replace_vae_attn_to_memory_efficient (line 120) | def replace_vae_attn_to_memory_efficient(): function replace_vae_attn_to_xformers (line 176) | def replace_vae_attn_to_xformers(): function replace_vae_attn_to_sdpa (line 232) | def replace_vae_attn_to_sdpa(): class PipelineLike (line 293) | class PipelineLike: method __init__ (line 294) | def __init__( method add_token_replacement (line 358) | def add_token_replacement(self, text_encoder_index, target_token_id, r... method set_enable_control_net (line 361) | def set_enable_control_net(self, en: bool): method get_token_replacer (line 364) | def get_token_replacer(self, tokenizer): method set_control_nets (line 384) | def set_control_nets(self, ctrl_nets): method set_gradual_latent (line 387) | def set_gradual_latent(self, gradual_latent): method __call__ (line 396) | def __call__( function parse_prompt_attention (line 962) | def parse_prompt_attention(text): function get_prompts_with_weights (line 1051) | def get_prompts_with_weights(tokenizer: CLIPTokenizer, token_replacer, p... function pad_tokens_and_weights (line 1102) | def pad_tokens_and_weights(tokens, weights, max_length, bos, eos, pad, n... function get_unweighted_text_embeddings (line 1127) | def get_unweighted_text_embeddings( function get_weighted_text_embeddings (line 1189) | def get_weighted_text_embeddings( function preprocess_image (line 1310) | def preprocess_image(image): function preprocess_mask (line 1320) | def preprocess_mask(mask): function handle_dynamic_prompt_variants (line 1344) | def handle_dynamic_prompt_variants(prompt, repeat_count): class BatchDataBase (line 1445) | class BatchDataBase(NamedTuple): class BatchDataExt (line 1458) | class BatchDataExt(NamedTuple): class BatchData (line 1476) | class BatchData(NamedTuple): function main (line 1482) | def main(args): function setup_parser (line 2838) | def setup_parser() -> argparse.ArgumentParser: FILE: sdxl_minimal_inference.py function timestep_embedding (line 46) | def timestep_embedding(timesteps, dim, max_period=10000, repeat_only=Fal... function get_timestep_embedding (line 69) | def get_timestep_embedding(x, outdim): function generate_image (line 190) | def generate_image(prompt, prompt2, negative_prompt, seed=None): FILE: sdxl_train.py function get_block_params_to_optimize (line 52) | def get_block_params_to_optimize(unet: SdxlUNet2DConditionModel, block_l... function append_block_lr_to_logs (line 80) | def append_block_lr_to_logs(block_lrs, logs, lr_scheduler, optimizer_type): function train (line 99) | def train(args): function setup_parser (line 891) | def setup_parser() -> argparse.ArgumentParser: FILE: sdxl_train_control_net.py function generate_step_logs (line 56) | def generate_step_logs(args: argparse.Namespace, current_loss, avr_loss,... function train (line 69) | def train(args): function setup_parser (line 663) | def setup_parser() -> argparse.ArgumentParser: FILE: sdxl_train_control_net_lllite.py function generate_step_logs (line 66) | def generate_step_logs(args: argparse.Namespace, current_loss, avr_loss,... function train (line 79) | def train(args): function setup_parser (line 588) | def setup_parser() -> argparse.ArgumentParser: FILE: sdxl_train_control_net_lllite_old.py function generate_step_logs (line 53) | def generate_step_logs(args: argparse.Namespace, current_loss, avr_loss,... function train (line 66) | def train(args): function setup_parser (line 535) | def setup_parser() -> argparse.ArgumentParser: FILE: sdxl_train_network.py class SdxlNetworkTrainer (line 20) | class SdxlNetworkTrainer(train_network.NetworkTrainer): method __init__ (line 21) | def __init__(self): method assert_extra_args (line 26) | def assert_extra_args( method load_target_model (line 47) | def load_target_model(self, args, weight_dtype, accelerator): method get_tokenize_strategy (line 69) | def get_tokenize_strategy(self, args): method get_tokenizers (line 72) | def get_tokenizers(self, tokenize_strategy: strategy_sdxl.SdxlTokenize... method get_latents_caching_strategy (line 75) | def get_latents_caching_strategy(self, args): method get_text_encoding_strategy (line 81) | def get_text_encoding_strategy(self, args): method get_models_for_text_encoding (line 84) | def get_models_for_text_encoding(self, args, accelerator, text_encoders): method get_text_encoder_outputs_caching_strategy (line 87) | def get_text_encoder_outputs_caching_strategy(self, args): method cache_text_encoder_outputs_if_needed (line 95) | def cache_text_encoder_outputs_if_needed( method get_text_cond (line 128) | def get_text_cond(self, args, accelerator, batch, tokenizers, text_enc... method call_unet (line 182) | def call_unet( method sample_images (line 216) | def sample_images(self, accelerator, args, epoch, global_step, device,... function setup_parser (line 220) | def setup_parser() -> argparse.ArgumentParser: FILE: sdxl_train_textual_inversion.py class SdxlTextualInversionTrainer (line 16) | class SdxlTextualInversionTrainer(train_textual_inversion.TextualInversi... method __init__ (line 17) | def __init__(self): method assert_extra_args (line 22) | def assert_extra_args(self, args, train_dataset_group: Union[train_uti... method load_target_model (line 30) | def load_target_model(self, args, weight_dtype, accelerator): method get_tokenize_strategy (line 47) | def get_tokenize_strategy(self, args): method get_tokenizers (line 50) | def get_tokenizers(self, tokenize_strategy: strategy_sdxl.SdxlTokenize... method get_latents_caching_strategy (line 53) | def get_latents_caching_strategy(self, args): method get_text_encoding_strategy (line 59) | def get_text_encoding_strategy(self, args): method call_unet (line 62) | def call_unet(self, args, accelerator, unet, noisy_latents, timesteps,... method sample_images (line 79) | def sample_images( method save_weights (line 86) | def save_weights(self, file, updated_embs, save_dtype, metadata): method load_weights (line 102) | def load_weights(self, file): function setup_parser (line 120) | def setup_parser() -> argparse.ArgumentParser: FILE: tests/library/test_flux_train_utils.py class MockNoiseScheduler (line 9) | class MockNoiseScheduler: method __init__ (line 10) | def __init__(self, num_train_timesteps=1000): function args (line 18) | def args(): function noise_scheduler (line 33) | def noise_scheduler(): function latents (line 38) | def latents(): function noise (line 43) | def noise(): function device (line 48) | def device(): function mock_functions (line 55) | def mock_functions(): function test_uniform_sampling (line 65) | def test_uniform_sampling(args, noise_scheduler, latents, noise, device): function test_sigmoid_sampling (line 78) | def test_sigmoid_sampling(args, noise_scheduler, latents, noise, device): function test_shift_sampling (line 90) | def test_shift_sampling(args, noise_scheduler, latents, noise, device): function test_flux_shift_sampling (line 103) | def test_flux_shift_sampling(args, noise_scheduler, latents, noise, devi... function test_weighting_scheme (line 115) | def test_weighting_scheme(args, noise_scheduler, latents, noise, device): function test_with_ip_noise (line 139) | def test_with_ip_noise(args, noise_scheduler, latents, noise, device): function test_with_random_ip_noise (line 151) | def test_with_random_ip_noise(args, noise_scheduler, latents, noise, dev... function test_float16_dtype (line 164) | def test_float16_dtype(args, noise_scheduler, latents, noise, device): function test_different_batch_size (line 174) | def test_different_batch_size(args, noise_scheduler, device): function test_different_image_size (line 187) | def test_different_image_size(args, noise_scheduler, device): function test_zero_batch_size (line 200) | def test_zero_batch_size(args, noise_scheduler, device): function test_different_timestep_count (line 209) | def test_different_timestep_count(args, device): FILE: tests/library/test_lumina_models.py function test_lumina_params (line 17) | def test_lumina_params(): function test_to_cuda_to_cpu (line 42) | def test_to_cuda_to_cpu(): function test_timestep_embedder (line 66) | def test_timestep_embedder(): function test_rope_embedder_simple (line 89) | def test_rope_embedder_simple(): function test_modulate (line 109) | def test_modulate(): function test_nextdit_parameter_count_optimized (line 125) | def test_nextdit_parameter_count_optimized(): function test_precompute_freqs_cis (line 159) | def test_precompute_freqs_cis(): function test_nextdit_patchify_and_embed (line 177) | def test_nextdit_patchify_and_embed(): function test_nextdit_patchify_and_embed_edge_cases (line 255) | def test_nextdit_patchify_and_embed_edge_cases(): FILE: tests/library/test_lumina_train_util.py function test_batchify (line 20) | def test_batchify(): function test_time_shift (line 49) | def test_time_shift(): function test_get_lin_function (line 66) | def test_get_lin_function(): function test_get_schedule (line 78) | def test_get_schedule(): function test_compute_density_for_timestep_sampling (line 95) | def test_compute_density_for_timestep_sampling(): function test_get_sigmas (line 112) | def test_get_sigmas(): function test_compute_loss_weighting_for_sd3 (line 134) | def test_compute_loss_weighting_for_sd3(): function test_apply_model_prediction_type (line 153) | def test_apply_model_prediction_type(): function test_retrieve_timesteps (line 181) | def test_retrieve_timesteps(): function test_get_noisy_model_input_and_timesteps (line 195) | def test_get_noisy_model_input_and_timesteps(): FILE: tests/library/test_lumina_util.py function test_unpack_latents (line 7) | def test_unpack_latents(): function test_pack_latents (line 22) | def test_pack_latents(): function test_convert_diffusers_sd_to_alpha_vllm (line 35) | def test_convert_diffusers_sd_to_alpha_vllm(): FILE: tests/library/test_sai_model_spec.py class MockArgs (line 9) | class MockArgs: method __init__ (line 12) | def __init__(self, **kwargs): class TestModelSpecMetadata (line 32) | class TestModelSpecMetadata: method test_creation_and_conversion (line 35) | def test_creation_and_conversion(self): method test_additional_fields_handling (line 55) | def test_additional_fields_handling(self): method test_from_args_extraction (line 72) | def test_from_args_extraction(self): class TestArchitectureDetection (line 89) | class TestArchitectureDetection: method test_architecture_detection (line 106) | def test_architecture_detection(self, config, expected): method test_adapter_suffixes (line 112) | def test_adapter_suffixes(self): class TestImplementationDetection (line 125) | class TestImplementationDetection: method test_implementation_detection (line 138) | def test_implementation_detection(self, config, expected): class TestResolutionHandling (line 147) | class TestResolutionHandling: method test_explicit_resolution_formats (line 158) | def test_explicit_resolution_formats(self, input_reso, expected): method test_default_resolutions (line 172) | def test_default_resolutions(self, config, expected): class TestThumbnailProcessing (line 179) | class TestThumbnailProcessing: method test_file_to_data_url (line 182) | def test_file_to_data_url(self): method test_file_to_data_url_nonexistent_file (line 213) | def test_file_to_data_url_nonexistent_file(self): method test_thumbnail_processing_in_metadata (line 220) | def test_thumbnail_processing_in_metadata(self): method test_thumbnail_data_url_passthrough (line 255) | def test_thumbnail_data_url_passthrough(self): method test_thumbnail_invalid_file_handling (line 278) | def test_thumbnail_invalid_file_handling(self): class TestBuildMetadataIntegration (line 298) | class TestBuildMetadataIntegration: method test_sdxl_model_workflow (line 301) | def test_sdxl_model_workflow(self): method test_flux_model_workflow (line 321) | def test_flux_model_workflow(self): method test_legacy_function_compatibility (line 343) | def test_legacy_function_compatibility(self): FILE: tests/library/test_strategy_lumina.py class SimpleMockGemma2Model (line 16) | class SimpleMockGemma2Model: method __init__ (line 19) | def __init__(self, hidden_size=2304): method __call__ (line 24) | def __call__(self, input_ids, attention_mask, output_hidden_states=Fal... function test_lumina_tokenize_strategy (line 41) | def test_lumina_tokenize_strategy(): function test_lumina_text_encoding_strategy (line 67) | def test_lumina_text_encoding_strategy(): function test_lumina_text_encoder_outputs_caching_strategy (line 124) | def test_lumina_text_encoder_outputs_caching_strategy(): function test_lumina_latents_caching_strategy (line 186) | def test_lumina_latents_caching_strategy(): FILE: tests/manual_test_anima_cache.py function find_image_caption_pairs (line 41) | def find_image_caption_pairs(image_dir: str): function print_tensor_info (line 59) | def print_tensor_info(name: str, t, indent=2): function test_latent_cache (line 78) | def test_latent_cache(args, pairs): function test_text_encoder_cache (line 168) | def test_text_encoder_cache(args, pairs): function test_full_batch_simulation (line 370) | def test_full_batch_simulation(args, pairs): function main (line 542) | def main(): FILE: tests/manual_test_anima_real_training.py function create_dataset_toml (line 31) | def create_dataset_toml(image_dir: str, resolution: int, toml_path: str): function run_test (line 53) | def run_test(test_name: str, cmd: list, timeout: int = 300) -> dict: function main (line 107) | def main(): FILE: tests/test_custom_offloading_utils.py class TransformerBlock (line 15) | class TransformerBlock(nn.Module): method __init__ (line 16) | def __init__(self, block_idx: int): method forward (line 23) | def forward(self, x): class SimpleModel (line 31) | class SimpleModel(nn.Module): method __init__ (line 32) | def __init__(self, num_blocks=16): method forward (line 38) | def forward(self, x): method device (line 44) | def device(self): function test_cuda_synchronize (line 51) | def test_cuda_synchronize(mock_cuda_sync): function test_xpu_synchronize (line 58) | def test_xpu_synchronize(mock_xpu_sync): function test_mps_synchronize (line 65) | def test_mps_synchronize(mock_mps_sync): function test_weights_to_device (line 72) | def test_weights_to_device(): function test_swap_weight_devices_cuda (line 97) | def test_swap_weight_devices_cuda(): function test_swap_weight_devices_no_cuda (line 115) | def test_swap_weight_devices_no_cuda(mock_sync_device): function offloader (line 130) | def offloader(): function test_offloader_init (line 140) | def test_offloader_init(offloader): function test_swap_weight_devices (line 150) | def test_swap_weight_devices(mock_no_cuda, mock_cuda, offloader: Offload... function test_submit_move_blocks (line 172) | def test_submit_move_blocks(mock_swap, offloader): function test_wait_blocks_move (line 188) | def test_wait_blocks_move(offloader): function model_offloader (line 208) | def model_offloader(): function test_model_offloader_init (line 220) | def test_model_offloader_init(model_offloader): function test_create_backward_hook (line 228) | def test_create_backward_hook(): function test_backward_hook_execution (line 254) | def test_backward_hook_execution(mock_wait, mock_submit): function test_prepare_block_devices_before_forward (line 284) | def test_prepare_block_devices_before_forward(mock_clean, mock_sync, moc... function test_wait_for_block (line 300) | def test_wait_for_block(mock_wait, model_offloader): function test_submit_move_blocks (line 314) | def test_submit_move_blocks(mock_submit, model_offloader): function test_offloading_integration (line 341) | def test_offloading_integration(): function test_offloader_assertion_error (line 379) | def test_offloader_assertion_error(): FILE: tests/test_fine_tune.py function test_syntax (line 4) | def test_syntax(): FILE: tests/test_flux_train.py function test_syntax (line 4) | def test_syntax(): FILE: tests/test_flux_train_network.py function test_syntax (line 3) | def test_syntax(): FILE: tests/test_lumina_train_network.py function lumina_trainer (line 11) | def lumina_trainer(): function mock_args (line 16) | def mock_args(): function mock_accelerator (line 33) | def mock_accelerator(): function test_assert_extra_args (line 41) | def test_assert_extra_args(lumina_trainer, mock_args): function test_load_target_model (line 59) | def test_load_target_model(lumina_trainer, mock_args, mock_accelerator): function test_get_strategies (line 91) | def test_get_strategies(lumina_trainer, mock_args): function test_text_encoder_output_caching_strategy (line 109) | def test_text_encoder_output_caching_strategy(lumina_trainer, mock_args): function test_noise_scheduler (line 131) | def test_noise_scheduler(lumina_trainer, mock_args): function test_sai_model_spec (line 140) | def test_sai_model_spec(lumina_trainer, mock_args): function test_update_metadata (line 148) | def test_update_metadata(lumina_trainer, mock_args): function test_is_text_encoder_not_needed_for_training (line 162) | def test_is_text_encoder_not_needed_for_training(lumina_trainer, mock_ar... FILE: tests/test_optimizer.py function test_default_get_optimizer (line 20) | def test_default_get_optimizer(): function test_get_schedulefree_optimizer (line 33) | def test_get_schedulefree_optimizer(): function test_all_supported_optimizers (line 46) | def test_all_supported_optimizers(): FILE: tests/test_sd3_train.py function test_syntax (line 4) | def test_syntax(): FILE: tests/test_sd3_train_network.py function test_syntax (line 3) | def test_syntax(): FILE: tests/test_sdxl_train.py function test_syntax (line 4) | def test_syntax(): FILE: tests/test_sdxl_train_network.py function test_syntax (line 4) | def test_syntax(): FILE: tests/test_train.py function test_syntax (line 4) | def test_syntax(): FILE: tests/test_train_network.py function test_syntax (line 3) | def test_syntax(): FILE: tests/test_train_textual_inversion.py function test_syntax (line 3) | def test_syntax(): FILE: tests/test_validation.py function test_split_train_val (line 4) | def test_split_train_val(): FILE: tools/cache_latents.py function set_tokenize_strategy (line 28) | def set_tokenize_strategy(is_sd: bool, is_sdxl: bool, is_flux: bool, arg... function cache_to_disk (line 52) | def cache_to_disk(args: argparse.Namespace) -> None: function setup_parser (line 160) | def setup_parser() -> argparse.ArgumentParser: FILE: tools/cache_text_encoder_outputs.py function cache_to_disk (line 39) | def cache_to_disk(args: argparse.Namespace) -> None: function setup_parser (line 187) | def setup_parser() -> argparse.ArgumentParser: FILE: tools/canny.py function canny (line 9) | def canny(args): function setup_parser (line 20) | def setup_parser() -> argparse.ArgumentParser: FILE: tools/convert_diffusers20_original_sd.py function convert (line 14) | def convert(args): function setup_parser (line 87) | def setup_parser() -> argparse.ArgumentParser: FILE: tools/convert_diffusers_to_flux.py function convert (line 42) | def convert(args): function setup_parser (line 113) | def setup_parser(): FILE: tools/detect_face_rotate.py function detect_faces (line 29) | def detect_faces(detector, image, min_size): function rotate_image (line 57) | def rotate_image(image, angle, cx, cy): function process (line 80) | def process(args): function setup_parser (line 221) | def setup_parser() -> argparse.ArgumentParser: FILE: tools/latent_upscaler.py class ResidualBlock (line 25) | class ResidualBlock(nn.Module): method __init__ (line 26) | def __init__(self, in_channels, out_channels=None, kernel_size=3, stri... method _initialize_weights (line 44) | def _initialize_weights(self): method forward (line 57) | def forward(self, x): class Upscaler (line 74) | class Upscaler(nn.Module): method __init__ (line 75) | def __init__(self): method _initialize_weights (line 123) | def _initialize_weights(self): method forward (line 139) | def forward(self, x): method support_latents (line 193) | def support_latents(self) -> bool: method upscale (line 196) | def upscale( function create_upscaler (line 247) | def create_upscaler(**kwargs): function upscale_images (line 263) | def upscale_images(args: argparse.Namespace): FILE: tools/merge_models.py function is_unet_key (line 13) | def is_unet_key(key): function replace_text_encoder_key (line 26) | def replace_text_encoder_key(key): function merge (line 33) | def merge(args): FILE: tools/merge_sd3_safetensors.py function merge_safetensors (line 18) | def merge_safetensors( function main (line 141) | def main(): FILE: tools/original_control_net.py class ControlNetInfo (line 15) | class ControlNetInfo(NamedTuple): class ControlNet (line 23) | class ControlNet(torch.nn.Module): method __init__ (line 24) | def __init__(self) -> None: function load_control_net (line 52) | def load_control_net(v2, unet, model): function load_preprocess (line 108) | def load_preprocess(prep_type: str): function preprocess_ctrl_net_hint_image (line 127) | def preprocess_ctrl_net_hint_image(image): function get_guided_hints (line 136) | def get_guided_hints(control_nets: List[ControlNetInfo], num_latent_inpu... function call_unet_and_control_net (line 162) | def call_unet_and_control_net( function unet_forward (line 234) | def unet_forward( FILE: tools/resize_images_to_resolution.py function resize_images (line 14) | def resize_images(src_img_folder, dst_img_folder, max_resolution="512x51... function setup_parser (line 95) | def setup_parser() -> argparse.ArgumentParser: function main (line 113) | def main(): FILE: train_control_net.py function generate_step_logs (line 49) | def generate_step_logs(args: argparse.Namespace, current_loss, avr_loss,... function train (line 62) | def train(args): function setup_parser (line 631) | def setup_parser() -> argparse.ArgumentParser: FILE: train_db.py function train (line 52) | def train(args): function setup_parser (line 511) | def setup_parser() -> argparse.ArgumentParser: FILE: train_network.py class NetworkTrainer (line 56) | class NetworkTrainer: method __init__ (line 57) | def __init__(self): method generate_step_logs (line 62) | def generate_step_logs( method step_logging (line 130) | def step_logging(self, accelerator: Accelerator, logs: dict, global_st... method epoch_logging (line 133) | def epoch_logging(self, accelerator: Accelerator, logs: dict, global_s... method val_logging (line 136) | def val_logging(self, accelerator: Accelerator, logs: dict, global_ste... method accelerator_logging (line 139) | def accelerator_logging( method assert_extra_args (line 169) | def assert_extra_args( method load_target_model (line 179) | def load_target_model(self, args, weight_dtype, accelerator) -> tuple[... method load_unet_lazily (line 189) | def load_unet_lazily(self, args, weight_dtype, accelerator, text_encod... method get_tokenize_strategy (line 192) | def get_tokenize_strategy(self, args): method get_tokenizers (line 195) | def get_tokenizers(self, tokenize_strategy: strategy_sd.SdTokenizeStra... method get_latents_caching_strategy (line 198) | def get_latents_caching_strategy(self, args): method get_text_encoding_strategy (line 204) | def get_text_encoding_strategy(self, args): method get_text_encoder_outputs_caching_strategy (line 207) | def get_text_encoder_outputs_caching_strategy(self, args): method get_models_for_text_encoding (line 210) | def get_models_for_text_encoding(self, args, accelerator, text_encoders): method get_text_encoders_train_flags (line 218) | def get_text_encoders_train_flags(self, args, text_encoders): method is_train_text_encoder (line 221) | def is_train_text_encoder(self, args): method cache_text_encoder_outputs_if_needed (line 224) | def cache_text_encoder_outputs_if_needed(self, args, accelerator, unet... method call_unet (line 228) | def call_unet(self, args, accelerator, unet, noisy_latents, timesteps,... method all_reduce_network (line 232) | def all_reduce_network(self, accelerator, network): method sample_images (line 237) | def sample_images(self, accelerator, args, epoch, global_step, device,... method post_process_network (line 242) | def post_process_network(self, args, accelerator, network, text_encode... method get_noise_scheduler (line 245) | def get_noise_scheduler(self, args: argparse.Namespace, device: torch.... method encode_images_to_latents (line 254) | def encode_images_to_latents(self, args, vae: AutoencoderKL, images: t... method shift_scale_latents (line 257) | def shift_scale_latents(self, args, latents: torch.FloatTensor) -> tor... method get_noise_pred_and_target (line 260) | def get_noise_pred_and_target( method post_process_loss (line 330) | def post_process_loss(self, loss, args, timesteps: torch.IntTensor, no... method get_sai_model_spec (line 341) | def get_sai_model_spec(self, args): method update_metadata (line 344) | def update_metadata(self, metadata, args): method is_text_encoder_not_needed_for_training (line 347) | def is_text_encoder_not_needed_for_training(self, args): method prepare_text_encoder_grad_ckpt_workaround (line 350) | def prepare_text_encoder_grad_ckpt_workaround(self, index, text_encoder): method prepare_text_encoder_fp8 (line 354) | def prepare_text_encoder_fp8(self, index, text_encoder, te_weight_dtyp... method prepare_unet_with_accelerator (line 357) | def prepare_unet_with_accelerator( method on_step_start (line 362) | def on_step_start(self, args, accelerator, network, text_encoders, une... method on_validation_step_end (line 365) | def on_validation_step_end(self, args, accelerator, network, text_enco... method process_batch (line 370) | def process_batch( method cast_text_encoder (line 482) | def cast_text_encoder(self, args): method cast_vae (line 485) | def cast_vae(self, args): method cast_unet (line 488) | def cast_unet(self, args): method train (line 491) | def train(self, args): function setup_parser (line 1732) | def setup_parser() -> argparse.ArgumentParser: FILE: train_textual_inversion.py class TextualInversionTrainer (line 97) | class TextualInversionTrainer: method __init__ (line 98) | def __init__(self): method assert_extra_args (line 102) | def assert_extra_args(self, args, train_dataset_group: Union[train_uti... method load_target_model (line 108) | def load_target_model(self, args, weight_dtype, accelerator): method get_tokenize_strategy (line 112) | def get_tokenize_strategy(self, args): method get_tokenizers (line 115) | def get_tokenizers(self, tokenize_strategy: strategy_sd.SdTokenizeStra... method get_latents_caching_strategy (line 118) | def get_latents_caching_strategy(self, args): method assert_token_string (line 124) | def assert_token_string(self, token_string, tokenizers: CLIPTokenizer): method get_text_encoding_strategy (line 127) | def get_text_encoding_strategy(self, args): method get_models_for_text_encoding (line 130) | def get_models_for_text_encoding(self, args, accelerator, text_encoder... method call_unet (line 133) | def call_unet(self, args, accelerator, unet, noisy_latents, timesteps,... method sample_images (line 137) | def sample_images( method save_weights (line 144) | def save_weights(self, file, updated_embs, save_dtype, metadata): method load_weights (line 160) | def load_weights(self, file): method train (line 185) | def train(self, args): function setup_parser (line 769) | def setup_parser() -> argparse.ArgumentParser: FILE: train_textual_inversion_XTI.py function train (line 101) | def train(args): function save_weights (line 612) | def save_weights(file, updated_embs, save_dtype): function load_weights (line 651) | def load_weights(file): function setup_parser (line 667) | def setup_parser() -> argparse.ArgumentParser: