-
Notifications
You must be signed in to change notification settings - Fork 89
(fix/diffusers): fix some bugs #1448
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,11 +20,13 @@ | |
| from typing import Any, Callable, Dict, List, Optional, Union | ||
|
|
||
| import numpy as np | ||
| from transformers import Qwen2Tokenizer, Qwen2VLProcessor | ||
| from transformers import Qwen2Tokenizer | ||
|
|
||
| import mindspore as ms | ||
| from mindspore import mint | ||
|
|
||
| from mindone.transformers import Qwen2VLProcessor | ||
|
|
||
| from ....transformers import Qwen2_5_VLForConditionalGeneration | ||
| from ...image_processor import PipelineImageInput, VaeImageProcessor | ||
| from ...loaders import QwenImageLoraLoaderMixin | ||
|
|
@@ -228,7 +230,7 @@ def _get_qwen_prompt_embeds( | |
| self, | ||
| prompt: Union[str, List[str]] = None, | ||
| image: Optional[ms.tensor] = None, | ||
| dtype: Optional[ms.dtype] = None, | ||
| dtype: Optional[ms.Type] = None, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ): | ||
| dtype = dtype or self.text_encoder.dtype | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,11 +21,13 @@ | |
|
|
||
| import numpy as np | ||
| import PIL.Image | ||
| from transformers import Qwen2Tokenizer, Qwen2VLProcessor | ||
| from transformers import Qwen2Tokenizer | ||
|
|
||
| import mindspore as ms | ||
| from mindspore import mint | ||
|
|
||
| from mindone.transformers import Qwen2VLProcessor | ||
|
|
||
| from ....transformers import Qwen2_5_VLForConditionalGeneration | ||
| from ...image_processor import PipelineImageInput, VaeImageProcessor | ||
| from ...loaders import QwenImageLoraLoaderMixin | ||
|
|
@@ -238,7 +240,7 @@ def _get_qwen_prompt_embeds( | |
| self, | ||
| prompt: Union[str, List[str]] = None, | ||
| image: Optional[ms.tensor] = None, | ||
| dtype: Optional[ms.dtype] = None, | ||
| dtype: Optional[ms.Type] = None, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ): | ||
| dtype = dtype or self.text_encoder.dtype | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,7 +194,7 @@ def _extract_masked_hidden(self, hidden_states: ms.tensor, mask: ms.tensor): | |
| def _get_qwen_prompt_embeds( | ||
| self, | ||
| prompt: Union[str, List[str]] = None, | ||
| dtype: Optional[ms.dtype] = None, | ||
| dtype: Optional[ms.Type] = None, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ): | ||
| dtype = dtype or self.text_encoder.dtype | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -204,7 +204,7 @@ def _extract_masked_hidden(self, hidden_states: ms.tensor, mask: ms.tensor): | |
| def _get_qwen_prompt_embeds( | ||
| self, | ||
| prompt: Union[str, List[str]] = None, | ||
| dtype: Optional[ms.dtype] = None, | ||
| dtype: Optional[ms.Type] = None, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ): | ||
| dtype = dtype or self.text_encoder.dtype | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type hint for
dtypehas been corrected fromOptional[ms.dtype]toOptional[ms.Type]. This is a good fix, asms.Typeis the correct way to hint a type class in MindSpore, whereasms.dtyperefers to an instance of a dtype. This improves type correctness and clarity.