mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2025-06-29 04:35:05 +00:00
Avoid print in get_hf_chat_template.py
This commit is contained in:
@ -56,7 +56,7 @@ def get_hf_chat_template(model_id, variant=None):
|
|||||||
if 'default' not in variants:
|
if 'default' not in variants:
|
||||||
raise Exception(f'Please specify a chat template variant (one of {format_variants()})')
|
raise Exception(f'Please specify a chat template variant (one of {format_variants()})')
|
||||||
variant = 'default'
|
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:
|
elif variant not in variants:
|
||||||
raise Exception(f"Variant {variant} not found in chat template (found {format_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]
|
variant = None if len(args) < 2 else args[1]
|
||||||
|
|
||||||
template = get_hf_chat_template(model_id, variant)
|
template = get_hf_chat_template(model_id, variant)
|
||||||
print(template, end=None)
|
sys.stdout.write(template)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Reference in New Issue
Block a user