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:
mark
2024-09-26 16:59:01 +01:00
committed by GitHub
parent e5c98f4715
commit bb433e2b78

View File

@@ -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)