Skip to content

Commit 278cf9f

Browse files
committed
llava: add big-endian conversion for image encoder
Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
1 parent 57b6abf commit 278cf9f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/llava/convert_image_encoder_to_gguf.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ def bytes_to_unicode():
8989
ap = argparse.ArgumentParser()
9090
ap.add_argument("-m", "--model-dir", help="Path to model directory cloned from HF Hub", required=True)
9191
ap.add_argument("--use-f32", action="store_true", default=False, help="Use f32 instead of f16")
92+
ap.add_argument('--bigendian', action="store_true", default=False, help="Model is executed on big-endian machine")
9293
ap.add_argument("--text-only", action="store_true", required=False,
9394
help="Save a text-only model. It can't be used to encode images")
9495
ap.add_argument("--vision-only", action="store_true", required=False,
@@ -191,7 +192,7 @@ def bytes_to_unicode():
191192
os.makedirs(output_dir, exist_ok=True)
192193
output_prefix = os.path.basename(output_dir).replace("ggml_", "")
193194
fname_out = os.path.join(output_dir, f"{fname_middle}model-{ftype_str[ftype]}.gguf")
194-
fout = GGUFWriter(path=fname_out, arch="clip")
195+
fout = GGUFWriter(path=fname_out, arch="clip", endianess=GGUFEndian.LITTLE if not args.bigendian else GGUFEndian.BIG)
195196

196197
fout.add_bool("clip.has_text_encoder", has_text_encoder)
197198
fout.add_bool("clip.has_vision_encoder", has_vision_encoder)

0 commit comments

Comments
 (0)