Skip to content
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
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