Unverified Commit 23eed397 authored by Fabio Rigano's avatar Fabio Rigano Committed by GitHub
Browse files

Fix path generation in IP Adapter (#6564)



* Fix path generation on Windows

* Update set_default_attn_processors

* Use pathlib

* Fix quality

* Fix copy

* Revert changes in set_default_attn_processors

---------
Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
parent fefed445
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os from pathlib import Path
from typing import Dict, Union from typing import Dict, Union
import torch import torch
...@@ -138,7 +138,7 @@ class IPAdapterMixin: ...@@ -138,7 +138,7 @@ class IPAdapterMixin:
logger.info(f"loading image_encoder from {pretrained_model_name_or_path_or_dict}") logger.info(f"loading image_encoder from {pretrained_model_name_or_path_or_dict}")
image_encoder = CLIPVisionModelWithProjection.from_pretrained( image_encoder = CLIPVisionModelWithProjection.from_pretrained(
pretrained_model_name_or_path_or_dict, pretrained_model_name_or_path_or_dict,
subfolder=os.path.join(subfolder, "image_encoder"), subfolder=Path(subfolder, "image_encoder").as_posix(),
).to(self.device, dtype=self.dtype) ).to(self.device, dtype=self.dtype)
self.image_encoder = image_encoder self.image_encoder = image_encoder
self.register_to_config(image_encoder=["transformers", "CLIPVisionModelWithProjection"]) self.register_to_config(image_encoder=["transformers", "CLIPVisionModelWithProjection"])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment