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

Short-circuit operator? #357

Open
evanmiller opened this issue Jul 8, 2023 · 2 comments
Open

Short-circuit operator? #357

evanmiller opened this issue Jul 8, 2023 · 2 comments

Comments

@evanmiller
Copy link

I'm playing with an idea to short-circuit a graph if a certain condition is met. Specifically, I'd like to have one or more "checkpoints" in a Transformer model where the logits are evaluated mid-graph – if they overwhelmingly favor one token, the remaining layers are ignored. Is a short-circuit functionality something that would be considered in GGML? A very basic version could just abort the graph computation; a more complicated one might point to a downstream task.

@evanmiller
Copy link
Author

Related: #283

@ggerganov
Copy link
Owner

I think you can achieve that with #308 and a custom op defined in user code.
When you build the graph, you add the custom op at the points where you are interested to have it and the op would set a bool for example if the "short-circuit" condition is met. The abort callback provided to ggml_graph_compute() would check the bool and abort the computation if is set

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