Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

add better bettertransformers support #509

Merged
merged 5 commits into from
Jan 3, 2025

Conversation

michaelfeil
Copy link
Owner

Related Issue

Checklist

  • I have read the CONTRIBUTING guidelines.
  • I have added tests to cover my changes.
  • I have updated the documentation (docs folder) accordingly.

Additional Notes

Add any other context about the PR here.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR enhances BetterTransformer support across multiple transformer modules, particularly focusing on compatibility checks and proper initialization order for the nomic-ai/nomic-embed-text-v1.5 model.

  • Added check_if_bettertransformer_possible function in /libs/infinity_emb/infinity_emb/transformer/acceleration.py to verify model compatibility
  • Modified transformer modules to conditionally enable BetterTransformer only when both compatible and enabled
  • Moved BetterTransformer conversion after quantization for proper operation order
  • Standardized benchmark parameters in Makefile to 50 requests/50 concurrent for both text and vision tests
  • Added 'eager' attention implementation setting when BetterTransformer is enabled and compatible

6 file(s) reviewed, 7 comment(s)
Edit PR Review Bot Settings | Greptile

@@ -26,18 +26,14 @@ class TorchAudioModel(BaseAudioEmbedModel):
def __init__(self, *, engine_args: EngineArgs):
CHECK_TORCH.mark_required()
CHECK_TRANSFORMERS.mark_required()

self.model = AutoModel.from_pretrained(
engine_args.model_name_or_path,
revision=engine_args.revision,
trust_remote_code=engine_args.trust_remote_code,
# attn_implementation="eager" if engine_args.bettertransformer else None,
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: bettertransformer support appears incomplete - the commented line suggests it's not fully implemented yet

libs/infinity_emb/infinity_emb/transformer/acceleration.py Outdated Show resolved Hide resolved
libs/infinity_emb/Makefile Outdated Show resolved Hide resolved
libs/infinity_emb/Makefile Outdated Show resolved Hide resolved
michaelfeil and others added 2 commits January 3, 2025 08:06
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@codecov-commenter
Copy link

codecov-commenter commented Jan 3, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.85%. Comparing base (c69f927) to head (d33c9e0).

Files with missing lines Patch % Lines
...emb/infinity_emb/transformer/crossencoder/torch.py 80.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #509      +/-   ##
==========================================
- Coverage   80.00%   79.85%   -0.16%     
==========================================
  Files          43       43              
  Lines        3471     3484      +13     
==========================================
+ Hits         2777     2782       +5     
- Misses        694      702       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@michaelfeil michaelfeil merged commit ef4c424 into main Jan 3, 2025
36 checks passed
@michaelfeil michaelfeil deleted the better-bettertransformers-support branch January 3, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants