Skip to content

feat(sentiment): add batch processing for transcript chunks #8

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

siddanth-6365
Copy link

@siddanth-6365 siddanth-6365 commented Mar 16, 2025

This PR introduces batch processing for sentiment analysis at the per-request level. Instead of processing each transcript chunk sequentially, the new changes allow multiple chunks from a single input to be processed together in a single batch.
The improvements include:

Model Layer:
Added a new batch_forward() method in the BertweetSentiment model that accepts a list of texts and returns sentiment predictions for all texts in one call.

Data Layer:
Added an analyze_batch() function that leverages the model’s batch_forward() method to perform batch sentiment analysis.

Service Layer:
Introduced a corresponding analyze_batch() function in the sentiment service layer.
Updated the main processing function to collect transcript chunk texts from an input, process them in a batch using the new method, and then map the results back to the chunks.

Notes

  • Benchmark tests indicate a modest reduction in overall processing time (batch: ~15.84s vs. normal: ~18.66s), though the improvement may vary depending on the input length and number of chunks.

Please review and provide feedback.

- Added 'batch_forward()' method in BertweetSentiment model.
- Added 'analyze_batch()' in sentiment data layer.
- Added corresponding 'analyze_batch()' in sentiment service layer.
- Modified pipeline process to use batch analysis for transcript chunks.
@siddanth-6365
Copy link
Author

siddanth-6365 commented Mar 16, 2025

@KarinePistili can you review this pr, i will soon post the Performance Comparison details of this

@siddanth-6365 siddanth-6365 changed the title feat(sentiment): add batch processing for sentiment analysis feat(sentiment): add batch processing for transcript chunks Mar 16, 2025
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.

1 participant