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 progress callback #157

Open
entmike opened this issue Aug 9, 2022 · 0 comments
Open

Add progress callback #157

entmike opened this issue Aug 9, 2022 · 0 comments

Comments

@entmike
Copy link

entmike commented Aug 9, 2022

Similar to what was added here recently:

https://github.com/jina-ai/discoart/blob/main/discoart/persist.py#L63

              if is_save_step:
                if is_image_output:
                    if cur_t == -1:
                        f_name = os.path.join(output_dir, f'{_nb}-done-{k}.png')
                    else:
                        f_name = os.path.join(output_dir, f'{_nb}-step-{j}-{k}.png')
                    c.save_uri_to_file(f_name)

                    if callable(image_callback):
                        image_callback(f_name)

                da[k].chunks.append(c)

It would be good to also have a more generalized callback for progress updates, as well as it not being bound to the frequency of saves (is_save_step for instance)

Proposed pseudo-code:

              if is_progress_step:
                    if callable(progress_callback):
                        progress_callback( any progress amount, maybe image as bytecode etc passed in an event/dict format )
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

1 participant