mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-12-16 02:08:55 +08:00
Update generate.py
Add functionality to take --save-kv-cache 'path/to/cache' and pass it to the modified utils.py
This commit is contained in:
@@ -101,6 +101,12 @@ def setup_arg_parser():
|
|||||||
default=None,
|
default=None,
|
||||||
help="A file containing saved KV caches to avoid recomputing them",
|
help="A file containing saved KV caches to avoid recomputing them",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--save-kv-cache",
|
||||||
|
type=str,
|
||||||
|
default=None,
|
||||||
|
help="Path to save the final KV cache after generation",
|
||||||
|
)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
@@ -234,6 +240,7 @@ def main():
|
|||||||
top_p=args.top_p,
|
top_p=args.top_p,
|
||||||
max_kv_size=max_kv_size,
|
max_kv_size=max_kv_size,
|
||||||
cache_history=cache_history,
|
cache_history=cache_history,
|
||||||
|
save_cache_path=args.save_kv_cache, # Add this line
|
||||||
)
|
)
|
||||||
if not args.verbose:
|
if not args.verbose:
|
||||||
print(response)
|
print(response)
|
||||||
|
|||||||
Reference in New Issue
Block a user