Skip to content

Commit 4f456e7

Browse files
adyasha-dbDaniel Kingdakinggg
authored
Modify validation check for multimodal messages (#1787)
Co-authored-by: Daniel King <daniel@mosaicml.com> Co-authored-by: Daniel King <43149077+dakinggg@users.noreply.github.com>
1 parent 480a49a commit 4f456e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llmfoundry/data/finetuning/tasks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ def _validate_chat_formatted_example(example: ChatFormattedDict):
210210
raise IncorrectMessageKeyQuantityError(list(message.keys()))
211211
if message[role_key] not in _ALLOWED_ROLES:
212212
raise InvalidRoleError(message[role_key], _ALLOWED_ROLES)
213-
if not isinstance(message[content_key], str):
213+
if not isinstance(message[content_key], (list, str)):
214+
# this validation check accepts text-only as well as multimodal messages for chat-enabled models
214215
raise InvalidContentTypeError(type(message[content_key]))
215216
if last_message_role is not None and last_message_role == message[
216217
role_key]:

0 commit comments

Comments
 (0)