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

async requests enabled #376

Merged
merged 3 commits into from
Sep 24, 2024
Merged

async requests enabled #376

merged 3 commits into from
Sep 24, 2024

Conversation

michaelfeil
Copy link
Owner

No description provided.

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 pull request implements asynchronous processing for image and audio embedding in the Infinity library, focusing on improving performance through concurrent operations.

  • Modified BatchHandler in batch_handler.py to directly use asynchronous resolve_images and resolve_audios functions
  • Updated vision/utils.py to use asyncio and aiohttp for asynchronous image and audio processing
  • Implemented parallel processing of multiple images or audio files using asyncio.gather
  • Removed asyncio.to_thread calls in image_embed and audio_embed methods, suggesting full asynchronous implementation
  • Changed HTTP requests from synchronous requests library to asynchronous aiohttp for improved efficiency

2 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings

def resolve_images(images: List[Union[str, "ImageClassType"]]) -> List[ImageSingle]:
async def resolve_images(
images: List[Union[str, "ImageClassType"]]
) -> List[ImageSingle]:
"""Resolve images from URLs or ImageClassType Objects using multithreading."""
# TODO: improve parallel requests, safety, error handling
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: CHECK_REQUESTS.mark_required() is called but requests is no longer used

@codecov-commenter
Copy link

codecov-commenter commented Sep 24, 2024

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

Codecov Report

Attention: Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 78.18%. Comparing base (ce4e27c) to head (e465cbe).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...inity_emb/infinity_emb/transformer/vision/utils.py 90.90% 2 Missing ⚠️

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

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #376   +/-   ##
=======================================
  Coverage   78.18%   78.18%           
=======================================
  Files          36       36           
  Lines        2773     2773           
=======================================
  Hits         2168     2168           
  Misses        605      605           

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

@michaelfeil michaelfeil merged commit 06fd1f4 into main Sep 24, 2024
36 checks passed
@michaelfeil michaelfeil deleted the mf-async-requests branch September 24, 2024 03:58
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