File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,8 @@ def main(args):
88
88
else :
89
89
raise ValueError ()
90
90
91
+ local_model = False
92
+ model_path = ""
91
93
model_name = args .model_name
92
94
print ("model_name: " , model_name )
93
95
qwen2vl = Qwen2VLForConditionalGeneration .from_pretrained (
@@ -97,8 +99,10 @@ def main(args):
97
99
vcfg = cfg .vision_config
98
100
99
101
if os .path .isdir (model_name ):
102
+ local_model = True
100
103
if model_name .endswith (os .sep ):
101
104
model_name = model_name [:- 1 ]
105
+ model_path = model_name
102
106
model_name = os .path .basename (model_name )
103
107
fname_out = f"{ model_name .replace ('/' , '-' ).lower ()} -vision.gguf"
104
108
@@ -139,7 +143,10 @@ def main(args):
139
143
it will be hardcoded in the `clip_image_build_graph` from `clip.cpp`.
140
144
"""
141
145
142
- processor : Qwen2VLProcessor = AutoProcessor .from_pretrained (model_name )
146
+ if local_model :
147
+ processor : Qwen2VLProcessor = AutoProcessor .from_pretrained (model_path )
148
+ else :
149
+ processor : Qwen2VLProcessor = AutoProcessor .from_pretrained (model_name )
143
150
fout .add_array ("clip.vision.image_mean" , processor .image_processor .image_mean ) # type: ignore[reportAttributeAccessIssue]
144
151
fout .add_array ("clip.vision.image_std" , processor .image_processor .image_std ) # type: ignore[reportAttributeAccessIssue]
145
152
You can’t perform that action at this time.
0 commit comments