Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/LetterLiGo/SafeGen_CCS2024
/ functions
Functions
7,383 in github.com/LetterLiGo/SafeGen_CCS2024
⨍
Functions
7,383
◇
Types & classes
1,211
↳
Endpoints
4
↓ 1,136 callers
Method
pop
(self, *args, **kwargs)
src/diffusers/utils/outputs.py:94
↓ 1,004 callers
Method
to
( self, torch_device: Optional[Union[str, torch.device]] = None, torch_dtype: Optional
src/diffusers/pipelines/stable_diffusion/stable_unclip_image_normalizer.py:42
↓ 957 callers
Method
from_pretrained
(cls, path, model_cls)
src/diffusers/training_utils.py:163
↓ 749 callers
Method
to
(self, device)
tests/pipelines/stable_diffusion_safe/test_safe_diffusion.py:97
↓ 715 callers
Method
set_progress_bar_config
(self, **kwargs)
src/diffusers/pipelines/pipeline_utils.py:1983
↓ 599 callers
Function
requires_backends
(obj, backends)
src/diffusers/utils/import_utils.py:519
↓ 452 callers
Method
update
(self, *args, **kwargs)
src/diffusers/utils/outputs.py:97
↓ 440 callers
Method
to
(self, device)
tests/pipelines/test_pipelines.py:1135
↓ 362 callers
Method
to
r""" Performs Pipeline dtype and/or device conversion. A torch.dtype and torch.device are inferred from the arguments of `self.to(*arg
src/diffusers/pipelines/pipeline_utils.py:722
↓ 317 callers
Method
set_timesteps
Sets the discrete timesteps used for the diffusion chain (to be run before inference). Args: num_inference_steps (`int`,
src/diffusers/schedulers/scheduling_lcm.py:326
↓ 260 callers
Function
deprecate
(*args, take_from: Optional[Union[Dict, Any]] = None, standard_warn=True, stacklevel=2)
src/diffusers/utils/deprecation_utils.py:8
↓ 257 callers
Method
from_config
(cls, *args, **kwargs)
src/diffusers/utils/dummy_pt_objects.py:312
↓ 222 callers
Method
pipeline_class
(self)
tests/pipelines/test_pipelines_common.py:291
↓ 173 callers
Function
randn_tensor
A helper function to create random tensors on the desired `device` with the desired `dtype`. When passing a list of generators, you can seed each
src/diffusers/utils/torch_utils.py:37
↓ 170 callers
Method
step
(self, parameters: Iterable[torch.nn.Parameter])
src/diffusers/training_utils.py:207
↓ 146 callers
Method
load_state_dict
r""" Args: Loads the ExponentialMovingAverage state. This method is used by accelerate during checkpointing to save the ema st
src/diffusers/training_utils.py:315
↓ 131 callers
Method
scale_model_input
Ensures interchangeability with schedulers that need to scale the denoising model input depending on the current timestep. A
src/diffusers/schedulers/scheduling_lcm.py:276
↓ 129 callers
Function
floats_tensor
Creates a random float32 tensor
src/diffusers/utils/testing_utils.py:154
↓ 123 callers
Method
save_pretrained
(self, path)
src/diffusers/training_utils.py:172
↓ 121 callers
Method
register_modules
(self, **kwargs)
src/diffusers/pipelines/pipeline_utils.py:553
↓ 119 callers
Function
is_torch_available
()
src/diffusers/utils/import_utils.py:288
↓ 118 callers
Function
load_image
Loads `image` to a PIL Image. Args: image (`str` or `PIL.Image.Image`): The image to convert to the PIL Image format.
src/diffusers/utils/testing_utils.py:312
↓ 116 callers
Function
is_transformers_available
()
src/diffusers/utils/import_utils.py:300
↓ 116 callers
Method
step
Predict the sample from the previous timestep by reversing the SDE. This function propagates the diffusion process from the learned m
src/diffusers/schedulers/scheduling_lcm.py:474
↓ 109 callers
Method
enable_attention_slicing
r""" Enable sliced attention computation. When this option is enabled, the attention module splits the input tensor in slices to compu
src/diffusers/pipelines/pipeline_utils.py:2047
↓ 106 callers
Method
register_to_config
(self, **kwargs)
src/diffusers/configuration_utils.py:105
↓ 105 callers
Method
progress_bar
(self, iterable=None, total=None)
src/diffusers/pipelines/kandinsky/pipeline_kandinsky_combined.py:205
↓ 104 callers
Function
load_numpy
(arry: Union[str, np.ndarray], local_path: Optional[str] = None)
src/diffusers/utils/testing_utils.py:278
↓ 102 callers
Method
enable_model_cpu_offload
r""" Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared to `enable_sequenti
src/diffusers/pipelines/pipeline_utils.py:1389
↓ 98 callers
Function
enable_full_determinism
Helper function for reproducible behavior during distributed training. See - https://pytorch.org/docs/stable/notes/randomness.html for pytorc
src/diffusers/utils/testing_utils.py:747
↓ 95 callers
Method
info
(self, prefix)
scripts/convert_stable_diffusion_controlnet_to_onnx.py:31
↓ 94 callers
Method
resize
Resize image. Args: image (`PIL.Image.Image`, `np.ndarray` or `torch.Tensor`): The image input, can be a
src/diffusers/image_processor.py:212
↓ 93 callers
Method
check_over_configs
(self, time_step=0, **config)
tests/schedulers/test_schedulers.py:312
↓ 90 callers
Method
load_lora_weights
Load LoRA weights specified in `pretrained_model_name_or_path_or_dict` into `self.unet` and `self.text_encoder`. All kwargs
src/diffusers/loaders/lora.py:79
↓ 90 callers
Method
to
r"""Move internal buffers of the ExponentialMovingAverage to `device`. Args: device: like `device` argument to `torch.Tensor.to`
src/diffusers/training_utils.py:257
↓ 86 callers
Method
maybe_free_model_hooks
r""" Function that offloads all components, removes all model hooks that were added when using `enable_model_cpu_offload` and then app
src/diffusers/pipelines/pipeline_utils.py:1459
↓ 84 callers
Method
numpy_to_pil
Convert a NumPy image or a batch of images to a PIL image.
src/diffusers/pipelines/pipeline_utils.py:1962
↓ 82 callers
Method
maybe_convert_prompt
r""" Processes prompts that include a special token corresponding to a multi-vector textual inversion embedding to be replaced with mu
src/diffusers/loaders/textual_inversion.py:122
↓ 82 callers
Method
set_default_attn_processor
Disables custom attention processors and sets the default attention implementation.
src/diffusers/models/controlnet.py:574
↓ 82 callers
Method
state_dict
r""" Returns the state of the ExponentialMovingAverage as a dict. This method is used by accelerate during checkpointing to save the e
src/diffusers/training_utils.py:269
↓ 81 callers
Method
postprocess
(self, sample: torch.FloatTensor, output_type: str = "pil")
src/diffusers/pipelines/blip_diffusion/blip_image_processing.py:301
↓ 73 callers
Method
dummy_model
(self)
tests/schedulers/test_schedulers.py:300
↓ 66 callers
Method
check_if_lora_correctly_set
Checks if the LoRA layers are correctly set with peft
tests/lora/test_lora_layers_peft.py:194
↓ 64 callers
Method
add_adapter
r""" Adds a new adapter to the current model for training. If no adapter name is passed, a default name is assigned to the adapter to
src/diffusers/models/modeling_utils.py:307
↓ 58 callers
Method
head_to_batch_dim
r""" Reshape the tensor from `[batch_size, seq_len, dim]` to `[batch_size, seq_len, heads, dim // heads]` `heads` is the number of hea
src/diffusers/models/attention_processor.py:549
↓ 57 callers
Method
enable_sequential_cpu_offload
r""" Offloads all models to CPU using 🤗 Accelerate, significantly reducing memory usage. When called, the state dicts of all `torch.nn
src/diffusers/pipelines/pipeline_utils.py:1478
↓ 56 callers
Method
decode
( self, h: torch.FloatTensor, force_not_quantize: bool = True, return_dict: bool = True )
src/diffusers/pipelines/wuerstchen/modeling_paella_vq_model.py:143
↓ 56 callers
Method
to
(self, device)
tests/pipelines/altdiffusion/test_alt_diffusion_img2img.py:115
↓ 55 callers
Method
resize
Resize an image to `(size["height"], size["width"])`. Args: image (`np.ndarray`): Image to resize.
src/diffusers/pipelines/blip_diffusion/blip_image_processing.py:116
↓ 55 callers
Method
state_dict
(self, *args, destination=None, prefix="", keep_vars=False)
src/diffusers/models/lora.py:108
↓ 54 callers
Method
decode
(self, encodings_and_masks, input_tokens, noise_time)
src/diffusers/pipelines/spectrogram_diffusion/pipeline_spectrogram_diffusion.py:114
↓ 53 callers
Method
encode
(self, token_ids)
src/diffusers/pipelines/spectrogram_diffusion/midi_utils.py:127
↓ 51 callers
Function
scale_lora_layers
Adjust the weightage given to the LoRA layers of the model. Args: model (`torch.nn.Module`): The model to scale.
src/diffusers/utils/peft_utils.py:100
↓ 49 callers
Method
set_attn_processor
r""" Sets the attention processor to use to compute attention. Parameters: processor (`dict` of `AttentionProcessor` or o
src/diffusers/models/controlnet.py:537
↓ 48 callers
Function
adjust_lora_scale_text_encoder
(text_encoder, lora_scale: float = 1.0)
src/diffusers/models/lora.py:69
↓ 48 callers
Method
device
`torch.device`: The device on which the module is (assuming that all the module parameters are on the same device).
src/diffusers/models/modeling_utils.py:1022
↓ 48 callers
Function
unscale_lora_layers
Removes the previously passed weight given to the LoRA layers of the model. Args: model (`torch.nn.Module`): The model t
src/diffusers/utils/peft_utils.py:117
↓ 47 callers
Method
add_noise
( self, original_samples: torch.FloatTensor, noise: torch.FloatTensor, timeste
src/diffusers/pipelines/kandinsky/pipeline_kandinsky_img2img.py:267
↓ 46 callers
Function
is_torch_version
Args: Compares the current PyTorch version to a given reference with an operation. operation (`str`): A string representa
src/diffusers/utils/import_utils.py:583
↓ 44 callers
Function
is_accelerate_available
()
src/diffusers/utils/import_utils.py:332
↓ 42 callers
Method
save_config
Save a configuration object to the directory specified in `save_directory` so that it can be reloaded using the [`~ConfigMixin.from_c
src/diffusers/configuration_utils.py:140
↓ 41 callers
Method
_get_variance
(self, t, predicted_variance=None, variance_type=None)
src/diffusers/schedulers/scheduling_ddpm.py:280
↓ 41 callers
Function
get_objects_from_module
Args: Returns a dict of object names and values in a module, while skipping private/internal objects module (ModuleType):
src/diffusers/utils/import_utils.py:637
↓ 39 callers
Function
torch_all_close
(a, b, *args, **kwargs)
src/diffusers/utils/testing_utils.py:83
↓ 38 callers
Method
preprocess
Preprocess an image or batch of images. Args: images (`ImageInput`): Image to preprocess. Expects a sing
src/diffusers/pipelines/blip_diffusion/blip_image_processing.py:164
↓ 37 callers
Method
_test_inference_batch_single_identical
( self, batch_size=2, expected_max_diff=1e-4, additional_params_copy_to_batche
tests/pipelines/test_pipelines_common.py:491
↓ 37 callers
Function
numpy_cosine_similarity_distance
(a, b)
src/diffusers/utils/testing_utils.py:91
↓ 36 callers
Method
from_pipe
r""" Instantiates a text-to-image Pytorch diffusion pipeline from another instantiated diffusion pipeline class. The from_pipe() meth
src/diffusers/pipelines/auto_pipeline.py:343
↓ 36 callers
Method
sample
Args: t0: start time has shape [batch_size, *shape, 1] t1: finish time has shape [batch_size, *shape, 1]
src/diffusers/pipelines/shap_e/renderer.py:366
↓ 34 callers
Method
disable_slicing
r""" Disable sliced VAE decoding. If `enable_slicing` was previously enabled, this method will go back to computing decoding in one st
src/diffusers/models/autoencoder_kl.py:151
↓ 34 callers
Method
enable_slicing
r""" Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to compute decoding in sev
src/diffusers/models/autoencoder_kl.py:144
↓ 34 callers
Method
interpolate
Function invoked when using the prior pipeline for interpolation. Args: images_and_prompts (`List[Union[str, PIL.Image.I
src/diffusers/pipelines/kandinsky/pipeline_kandinsky_prior.py:174
↓ 34 callers
Function
is_flax_available
()
src/diffusers/utils/import_utils.py:296
↓ 33 callers
Method
_test_attention_slicing_forward_pass
( self, test_max_difference=True, test_mean_pixel_difference=True, expected_max_diff=1e-3 )
tests/pipelines/test_pipelines_common.py:725
↓ 33 callers
Method
to_tuple
Convert self to a tuple containing all the attributes/keys that are not `None`.
src/diffusers/utils/outputs.py:126
↓ 32 callers
Function
assign_to_checkpoint
This does the final conversion step: take locally converted weights and apply a global renaming to them. It splits attention layers, and take
src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py:168
↓ 32 callers
Method
fuse_lora
r""" Fuses the LoRA parameters into the original parameters of the corresponding blocks. <Tip warning={true}> This is an exp
src/diffusers/loaders/lora.py:897
↓ 32 callers
Function
set_lora_weights
(lora_attn_parameters, randn_weight=False, var=1.0)
tests/lora/test_lora_layers_old_backend.py:172
↓ 31 callers
Method
get_dummy_inputs
(self, device, seed=0)
tests/pipelines/test_pipelines_common.py:303
↓ 30 callers
Method
preprocess
Preprocess the image input. Accepted formats are PIL images, NumPy arrays or PyTorch tensors.
src/diffusers/image_processor.py:265
↓ 29 callers
Function
load_image
Loads `image` to a PIL Image. Args: image (`str` or `PIL.Image.Image`): The image to convert to the PIL Image format.
src/diffusers/utils/loading_utils.py:9
↓ 29 callers
Method
set_processor
r""" Set the attention processor to use. Args: processor (`AttnProcessor`): The attention processor to us
src/diffusers/models/attention_processor.py:373
↓ 28 callers
Function
assert_mean_pixel_difference
(image, expected_image, expected_max_diff=10)
tests/pipelines/test_pipelines_common.py:1293
↓ 27 callers
Method
enable_tiling
r""" Enable tiled VAE decoding. When this option is enabled, the VAE will split the input tensor into tiles to compute decoding and en
src/diffusers/models/autoencoder_kl.py:129
↓ 27 callers
Function
prepare_mask_and_masked_image
Prepares a pair (image, mask) to be consumed by the Stable Diffusion pipeline. This means that those inputs will be converted to ``torch.Tens
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py:40
↓ 26 callers
Method
__init__
( self, in_channels: int, prev_output_channel: int, out_channels: int,
src/diffusers/models/unet_2d_blocks.py:2371
↓ 26 callers
Method
_test_xformers_attention_forwardGenerator_pass
( self, test_max_difference=True, test_mean_pixel_difference=True, expected_max_diff=1e-4 )
tests/pipelines/test_pipelines_common.py:821
↓ 26 callers
Method
add_noise
( self, original_samples: torch.FloatTensor, noise: torch.FloatTensor, timeste
src/diffusers/schedulers/scheduling_lcm.py:571
↓ 26 callers
Method
get_dummy_components
(self)
tests/pipelines/test_pipelines_common.py:297
↓ 26 callers
Method
pop
(self, *args, **kwargs)
src/diffusers/configuration_utils.py:65
↓ 26 callers
Method
postprocess
Postprocess the image output from tensor to `output_type`. Args: image (`torch.FloatTensor`): The image
src/diffusers/image_processor.py:354
↓ 25 callers
Function
assert_param_count
(model_1, model_2)
scripts/convert_if.py:1183
↓ 25 callers
Function
get_activation
Helper function to get activation function from string. Args: act_fn (str): Name of activation function. Returns: nn.Module:
src/diffusers/models/activations.py:33
↓ 25 callers
Function
text_encoder
()
scripts/convert_kakao_brain_unclip_to_diffusers.py:919
↓ 25 callers
Function
to_np
(tensor)
tests/pipelines/test_pipelines_common.py:49
↓ 24 callers
Method
create_state
(self, common: Optional[CommonSchedulerState] = None)
src/diffusers/schedulers/scheduling_pndm_flax.py:143
↓ 24 callers
Method
disable_tiling
r""" Disable tiled VAE decoding. If `enable_tiling` was previously enabled, this method will go back to computing decoding in one step
src/diffusers/models/autoencoder_kl.py:137
↓ 24 callers
Method
from_pretrained
r""" Instantiate a pretrained MultiControlNet model from multiple pre-trained controlnet models. The model is set in evaluation mode
src/diffusers/pipelines/controlnet/multicontrolnet.py:118
↓ 24 callers
Method
load_config
r""" Load a model or scheduler configuration. Parameters: pretrained_model_name_or_path (`str` or `os.PathLike`, *optiona
src/diffusers/configuration_utils.py:278
↓ 23 callers
Method
mode
(self)
src/diffusers/models/vae.py:817
next →
1–100 of 7,383, ranked by callers