Skip to content

Account for max_length for nutrient_extraction model #1617

@raphael0202

Description

@raphael0202

Currently, we're only using the first 512 tokens when performing nutrient extraction, due to the model context size limits. Consequently, we sometimes miss the nutrition information, such as here: https://robotoff.openfoodfacts.org/api/v1/image_predictions?model_name=nutrition_extractor&barcode=4972443146118&image_id=2.

To alleviate this issue, we can possibly:

  • send consecutive chunks of 512 tokens at a time, and concatenate the results. However, this may result in incorrect prediction, especially if the end of the chunk is inside an entity.
  • use heuristics to detect the beginning of the nutrition table, and send an additional prediction request with the tokens starting at the detected beginning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions