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

Overloads download method to specify progress #71

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

lordofthejars
Copy link
Contributor

Overloads download method to specify progress.

Notifying progress is something that might sound informative task, but in production environments might be a key operation, for example in case of a Java FX you might want to print a progress bar in the screen, or in a Kubernetes environment you might want to add a health check (Readiness check) till the download is completed.

Of course, there are multiple ways of doing it, but the library already provides the interface, so the best way is doing using it.

Instead of using the whole download method with all parameters, I have just added a new method that takes the model, where to store it and also let you redefine the progress bar. In this way, it is easier for developer to cover this use case and not having to pass all the arguments.

This is a helping method as developers can still use the full parameters method to do it.

@tjake
Copy link
Owner

tjake commented Oct 16, 2024

Hmm I can't figure out how to run the workflows, they should work

@lordofthejars
Copy link
Contributor Author

lordofthejars commented Oct 16, 2024

For example:

JavaFxProgressBar p=....

SafeTensorSupport.maybeDownload(dir, model, (s, c, t) ->  {
          p.update(c/t);
}

Or for example because you want to log it in a special way:

SafeTensorSupport.maybeDownload(dir, model, (s, c, t) ->  {
          mySpecialLogger.info(c/t);
}

It is just an example,but this could be how you can update a JafaFx component, instead of using the maybeDownload with all required parameters like Http headers and so on.

@tjake tjake closed this Oct 17, 2024
@tjake tjake reopened this Oct 17, 2024
@tjake
Copy link
Owner

tjake commented Oct 17, 2024

Sorry I was referring to the projects Unit Test GitHub Action. This is now working

@tjake tjake merged commit 4ad4fc4 into tjake:main Oct 17, 2024
8 checks passed
@lordofthejars
Copy link
Contributor Author

Thanks, now I will start working on what we discussed about changing the functional interface into an interface.

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