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

Mangle root scope TF variable name during tf.saved_model export #5738

Merged
merged 2 commits into from
Oct 26, 2023

Conversation

lsy323
Copy link
Collaborator

@lsy323 lsy323 commented Oct 26, 2023

The following error is hit during tf.saved_model export:

ValueError: '_param_constant61' is not a valid root scope name. A root scope name has to match the following pattern: ^[A-Za-z0-9.][A-Za-z0-9_.\\/>-]*$

The reason is TF has more restricted constrain on the variable names at root scope. The variable name is from state_dict of ExportedProgram, which doesn't have such naming constrain.

Root scope name constrain: [A-Za-z0-9.][A-Za-z0-9_.\-/]*
Non-root scope name constrain: [A-Za-z0-9_.\-/]*

code ref in TF

Name mangling: Add 'k' if the variable name starts with '_\-/'

Testing: Manually test the model failed to be exported to tf.saved_model

@lsy323 lsy323 requested a review from qihqi October 26, 2023 00:13
@qihqi qihqi merged commit 33ff3c2 into master Oct 26, 2023
18 checks passed
@lsy323 lsy323 deleted the lsiyuan/mangle-tf-root-scope-name branch October 27, 2023 03:45
jonb377 pushed a commit that referenced this pull request Oct 31, 2023
mbzomowski pushed a commit to mbzomowski-test-org/xla that referenced this pull request Nov 16, 2023
ManfeiBai pushed a commit that referenced this pull request Nov 29, 2023
ManfeiBai pushed a commit that referenced this pull request Nov 29, 2023
chunnienc pushed a commit to chunnienc/xla that referenced this pull request Dec 14, 2023
golechwierowicz pushed a commit that referenced this pull request Jan 12, 2024
bhavya01 pushed a commit that referenced this pull request Apr 22, 2024
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