googleapis / googleapis/python-aiplatform
`LocalModel.build_cpr_model` fails when using base_image containing `/`
- 主要语言
- Python
- 星标
- 905
- 派生
- 465
- 平均合并
- 1 天 13 小时
- 30 天内合并 PR
- 44
描述
#### Environment details
- OS type and version: macOS 13.4.1 and Ubuntu 22.04
- Python version: 3.11.4
- pip version: 23.0.1
- `google-cloud-aiplatform` version: 1.34.0
#### Steps to reproduce
1. Call `LocalModel.build_cpr_model` with base_image containing `/`
##### Note
* The default argument:`python:3.10` worked without any error ([link](https://github.com/googleapis/python-aiplatform/blob/7aaffe505aa8e7bff86af5a3674085b8ff822107/google/cloud/aiplatform/prediction/local_model.py#L153C27-L153C41))
* In addition, the other python versions: `python:3.11` or `python:3.9` worked without any error
* In addition to the below example, the same error occurred when using `us-docker.pkg.dev/vertex-ai/prediction/pytorch-gpu.2-0:latest`
#### Code example
Based on [this sample](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/community/prediction/custom_prediction_routines/SDK_Custom_Preprocess.ipynb), here is the code to reproduce the error:
```python
import os
from google.cloud.aiplatform.prediction import LocalModel
from src_dir_vertexai.predictor import CprPredictor
USER_SRC_DIR = "src_dir_vertexai"
local_model = LocalModel.build_cpr_model(
USER_SRC_DIR,
"us-docker.pkg.dev/shotarok-dev/test-repo/cpr-model:latest",
predictor=CprPredictor,
base_image="nvidia/cuda:11.1.1-devel-ubuntu20.04"
requirements_path=os.path.join(USER_SRC_DIR, "requirements.txt"),
)
```
#### Stack trace
```console
/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py:1010: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
self.stdin = io.open(p2cwrite, 'wb', bufsize)
/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py:1016: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
self.stdout = io.open(c2pread, 'rb', bufsize)
Traceback (most recent call last):
File "/Users/shotarokohama/ghq/github.com/GoogleCloudPlatform/vertex-ai-samples/main.py", line 8, in
local_model = LocalModel.build_cpr_model(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/shotarokohama/ghq/github.com/GoogleCloudPlatform/vertex-ai-samples/venv/lib/python3.11/site-packages/google/cloud/aiplatform/prediction/local_model.py", line 289, in build_cpr_model
_ = build.build_image(
^^^^^^^^^^^^^^^^^^
File "/Users/shotarokohama/ghq/github.com/GoogleCloudPlatform/vertex-ai-samples/venv/lib/python3.11/site-packages/google/cloud/aiplatform/docker_utils/build.py", line 548, in build_image
raise DockerError(error_msg, command, return_code)
google.cloud.aiplatform.docker_utils.errors.DockerError: ('\nDocker failed with error code 1.\nCommand: docker build -t us-docker.pkg.dev/shotarok-dev/test-repo/cpr-model:latest --rm -f- src_dir_vertexai\n', ['docker', 'build', '-t', 'us-docker.pkg.dev/shotarok-dev/test-repo/cpr-model:latest', '--rm', '-f-', 'src_dir_vertexai'], 1)
```
贡献指南
调研方向
从 google/cloud/aiplatform/prediction/local_model.py 中的 LocalModel.build_cpr_model 开始,然后按照堆栈跟踪中的显示,继续跟踪它对 docker_utils/docker_utils/build.py 的调用。使用包含 `/` 的 base_image 重现 Docker 构建,将其与正常工作的 `python:3.10` 情况进行比较,并验证 registry 风格的镜像和包含斜杠的镜像都能成功构建。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- docker, python
- 领域
- devtools, machine-learning
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100