Skip to content

Update Compel to 2.1.1 and apply Sentences Split logic #8026

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
May 27, 2025

Conversation

hipsterusername
Copy link
Member

@hipsterusername hipsterusername commented May 20, 2025

Summary

This pull request introduces changes to improve text handling in the compel node and updates project metadata and dependencies in pyproject.toml. Key updates include enabling sentence-based splitting for long text prompts, updating dependency versions, and revising project metadata to reflect the current state of the project.

We should consider advising that very long prompts may have different results using the new parsing logic, but are reproducible if manually split using the .and() parsing logic.

Changes to text handling in compel.py:

  • Added SplitLongTextMode.SENTENCES to the split_long_text_mode parameter in two instances of Compel initialization, enabling more graceful splitting of long text prompts. [1] [2]
  • Imported SplitLongTextMode from the compel library to support the new functionality.

Updates to pyproject.toml:

  • Updated the compel dependency version from 2.0.2 to 2.1.1 to ensure compatibility with the new text-splitting functionality.
  • Revised project metadata

QA Instructions

Test prompts (I've done testing myself and seen behavior continue to function)

Merge Plan

N/A

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions bot added python PRs that change python files Root invocations PRs that change invocations python-deps PRs that change python dependencies labels May 20, 2025
@hipsterusername hipsterusername marked this pull request as ready for review May 26, 2025 01:26
@@ -205,6 +206,7 @@ def _lora_loader() -> Iterator[Tuple[ModelPatchRaw, float]]:
returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED, # TODO: clip skip
requires_pooled=get_pooled,
device=TorchDevice.choose_torch_device(),
split_long_text_mode=SplitLongTextMode.SENTENCES,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default behaviour in v2.1.1, but it doesn't hurt to manually specify it.

https://github.com/damian0815/compel/blob/2.1.1/src/compel/compel.py#L34

@hipsterusername hipsterusername merged commit d7f93c3 into main May 27, 2025
12 checks passed
@hipsterusername hipsterusername deleted the compel-updates branch May 27, 2025 02:54
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
invocations PRs that change invocations python PRs that change python files python-deps PRs that change python dependencies Root
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants