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

inference mode issue #390

Open
beijinggao opened this issue Mar 18, 2024 · 1 comment
Open

inference mode issue #390

beijinggao opened this issue Mar 18, 2024 · 1 comment

Comments

@beijinggao
Copy link

beijinggao commented Mar 18, 2024

After exporting the model for prediction, I found that setting de.enable_inference_mode() is required.

and comment is :
de.enable_inference_mode()

TrainableWrapper.read_value` is not thread-safe that causes threads
competition and Out-Of-Bound exception in concurrent serving scenario.

To resolve this, we define the ModelMode APIs to instruct
the TrainableWrapper to build a different thread-safe sub-graph
for 'TrainableWrapper.read_value' on inference mode.

But after export the model and use tensorflow serving or trion to inference,how to set enable_inference_mode(),or is it necessary ?

@MoFHeka
Copy link
Contributor

MoFHeka commented Apr 26, 2024

model = build_model(xxx)
de.enable_inference_mode()
model.save(export_dir)

enable_inference_mode is used to change the graph building logic inner TFRA. It would be reduce two times memory copy in TrainableWrapper which are IDs and Embedding Values.

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