Skip to content

Commit

Permalink
Don't initialize CLIPVision weights to default values.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Jun 14, 2023
1 parent 6b77458 commit fa2cca0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions comfy/clip_vision.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from transformers import CLIPVisionModelWithProjection, CLIPVisionConfig, CLIPImageProcessor
from transformers import CLIPVisionModelWithProjection, CLIPVisionConfig, CLIPImageProcessor, modeling_utils
from .utils import load_torch_file, transformers_convert
import os
import torch

class ClipVisionModel():
def __init__(self, json_config):
config = CLIPVisionConfig.from_json_file(json_config)
self.model = CLIPVisionModelWithProjection(config)
with modeling_utils.no_init_weights():
self.model = CLIPVisionModelWithProjection(config)
self.processor = CLIPImageProcessor(crop_size=224,
do_center_crop=True,
do_convert_rgb=True,
Expand Down

0 comments on commit fa2cca0

Please sign in to comment.