googleapis / googleapis/python-aiplatform

`LocalModel.build_cpr_model` fails when using base_image containing `/`

Ouverte
#2,789 8 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
api: vertex-ai
Langage dominant
Python
Étoiles
905
Forks
465
Merge moyen
1 j 13 h
PR mergées (30 j)
44

Description

#### 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)
```

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.