Update convert_voxtral_hf_to_mistral.py
Browse files
convert_voxtral_hf_to_mistral.py
CHANGED
@@ -128,12 +128,15 @@ def write_model(
|
|
128 |
local_path = snapshot_download(input_path_or_repo)
|
129 |
|
130 |
# Convert config
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
|
|
|
|
|
|
137 |
|
138 |
with open(os.path.join(output_dir, "params.json"), "w") as f:
|
139 |
json.dump(config, f, indent=2)
|
|
|
128 |
local_path = snapshot_download(input_path_or_repo)
|
129 |
|
130 |
# Convert config
|
131 |
+
if unquantized_model_path is not None:
|
132 |
+
if os.path.exists(unquantized_model_path):
|
133 |
+
unquantized_model_path = unquantized_model_path
|
134 |
+
else:
|
135 |
+
unquantized_model_path = snapshot_download(unquantized_model_path)
|
136 |
+
config_path = os.path.join(unquantized_model_path, "params.json")
|
137 |
+
with open(config_path, "r") as f:
|
138 |
+
config = json.load(f)
|
139 |
+
config = add_quantization_config(config, hf_config)
|
140 |
|
141 |
with open(os.path.join(output_dir, "params.json"), "w") as f:
|
142 |
json.dump(config, f, indent=2)
|