alexmarques commited on
Commit
a8da9ff
·
verified ·
1 Parent(s): 459ac81

Update convert_voxtral_hf_to_mistral.py

Browse files
Files changed (1) hide show
  1. convert_voxtral_hf_to_mistral.py +9 -6
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
- config_path = os.path.join(local_path, "params.json")
132
- with open(config_path, "r") as f:
133
- config = json.load(f)
134
- if os.path.exists(config_path):
135
- if unquantized_model_path is not None:
136
- config = add_quantization_config(config, hf_config)
 
 
 
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)