Skip to content

feat: Add Custom Training by Python Script#42

Merged
sasha-gitg merged 8 commits into
googleapis:devfrom
sasha-gitg:dev_custom_training_staging
Nov 9, 2020
Merged

feat: Add Custom Training by Python Script#42
sasha-gitg merged 8 commits into
googleapis:devfrom
sasha-gitg:dev_custom_training_staging

Conversation

@sasha-gitg
Copy link
Copy Markdown
Member

Adds CustomTrainingJob Class.

The current implementation splits the constructing of the CustomTrainingJob and running of the Job. Note that no Custom Training service resource is created when the object is constructed. It is created at the run call. Which can lead to issues if the correct args were not passed in during construction. This mainly is an issue for model serving args as we require the model serving environment definitions at construction time, which should make sense because it's tightly coupled to the script provided at construction time. An alternative is to move this to the run call.

An additional alternative is to add all constructor and run args to the constructor. And only have the model accessible through the get_model API:

job = CustomTrainingJob('test_script.py', ...)  # launch job here
my_model = job.get_model()

Instead of the current flow:

job = CustomTrainingJob('test_script.py', ...)
model = job.run(my_dataset, ...)

Fixes b/169779290 🦕

@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Nov 4, 2020
@sasha-gitg sasha-gitg changed the title feat: Add Custom Training by Python Script (#6) feat: Add Custom Training by Python Script Nov 4, 2020
@sasha-gitg sasha-gitg requested a review from ivanmkc November 4, 2020 19:37
from google.cloud.aiplatform import base
from google.cloud.aiplatform import datasets
from google.cloud.aiplatform import initializer
from google.cloud.aiplatform import models
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a general guideline for when to import modules (e.g. from google.cloud.aiplatform import models here) versus when to import classes (e.g. from google.cloud.aiplatform_v1beta1 import Model below)?

if there are simple rules of deciding this, please add to the contributing guide file for reference.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is no standard defined then we should go with the go/pystyle#imports.

I'll make changes in this PR and we should ensure future PRs follow that style.

I also have a preference to reduce levels of indirection of imports as well so we should be importing directly from the module that contains the implementation.

@vinnysenthil
@sirtorry
@ivanmkc

Comment thread google/cloud/aiplatform/training_jobs.py Outdated
Comment thread google/cloud/aiplatform/training_jobs.py
Comment thread google/cloud/aiplatform/training_jobs.py Outdated
Comment thread google/cloud/aiplatform/training_jobs.py Outdated
Comment thread google/cloud/aiplatform/training_jobs.py
Comment thread google/cloud/aiplatform/training_jobs.py
Comment thread google/cloud/aiplatform/training_jobs.py Outdated
Comment thread tests/unit/aiplatform/test_lro.py
@sasha-gitg sasha-gitg requested a review from dizcology November 5, 2020 17:42

_TEST_MODEL_NAME = "projects/my-project/locations/us-central1/models/12345"

_TEST_PIPELINE_RESOURCE_NAME = (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for later: all of these are getting a little heavy and difficult to manage. we should at least put all of these pieces in a separate file so they are shared across tests. further down the road we might need to modify the approach.

@sasha-gitg sasha-gitg merged commit 3054518 into googleapis:dev Nov 9, 2020
dizcology pushed a commit to dizcology/python-aiplatform that referenced this pull request Nov 30, 2020
* feat: Add Custom Training by Python Script

* chore: fix LRO tests and formatting

* feat: Address comments and change args to accept list of args to support positional args and flags.

* feat: rename is_failed to has_failed

* refactor: remove unused Dict type

* chore: lint
dizcology pushed a commit to dizcology/python-aiplatform that referenced this pull request Nov 30, 2020
* feat: Add Custom Training by Python Script

* chore: fix LRO tests and formatting

* feat: Address comments and change args to accept list of args to support positional args and flags.

* feat: rename is_failed to has_failed

* refactor: remove unused Dict type

* chore: lint
dizcology pushed a commit to dizcology/python-aiplatform that referenced this pull request Nov 30, 2020
* feat: Add Custom Training by Python Script

* chore: fix LRO tests and formatting

* feat: Address comments and change args to accept list of args to support positional args and flags.

* feat: rename is_failed to has_failed

* refactor: remove unused Dict type

* chore: lint
dizcology pushed a commit to dizcology/python-aiplatform that referenced this pull request Nov 30, 2020
* feat: Add Custom Training by Python Script

* chore: fix LRO tests and formatting

* feat: Address comments and change args to accept list of args to support positional args and flags.

* feat: rename is_failed to has_failed

* refactor: remove unused Dict type

* chore: lint
dizcology pushed a commit to dizcology/python-aiplatform that referenced this pull request Nov 30, 2020
* feat: Add Custom Training by Python Script

* chore: fix LRO tests and formatting

* feat: Address comments and change args to accept list of args to support positional args and flags.

* feat: rename is_failed to has_failed

* refactor: remove unused Dict type

* chore: lint
dizcology pushed a commit to dizcology/python-aiplatform that referenced this pull request Dec 22, 2020
* feat: Add Custom Training by Python Script

* chore: fix LRO tests and formatting

* feat: Address comments and change args to accept list of args to support positional args and flags.

* feat: rename is_failed to has_failed

* refactor: remove unused Dict type

* chore: lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants