File tree Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,16 @@ runtime.python_library(
118
118
],
119
119
)
120
120
121
+ runtime.python_library(
122
+ name = "hf_download",
123
+ srcs = [
124
+ "hf_download.py",
125
+ ],
126
+ deps = [
127
+ "fbsource//third-party/pypi/huggingface-hub:huggingface-hub",
128
+ ]
129
+ )
130
+
121
131
runtime.python_library(
122
132
name = "export_library",
123
133
srcs = [
@@ -134,6 +144,7 @@ runtime.python_library(
134
144
"@EXECUTORCH_CLIENTS",
135
145
],
136
146
deps = [
147
+ ":hf_download",
137
148
":source_transformation",
138
149
"//ai_codesign/gen_ai/fast_hadamard_transform:fast_hadamard_transform",
139
150
"//caffe2:torch",
Original file line number Diff line number Diff line change @@ -539,16 +539,24 @@ def export_llama(args) -> str:
539
539
if not args .checkpoint and args .model in HUGGING_FACE_REPO_IDS :
540
540
repo_id = HUGGING_FACE_REPO_IDS [args .model ]
541
541
if args .model == "qwen2_5" :
542
- from executorch .examples .models .qwen2_5 import convert_weights
542
+ from executorch .examples .models .qwen2_5 import ( # pyre-ignore[21]
543
+ convert_weights ,
544
+ )
543
545
elif args .model == "phi_4_mini" :
544
- from executorch .examples .models .phi_4_mini import convert_weights
546
+ from executorch .examples .models .phi_4_mini import ( # pyre-ignore[21]
547
+ convert_weights ,
548
+ )
545
549
elif args .model == "smollm2" :
546
- from executorch .examples .models .smollm2 import convert_weights
550
+ from executorch .examples .models .smollm2 import ( # pyre-ignore[21]
551
+ convert_weights ,
552
+ )
547
553
else :
548
554
raise ValueError (
549
555
f"Converting weights to meta format for { args .model } is not yet supported"
550
556
)
551
- args .checkpoint = download_and_convert_hf_checkpoint (repo_id , convert_weights )
557
+ args .checkpoint = download_and_convert_hf_checkpoint (
558
+ repo_id , convert_weights
559
+ ) # pyre-ignore
552
560
553
561
if args .profile_path is not None :
554
562
try :
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ def download_and_convert_hf_checkpoint(
33
33
34
34
# Use repo name to name the converted file.
35
35
model_name = repo_id .replace ("/" , "_" )
36
- converted_path = cache_dir / f"{ model_name } .pth"
36
+ converted_path = str ( cache_dir / f"{ model_name } .pth" )
37
37
38
38
if converted_path .exists ():
39
39
print (f"✔ Using cached converted model: { converted_path } " )
You can’t perform that action at this time.
0 commit comments