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

Progress Bar #74

Open
vahidthegreat opened this issue Nov 24, 2022 · 5 comments
Open

Progress Bar #74

vahidthegreat opened this issue Nov 24, 2022 · 5 comments

Comments

@vahidthegreat
Copy link

Can you add a progress bar feature too?

@laurahanu
Copy link
Collaborator

Hello, what would be the use case of a progress bar? If running it on a batch of text, you can get a quick progress bar by using tqdm in your for loop.

@vahidthegreat
Copy link
Author

That's in case I wanna query sentences one by one, which is not good because it slows the machine down as the model does initialization for each sentence.
The faster way would be to query an array of sentences. For that a progress-bar is useful.

@laurahanu
Copy link
Collaborator

It shouldn't initialise the model for each sentence, are you defining the model first and then do the prediction for each sentence? e.g.

model = Detoxify("unbiased")
for batch in tqdm(data_batches):
    results = model.predict(batch)

@vahidthegreat
Copy link
Author

IDK. I had seen in other hugging face models that each batch starts with a low speed and then the progress bar goes more fastly when it moves more to the end (for each batch).
Thus, I think if we only have one collective batch, the overall speed will be higher (?)

@laurahanu
Copy link
Collaborator

Depends on how big your batch is and how much you can fit into your memory, if it's large enough it might be more efficient to do it in smaller batches. Are you doing this on cpu or gpu?

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

No branches or pull requests

2 participants