Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/diffusers/loaders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
_import_structure = {}

if is_torch_available():
_import_structure["lora_pipeline"] = ["RFD4ProteinaLoraLoaderMixin"]
_import_structure["single_file_model"] = ["FromOriginalModelMixin"]
_import_structure["transformer_flux"] = ["FluxTransformer2DLoadersMixin"]
_import_structure["transformer_sd3"] = ["SD3Transformer2DLoadersMixin"]
_import_structure["unet"] = ["UNet2DConditionLoadersMixin"]
_import_structure["utils"] = ["AttnProcsLayers"]
_import_structure["lora_pipeline"] = ["RFD4ProteinaLoraLoaderMixin"]
if is_transformers_available():
_import_structure["single_file"] = ["FromSingleFileMixin"]
_import_structure["lora_pipeline"] += [
Expand Down
6 changes: 6 additions & 0 deletions src/diffusers/loaders/single_file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3737,6 +3737,12 @@ def swap_scale_shift(weight):


def convert_cosmos_transformer_checkpoint_to_diffusers(checkpoint, **kwargs):
for k in list(checkpoint.keys()):
if "llm_adapter" in k:
_ = checkpoint.pop(k)
else:
checkpoint[k.removeprefix("model.diffusion_model.")] = checkpoint.pop(k)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if it would be more appropriate to implement the prefix removal below where the net. prefix is removed. Not sure about this


converted_state_dict = {key: checkpoint.pop(key) for key in list(checkpoint.keys())}

def remove_keys_(key: str, state_dict):
Expand Down
Loading