File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,15 @@ def gen_eval_wrapper(
158
158
else manager .model .eval ().to (device = "cpu" )
159
159
)
160
160
161
+ # Save the checkpoint after the eager model preparation is done.
162
+ # The reason for this option is that the checkpoint can be used
163
+ # to do evaluations in other evaluation platforms, or with data
164
+ # that is not available in this eval_llama. We save the checkpoint
165
+ # here for consistency with eval_llama. The accuracy results we
166
+ # get from eval_llama can be used as a reference to other evaluations.
167
+ if args .output_eager_checkpoint_file is not None :
168
+ torch .save (model , args .output_eager_checkpoint_file )
169
+
161
170
return EagerEvalWrapper (
162
171
model = model ,
163
172
tokenizer = tokenizer ,
@@ -196,6 +205,12 @@ def build_args_parser() -> argparse.ArgumentParser:
196
205
default = None ,
197
206
help = "[For ExecuTorch] Path to the Tokenizer binary for evaluating ExecuTorch models via runtime" ,
198
207
)
208
+ parser .add_argument (
209
+ "--output_eager_checkpoint_file" ,
210
+ type = str ,
211
+ default = None ,
212
+ help = "Save the checkpoint after source transformations, for other evaluation platform to run the same checkpoint." ,
213
+ )
199
214
200
215
return parser
201
216
You can’t perform that action at this time.
0 commit comments