diff --git a/llms/mlx_lm/generate.py b/llms/mlx_lm/generate.py index 394c8e15..dfdffa1b 100644 --- a/llms/mlx_lm/generate.py +++ b/llms/mlx_lm/generate.py @@ -61,6 +61,11 @@ def setup_arg_parser(): action="store_true", help="Use the raw prompt without the tokenizer's chat template.", ) + parser.add_argument( + "--use-default-chat-template", + action="store_true", + help="Use the default chat template", + ) parser.add_argument( "--colorize", action="store_true", @@ -108,6 +113,10 @@ def main(args): args.model, adapter_file=args.adapter_file, tokenizer_config=tokenizer_config ) + if args.use_default_chat_template: + if tokenizer.chat_template is None: + tokenizer.chat_template = tokenizer.default_chat_template + if not args.ignore_chat_template and ( hasattr(tokenizer, "apply_chat_template") and tokenizer.chat_template is not None