From 06b5159560de404c018026099bdc636f4d2930c6 Mon Sep 17 00:00:00 2001 From: ochafik Date: Mon, 30 Dec 2024 04:10:35 +0000 Subject: [PATCH] Avoid print in get_hf_chat_template.py --- scripts/get_hf_chat_template.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/get_hf_chat_template.py b/scripts/get_hf_chat_template.py index 820b84efc..23bb1de59 100755 --- a/scripts/get_hf_chat_template.py +++ b/scripts/get_hf_chat_template.py @@ -56,7 +56,7 @@ def get_hf_chat_template(model_id, variant=None): if 'default' not in variants: raise Exception(f'Please specify a chat template variant (one of {format_variants()})') variant = 'default' - print(f'Note: picked "default" chat template variant (out of {format_variants()})', file=sys.stderr) + sys.stderr.write(f'Note: picked "default" chat template variant (out of {format_variants()})\n') elif variant not in variants: raise Exception(f"Variant {variant} not found in chat template (found {format_variants()})") @@ -70,7 +70,7 @@ def main(args): variant = None if len(args) < 2 else args[1] template = get_hf_chat_template(model_id, variant) - print(template, end=None) + sys.stdout.write(template) if __name__ == '__main__':