Skip to content

Commit 7529a38

Browse files
Arsh ZahedArsh Zahed
authored andcommitted
Add check for unneeded jsonl columns
1 parent 49b8c28 commit 7529a38

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/together/utils/files.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,18 @@ def _check_jsonl(file: Path) -> Dict[str, Any]:
142142
error_source="format",
143143
)
144144

145+
# Check that there are not extra columns
146+
for column in json_line:
147+
if (
148+
column
149+
not in JSONL_REQUIRED_COLUMNS_MAP[possible_format]
150+
):
151+
raise InvalidFileFormatError(
152+
message=f"Found extra column {column} in the line {idx + 1}.",
153+
line_number=idx + 1,
154+
error_source="format",
155+
)
156+
145157
if current_format is None:
146158
raise InvalidFileFormatError(
147159
message=(

0 commit comments

Comments
 (0)