conversion scripts: cleanup

This commit is contained in:
Cebtenzzre 2023-09-28 15:32:43 -04:00 committed by Adam Treat
parent 6277eac9cc
commit fd47088f2b
3 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,6 @@
from __future__ import annotations from __future__ import annotations
import json import json
import os
import struct import struct
import sys import sys
from pathlib import Path from pathlib import Path
@ -12,7 +11,7 @@ from transformers import AutoModel, AutoTokenizer
if not 2 <= len(sys.argv) < 4: if not 2 <= len(sys.argv) < 4:
print("Usage: {} dir-model [ftype]\n".format(os.path.basename(__file__))) print("Usage: {} dir-model [ftype]\n".format(Path(__file__).name))
print(" ftype == 0 -> float32") print(" ftype == 0 -> float32")
print(" ftype == 1 -> float16") print(" ftype == 1 -> float16")
sys.exit(1) sys.exit(1)
@ -29,6 +28,7 @@ with open(dir_model / "vocab.txt", encoding="utf-8") as f:
# #
# map from ftype to string # map from ftype to string
ftype_str = ["f32", "f16"] ftype_str = ["f32", "f16"]
ftype = 1 ftype = 1
if len(sys.argv) > 2: if len(sys.argv) > 2:
ftype = int(sys.argv[2]) ftype = int(sys.argv[2])

View File

@ -10,7 +10,6 @@
from __future__ import annotations from __future__ import annotations
import json import json
import os
import struct import struct
import sys import sys
from pathlib import Path from pathlib import Path
@ -64,6 +63,7 @@ dir_out.mkdir(exist_ok=True)
# #
# map from ftype to string # map from ftype to string
ftype_str = ["f32", "f16"] ftype_str = ["f32", "f16"]
ftype = 1 ftype = 1
if len(sys.argv) > 3: if len(sys.argv) > 3:
ftype = int(sys.argv[3]) ftype = int(sys.argv[3])

View File

@ -1,7 +1,6 @@
from __future__ import annotations from __future__ import annotations
import json import json
import os
import struct import struct
import sys import sys
from pathlib import Path from pathlib import Path
@ -13,7 +12,7 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
if not 2 <= len(sys.argv) < 4: if not 2 <= len(sys.argv) < 4:
print("Usage: {} dir-model [ftype]\n".format(os.path.basename(__file__))) print("Usage: {} dir-model [ftype]\n".format(Path(__file__).name))
print(" ftype == 0 -> float32") print(" ftype == 0 -> float32")
print(" ftype == 1 -> float16") print(" ftype == 1 -> float16")
sys.exit(1) sys.exit(1)
@ -27,6 +26,7 @@ dir_model = Path(sys.argv[1])
# #
# map from ftype to string # map from ftype to string
ftype_str = ["f32", "f16"] ftype_str = ["f32", "f16"]
ftype = 1 ftype = 1
if len(sys.argv) > 2: if len(sys.argv) > 2:
ftype = int(sys.argv[2]) ftype = int(sys.argv[2])