Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix diffusers 0 25 dev #444

Merged
merged 2 commits into from
Dec 21, 2023
Merged
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
4 changes: 3 additions & 1 deletion src/infer_compiler_registry/register_diffusers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
Attention: AttentionOflow,
AttnProcessor2_0: AttnProcessorOflow,
LoRAAttnProcessor2_0: LoRAAttnProcessorOflow,
Transformer2DModel: Transformer2DModelOflow,
}
if Transformer2DModelOflow is not None:
torch2oflow_class_map.update({Transformer2DModel: Transformer2DModelOflow})

register(torch2oflow_class_map=torch2oflow_class_map)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
transformed_diffusers = transform_mgr.transform_package("diffusers")

diffusers_0220_v = version.parse("0.22.0")
diffusers_02499_v = version.parse("0.24.99")
diffusers_version = version.parse(importlib.metadata.version("diffusers"))

if diffusers_version < diffusers_0220_v:
Expand Down Expand Up @@ -366,7 +367,7 @@ def forward(
return (output,)

return Transformer2DModelOutput(sample=output)
else:
elif diffusers_version < diffusers_02499_v:
ConfigMixin = transformed_diffusers.configuration_utils.ConfigMixin
register_to_config = transformed_diffusers.configuration_utils.register_to_config
ImagePositionalEmbeddings = (
Expand Down Expand Up @@ -810,3 +811,5 @@ def forward(
return (output,)

return Transformer2DModelOutput(sample=output)
else:
Transformer2DModel = None
3 changes: 2 additions & 1 deletion src/onediff/infer_compiler/transform/builtin_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ def init(self):
logger.info(f"convert {type(obj)} to {type(of_obj)}")
return of_obj
except Exception as e:
logger.error(f"Unsupported type: {type(obj)} {e=}")
logger.warning(f"Unsupported type: {type(obj)} {e=}")
# raise NotImplementedError(f"Unsupported type: {obj}")
return obj


Expand Down
Loading