Skip to content

Make progress bar in SentenceTransformer.encode() configurable #3599

@lbhm

Description

@lbhm

I regularly use the show_progress_bar parameter in SentenceTransformer.encode() to track the progress of larger jobs. While the current functionality is already helpful, I would love to be able to configure the progress bar behavior. For example, I often use leave=False or dynamic_ncols=True (see the tqdm docs) in my self-created progress bars.

I understand that these parameters are not helpful in all situations, so I was wondering whether it would be acceptable to change the type of show_progress_bar to bool | dict[str, Any] | None = None. In addition to the current behavior, if the user passes a dict, it is interpreted as tqdm parameters and passed to the trange() call. Otherwise, the current default parameters are used.

I'm not sure if the suggested change has implications for other parts of the code base, so I wanted to raise this as a discussion point first. Since the behavior for bool or None values is unchanged, there should be no breaking behavior changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions