Comments (2)
Currently, in our docker container, we create a virtual environment and install torchserve inside it as follows:
Lines 54 to 58 in 33d87e3
The feature to use virtual environment to install custom model dependencies creates a separate virtual environment and attempts to start the model worker and load the model in the new virtual environment. This fails at the following point:
2024-02-12T21:54:23,630 [INFO ] epollEventLoopGroup-3-1 org.pytorch.serve.wlm.ModelManager - Model mnist_custom_dependencies loaded.
2024-02-12T21:54:23,631 [DEBUG] epollEventLoopGroup-3-1 org.pytorch.serve.wlm.ModelManager - updateModel: mnist_custom_dependencies, count: 1
2024-02-12T21:54:23,638 [DEBUG] W-9000-mnist_custom_dependencies_1.0 org.pytorch.serve.wlm.WorkerLifeCycle - Worker cmdline: [/home/model-server/tmp/models/0f78acce5ed84427a9e427e3ea7d9394/venv/bin/python, /home/venv/lib/python3.9/site-packages/ts/model_service_worker.py, --sock-type, unix, --sock-name, /home/model-server/tmp/.ts.sock.9000, --metrics-config, /home/venv/lib/python3.9/site-packages/ts/configs/metrics.yaml]
2024-02-12T21:54:23,690 [WARN ] W-9000-mnist_custom_dependencies_1.0-stderr MODEL_LOG - Traceback (most recent call last):
2024-02-12T21:54:23,691 [WARN ] W-9000-mnist_custom_dependencies_1.0-stderr MODEL_LOG - File "/home/venv/lib/python3.9/site-packages/ts/model_service_worker.py", line 15, in <module>
2024-02-12T21:54:23,692 [WARN ] W-9000-mnist_custom_dependencies_1.0-stderr MODEL_LOG - from ts.arg_parser import ArgParser
2024-02-12T21:54:23,693 [WARN ] W-9000-mnist_custom_dependencies_1.0-stderr MODEL_LOG - ModuleNotFoundError: No module named 'ts'
Root cause of the issue is that venv created during the container build contains torchserve
installed to its site-packages. The new venv that is created to load the model inherits the system site packages but not site-packages of the existing venv in which torchserve is installed, hence from ts.arg_parser import ArgParser
fails.
Potential options to fix this:
- Document that the
useVenv
option is not supported whentorchserve
is installed and already started from a virtual environment and disable theuseVenv
related tests for Docker. - Find a way to inherit site-packages from one venv in another.
from serve.
Currently, in our docker container, we create a virtual environment and install torchserve inside it as follows:
Lines 54 to 58 in 33d87e3
The feature to use virtual environment to install custom model dependencies creates a separate virtual environment and attempts to start the model worker and load the model in the new virtual environment. This fails at the following point:
2024-02-12T21:54:23,630 [INFO ] epollEventLoopGroup-3-1 org.pytorch.serve.wlm.ModelManager - Model mnist_custom_dependencies loaded. 2024-02-12T21:54:23,631 [DEBUG] epollEventLoopGroup-3-1 org.pytorch.serve.wlm.ModelManager - updateModel: mnist_custom_dependencies, count: 1 2024-02-12T21:54:23,638 [DEBUG] W-9000-mnist_custom_dependencies_1.0 org.pytorch.serve.wlm.WorkerLifeCycle - Worker cmdline: [/home/model-server/tmp/models/0f78acce5ed84427a9e427e3ea7d9394/venv/bin/python, /home/venv/lib/python3.9/site-packages/ts/model_service_worker.py, --sock-type, unix, --sock-name, /home/model-server/tmp/.ts.sock.9000, --metrics-config, /home/venv/lib/python3.9/site-packages/ts/configs/metrics.yaml] 2024-02-12T21:54:23,690 [WARN ] W-9000-mnist_custom_dependencies_1.0-stderr MODEL_LOG - Traceback (most recent call last): 2024-02-12T21:54:23,691 [WARN ] W-9000-mnist_custom_dependencies_1.0-stderr MODEL_LOG - File "/home/venv/lib/python3.9/site-packages/ts/model_service_worker.py", line 15, in <module> 2024-02-12T21:54:23,692 [WARN ] W-9000-mnist_custom_dependencies_1.0-stderr MODEL_LOG - from ts.arg_parser import ArgParser 2024-02-12T21:54:23,693 [WARN ] W-9000-mnist_custom_dependencies_1.0-stderr MODEL_LOG - ModuleNotFoundError: No module named 'ts'
Root cause of the issue is that venv created during the container build contains
torchserve
installed to its site-packages. The new venv that is created to load the model inherits the system site packages but not site-packages of the existing venv in which torchserve is installed, hencefrom ts.arg_parser import ArgParser
fails.Potential options to fix this:
- Document that the
useVenv
option is not supported whentorchserve
is installed and already started from a virtual environment and disable theuseVenv
related tests for Docker.- Find a way to inherit site-packages from one venv in another.
How this is different compared to creating a venv, installing TorchServe standalone and then using useVenv
from serve.
Related Issues (20)
- Update large_models/tp_llama to llama3
- Update large_models/gpt_fast to llama3
- How to pass parameters from preprocessing to postprocessing when using micro-batch operations HOT 4
- Load model failed - error: Worker died HOT 6
- Docker regression failure: test_handler_traceback_logging.py
- Exchange Llama2 against Llama3 in HF_accelerate example
- CUDA out of Memory with low Memory Utilization (CUDA error: device-side assert triggered) HOT 5
- If micro_batch_size of micro-batch is set to 1, then model inference is still batch processing? HOT 1
- question to model inference optimization HOT 1
- Duplicate base_neuronx_continuous_batching_handler.py HOT 1
- Continuous Batching does not work with newest transformer issue
- Limit resource in docker compose and worker in model HOT 2
- model archiver example very long 1 liner
- install dependency via conda
- Enable token authentication as default
- Support "model-control-mode" in configuration
- Make torchserve-kfs docker image multiplatform
- Standardize PyTorch 2.x features config in model-config.yaml
- NotImplementedError: Cannot copy out of meta tensor; no data! + Models not generating output text
- The service crashes if the model takes a long time to respond
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serve.