Skip to content

Remove model_ref in token_graph_builder_model#342

Merged
boomanaiden154 merged 5 commits intomainfrom
users/boomanaiden154/remove-model_ref-in-token_graph_builder_model
May 19, 2025
Merged

Remove model_ref in token_graph_builder_model#342
boomanaiden154 merged 5 commits intomainfrom
users/boomanaiden154/remove-model_ref-in-token_graph_builder_model

Conversation

@boomanaiden154
Copy link
Collaborator

With the port to TF2 I added a hack to get access to instruction
annotations and the node mask within the call function of
TokenGraphBuilderModelNodeEmbed. This was necessary due to TF2
preferring eager mode so we could not just pass tensor references
around.

This patch makes everything more canonically TF2 by moving the data
around through standard dataflow (with some slight complexity to ensure
things are getting passed around to the right places) rather than
passing references around. Either one should theoretically work with
tf.function annotations depending upon scope, but this will definitely
work.

boomanaiden154 added a commit to boomanaiden154/gematria that referenced this pull request May 17, 2025
With the port to TF2 I added a hack to get access to instruction
annotations and the node mask within the call function of
TokenGraphBuilderModelNodeEmbed. This was necessary due to TF2
preferring eager mode so we could not just pass tensor references
around.

This patch makes everything more canonically TF2 by moving the data
around through standard dataflow (with some slight complexity to ensure
things are getting passed around to the right places) rather than
passing references around. Either one should theoretically work with
tf.function annotations depending upon scope, but this will definitely
work.

Pull Request: google#342
Copy link
Collaborator

@ondrasej ondrasej left a comment

Choose a reason for hiding this comment

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

Cool!

I think we could simplify the models quite a bit by removing the layers abstraction, and writing this directly in the model. But that is for some other time.

boomanaiden154 and others added 2 commits May 19, 2025 16:13
Created using spr 1.3.4

[skip ci]
Created using spr 1.3.4
@boomanaiden154 boomanaiden154 changed the base branch from users/boomanaiden154/main.remove-model_ref-in-token_graph_builder_model to main May 19, 2025 16:14
Created using spr 1.3.4
@boomanaiden154 boomanaiden154 merged commit 0832708 into main May 19, 2025
3 checks passed
@boomanaiden154 boomanaiden154 deleted the users/boomanaiden154/remove-model_ref-in-token_graph_builder_model branch May 19, 2025 16:16
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