fix: pyarrow float to int64 conversion error in dataset generator

#3

The dataset fails to load with datasets==3.6.0 and pyarrow==20.0.0 due to a type conversion error:

pyarrow.lib.ArrowInvalid: Float value 0.000012 was truncated converting to int64

This occurs because the JSON data contains floating-point values in bounding box coordinates, but the dataset schema expects int64 values.

Solution

  • Added convert_bbox_to_int() helper function to properly convert float coordinates to integers using int(round(coord))
  • Applied conversion to both bboxes_block and bboxes_line in _generate_examples()

Tested with:

  • datasets==3.6.0
  • pyarrow==20.0.0
  • Successfully loads all splits (train/validation/test) without errors
Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment