googleapis / googleapis/python-aiplatform

Importing class `Model` from `google.cloud.aiplatform.models` is slow

Open
#1,994 6 comments 1 reaction 0 assignees View on GitHub
api: vertex-ai
Dominant language
Python
Stars
905
Forks
465
Avg merge
1d 13h
Merged PRs (30d)
44

Description

#### Environment details

- OS type and version:
- Python version: 3.8
- pip version: 20.1.1
- `google-cloud-aiplatform` version: `google-cloud-aiplatform>=1.7.1,<2.0.0`

#### Steps to reproduce

1. Create a Python file in an environment where `google-cloud-aiplatform` is installed
2. Type: `from google.cloud.aiplatform.models import Model`
3. Run it with `time python`

#### Code example

```python
from google.cloud.aiplatform.models import Model
```

#### Stack trace
```
real 0m0.836s
user 0m1.085s
sys 0m1.045s
```

Compare it with an import of an entire package such as `pandas` (`import pandas as pd`):
```
real 0m0.271s
user 0m0.541s
sys 0m0.930s
```

I originally opened this issue in [Apache Airflow](https://github.com/apache/airflow/discussions/29615) repository, and I was referred to here. The time of import makes parsing of Airflow DAGs that utilize Vertex AI operators significantly slower.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.