Skip to content

feat: allow progress bar while batching#628

Merged
JoanFM merged 8 commits intomainfrom
feat-batch-show-progress
Oct 17, 2022
Merged

feat: allow progress bar while batching#628
JoanFM merged 8 commits intomainfrom
feat-batch-show-progress

Conversation

@bwanglzu
Copy link
Copy Markdown

@bwanglzu bwanglzu commented Oct 16, 2022

Goals:

  • In Finetuner, we allow user to encode Documents by batches. When length of DA is large, say 100k, it's easier to have the progress bar natively builtin docarray to monitor the progress.

see it lively:

68747470733a2f2f692e6779617a6f2e636f6d2f39613630653433396639356531376662303132303365373530396133666166652e676966

usage:

import time
from docarray import Document, DocumentArray

da = DocumentArray()
for i in range(1, 100000):
    da.append(Document(text=str(i)))

print('append finished')

- for batch in da.batch(500):
+ for batch in da.batch(500, show_progress=True):
     time.sleep(0.1)

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 16, 2022

Codecov Report

Merging #628 (5602404) into main (a2e0fe6) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #628   +/-   ##
=======================================
  Coverage   85.02%   85.02%           
=======================================
  Files         133      133           
  Lines        6717     6718    +1     
=======================================
+ Hits         5711     5712    +1     
  Misses       1006     1006           
Flag Coverage Δ
docarray 85.02% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
docarray/array/mixins/group.py 87.50% <100.00%> (+0.32%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@JoanFM
Copy link
Copy Markdown
Member

JoanFM commented Oct 17, 2022

Goals:

  • In Finetuner, we allow user to encode Documents by batches. When length of DA is large, say 100k, it's easier to have the progress bar natively builtin docarray to monitor the progress.

Can u please show an example of how it looks before and after the change?

Copy link
Copy Markdown
Member

@JoanFM JoanFM left a comment

Choose a reason for hiding this comment

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

Please, share example of how it looks before and after

@bwanglzu
Copy link
Copy Markdown
Author

bwanglzu commented Oct 17, 2022

@JoanFM added in PR description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants