In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
How to deploy the TensorFlow model, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
TensorFlow model deployment 1. Docker image pull # Download the TensorFlow Serving Docker image and repodocker pull tensorflow/serving2. Save model # set the version number field of the model when saving the model, otherwise the error model.save (". / data/models/zsh_test/1") 3 of the model version will not be found after deployment to docker. Deployment Model 3.1 single Model deployment # Mapping restapi port 8501 The path defined by the grpc port 850map model # defines the model name docker run-p 8501├── 8501\-v / path/to/model/models/zsh_test:/models/zsh_test/\-e MODEL_NAME=zsh_test-t tensorflow/serving# model structure ~ / PycharmProjects/pytorch-study/data/models ❯ tree. └── zsh_test └── 1 ├── assets model saved_model. Pb └── variables ├── variables.data-00000-of-00001 └── variables.index4 directories 3 files3.2 multiple model deployment
Directory structure
Save multiple models under the model saving folder models, and add models.config configuration files to configure the basic model information.
~ / PycharmProjects/pytorch-study/data ❯ tree. ├── exp_all_data.csv ├── exp_all_result.csv └── models ├── models.config ├── zsh_test │ └── 1 │ ├── assets │ ├── saved_model.pb │ └── variables │ ├── variables.data-00000-of-00001 │ └── variables.index └── zsh_test1 └── 1 ├── assets ├── saved_model.pb └── variables ├── variables.data-00000-of-00001 └── variables.index9 directories 9 files
Configuration file
Model_config_list: {config: {name: "zsh_test", base_path: "/ models/zsh_test", model_platform: "tensorflow"}, config: {name: "zsh_test1", base_path: "/ models/zsh_test1", model_platform: "tensorflow"}}
# deploy multiple models docker run-p 8501 tensorflow/serving 8501\-v / path/to/model/models/:/models/\-t model-- model_config_file=/models/models.config4. Test API # http://ip:prot/version/models/model_name # to view model information curl http://localhost:8501/v1/models/zsh_test response: {"model_version_status": [{"version": "1", "state": "AVAILABLE", "status": {"error_code": "OK" "error_message": ""}}]} # call the model curl-- location-- request POST 'http://localhost:8501/v1/models/zsh_test:predict'\-- header' Content-Type: application/json'\-- data'{"instances": [test_data]}'is it helpful for you to read the above? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.