Skip to content

Commit

Permalink
[Fix] try import expand mask from transformers (open-mmlab#2064)
Browse files Browse the repository at this point in the history
* try import expand mask from transformers

* fix lint

* fix lint

* fix lint
  • Loading branch information
zengyh1900 authored Nov 10, 2023
1 parent c2f8f3a commit 2a95e50
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mmagic/models/editors/fastcomposer/fastcomposer_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
from transformers import (CLIPModel, CLIPPreTrainedModel, CLIPTextModel,
CLIPVisionConfig, CLIPVisionModel)
from transformers.modeling_outputs import BaseModelOutputWithPooling
from transformers.models.clip.modeling_clip import _expand_mask

from mmagic.utils import try_import

_expand_mask = try_import('transformers.models.clip.modeling_clip')
if _expand_mask is None:
_expand_mask = try_import(
'ransformers.models.clip.modeling_clip._prepare_4d_attention_mask')


class FastComposerModel(nn.Module):
Expand Down

0 comments on commit 2a95e50

Please sign in to comment.