发布

  • feat: use block matrix to reduce peak memory usage for matmul (#3947)

    frostbyte_neo 发布于 2025-03-07 00:28:36 +00:00

    This PR targets the most memory expensive operation in partition pdf and
    images: deduplicate pdfminer elements. In large pages the number of
    elements can be over 10k, which would generate multiple 10k x 10k square
    double float matrices during deduplication, pushing peak memory usage
    close to 13Gb
    Screenshot 2025-03-06 at 3 22<br>
52 PM

    This PR breaks this computation down by computing partial IOU. More
    precisely it computes IOU for each 2000 elements against all the
    elements at a time to reduce peak memory usage by about 10x to around
    1.6Gb.

    image

    The block size is configurable based on user preference for peak memory
    usage and it is set by changing the env UNST_MATMUL_MEMORY_CAP_IN_GB.

    下载附件