There are a rare few incomplete files in the recently-uploaded webcrawl data

#4
by lukemerrick - opened

I noticed a very rare few files in this dataset appear to be incomplete, ending in a line that stop in the middle rather than completing as a valid JSON string.

One such example is dolma3_pool/data/common_crawl-software-0019/shard_00000152.jsonl.zst for which the final line (line 38290) which ends abruptly in the text section of the json line.

This causes an error when trying to read and parse the file's json, e.g.:

pd.read_json("~/Downloads/shard_00000152.jsonl.zst", lines=True)
# ValueError: Unmatched ''"' when when decoding 'string'

More detailed error information can be obtained by parsing line-by-line with a try-catch:

from pathlib import path

import zstandard as zstd
import json
import io
from tqdm.auto import tqdm

# NOTE: Initialize p_list with a list of Path objects pointing to the files.
for p in p_list:
    print(p)
    with open(p, "rb") as f:
        dctx = zstd.ZstdDecompressor()
        with dctx.stream_reader(f) as reader:
            text_reader = io.TextIOWrapper(reader, encoding="utf-8")
            for i, line in enumerate(tqdm(text_reader)):
                line = line.rstrip("\n")
                if not line:
                    continue
                try:
                    json.loads(line)
                except json.JSONDecodeError as e:
                    print(f"Line {i + 1}: {e}")
                    # Example: "Line 35254: Unterminated string starting at: line 1 column 1120 (char 1119)"
                    print(f"Raw: {repr(line)}")

In total I had to skip all of the following incomplete files when reading the common-crawl subset of the olmo3 pool dataset:

common_crawl-software-0019/shard_00000152.jsonl.zst
common_crawl-travel_and_tourism-0015/shard_00000312.jsonl.zst
common_crawl-social_life-0015/shard_00000129.jsonl.zst
common_crawl-transportation-0019/shard_00000094.jsonl.zst
common_crawl-transportation-0019/shard_00000092.jsonl.zst
common_crawl-travel_and_tourism-0007/shard_00000378.jsonl.zst

Given that all of these files were recently uploaded after discussion #3, I think there may have been some issue in that particular upload, and it is quite possible that this issue does not affect the other portions of the dataset, but it may be useful to check.

Hi @lukemerrick ! Thanks for pointing this out - my guess is it could be an issue with recompression after we processed some of the metadata. I'll fix the files you noted right away and then will scan the rest of the dataset to see if it happens anywhere else!

@lukemerrick fixed those files and tested loading them in - worked on my end now! I also checked most of the earlier common crawl directories and didn't find any other cases of this, but please do let me know if you find otherwise. Thanks again for your patience and for notifying us of these issues!

Oh sorry I should have mentioned that I was successful in parsing all the common crawl data besides the files I mentioned! Glad you double checked, though, and thank you for updating the truncates files!

lukemerrick changed discussion status to closed

Oh great, even better to have a double check! :)

Sign up or log in to comment