Metadata: Fix loading Command R+ template with multiple options

This commit is contained in:
oobabooga 2024-04-06 07:32:17 -07:00
parent 1b87844928
commit 64a76856bd

View File

@ -117,6 +117,9 @@ def get_model_metadata(model):
metadata = json.loads(open(path, 'r', encoding='utf-8').read()) metadata = json.loads(open(path, 'r', encoding='utf-8').read())
if 'chat_template' in metadata: if 'chat_template' in metadata:
template = metadata['chat_template'] template = metadata['chat_template']
if isinstance(template, list):
template = template[0]['template']
for k in ['eos_token', 'bos_token']: for k in ['eos_token', 'bos_token']:
if k in metadata: if k in metadata:
value = metadata[k] value = metadata[k]