File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 3
3
4
4
# This source code is licensed under the license found in the
5
5
# LICENSE file in the root directory of this source tree.
6
+ import glob
6
7
import json
7
8
import os
8
9
import re
@@ -41,7 +42,12 @@ def convert_hf_checkpoint(
41
42
print (f"Model config { config .__dict__ } " )
42
43
43
44
# Load the json file containing weight mapping
44
- model_map_json = model_dir / "pytorch_model.bin.index.json"
45
+ model_map_json_matches = [Path (m ) for m in glob .glob (str (model_dir / "*.index.json" ))]
46
+ assert len (model_map_json_matches ) <= 1 , "Found multiple weight mapping files"
47
+ if len (model_map_json_matches ):
48
+ model_map_json = model_map_json_matches [0 ]
49
+ else :
50
+ model_map_json = model_dir / "pytorch_model.bin.index.json"
45
51
46
52
# If there is no weight mapping, check for a consolidated model and
47
53
# tokenizer we can move. Llama 2 and Mistral have weight mappings, while
You can’t perform that action at this time.
0 commit comments