GeezerVison is showing github.com — docs: Added comment for evaluation_id to python examples (#860) · ccubc/python-aiplatform@004bf5f
File treeExpand file treeCollapse file tree Open diff view settings samples/snippets/model_service
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: samples/snippets/model_service/get_model_evaluation_image_classification_sample.py +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,6 +23,19 @@ def get_model_evaluation_image_classification_sample( | 23 | 23 | location: str = "us-central1", | 24 | 24 | api_endpoint: str = "us-central1-aiplatform.googleapis.com", | 25 | 25 | ): | | 26 | + """ | | 27 | + To obtain evaluation_id run the following commands where LOCATION | | 28 | + is the region where the model is stored, PROJECT is the project ID, | | 29 | + and MODEL_ID is the ID of your model. | | 30 | +
| | 31 | + model_client = aiplatform.gapic.ModelServiceClient( | | 32 | + client_options={ | | 33 | + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' | | 34 | + } | | 35 | + ) | | 36 | + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') | | 37 | + print("evaluations:", evaluations) | | 38 | + """ | 26 | 39 | # The AI Platform services require regional API endpoints. | 27 | 40 | client_options = {"api_endpoint": api_endpoint} | 28 | 41 | # Initialize client that will be used to create and send requests. | |
Collapse file Copy file name to clipboardExpand all lines: samples/snippets/model_service/get_model_evaluation_image_object_detection_sample.py +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,6 +23,19 @@ def get_model_evaluation_image_object_detection_sample( | 23 | 23 | location: str = "us-central1", | 24 | 24 | api_endpoint: str = "us-central1-aiplatform.googleapis.com", | 25 | 25 | ): | | 26 | + """ | | 27 | + To obtain evaluation_id run the following commands where LOCATION | | 28 | + is the region where the model is stored, PROJECT is the project ID, | | 29 | + and MODEL_ID is the ID of your model. | | 30 | +
| | 31 | + model_client = aiplatform.gapic.ModelServiceClient( | | 32 | + client_options={ | | 33 | + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' | | 34 | + } | | 35 | + ) | | 36 | + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') | | 37 | + print("evaluations:", evaluations) | | 38 | + """ | 26 | 39 | # The AI Platform services require regional API endpoints. | 27 | 40 | client_options = {"api_endpoint": api_endpoint} | 28 | 41 | # Initialize client that will be used to create and send requests. | |
Collapse file Copy file name to clipboardExpand all lines: samples/snippets/model_service/get_model_evaluation_slice_sample.py +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -24,6 +24,19 @@ def get_model_evaluation_slice_sample( | 24 | 24 | location: str = "us-central1", | 25 | 25 | api_endpoint: str = "us-central1-aiplatform.googleapis.com", | 26 | 26 | ): | | 27 | + """ | | 28 | + To obtain evaluation_id run the following commands where LOCATION | | 29 | + is the region where the model is stored, PROJECT is the project ID, | | 30 | + and MODEL_ID is the ID of your model. | | 31 | +
| | 32 | + model_client = aiplatform.gapic.ModelServiceClient( | | 33 | + client_options={ | | 34 | + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' | | 35 | + } | | 36 | + ) | | 37 | + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') | | 38 | + print("evaluations:", evaluations) | | 39 | + """ | 27 | 40 | # The AI Platform services require regional API endpoints. | 28 | 41 | client_options = {"api_endpoint": api_endpoint} | 29 | 42 | # Initialize client that will be used to create and send requests. | |
Collapse file Copy file name to clipboardExpand all lines: samples/snippets/model_service/get_model_evaluation_tabular_classification_sample.py +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,6 +23,19 @@ def get_model_evaluation_tabular_classification_sample( | 23 | 23 | location: str = "us-central1", | 24 | 24 | api_endpoint: str = "us-central1-aiplatform.googleapis.com", | 25 | 25 | ): | | 26 | + """ | | 27 | + To obtain evaluation_id run the following commands where LOCATION | | 28 | + is the region where the model is stored, PROJECT is the project ID, | | 29 | + and MODEL_ID is the ID of your model. | | 30 | +
| | 31 | + model_client = aiplatform.gapic.ModelServiceClient( | | 32 | + client_options={ | | 33 | + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' | | 34 | + } | | 35 | + ) | | 36 | + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') | | 37 | + print("evaluations:", evaluations) | | 38 | + """ | 26 | 39 | # The AI Platform services require regional API endpoints. | 27 | 40 | client_options = {"api_endpoint": api_endpoint} | 28 | 41 | # Initialize client that will be used to create and send requests. | |
Collapse file Copy file name to clipboardExpand all lines: samples/snippets/model_service/get_model_evaluation_tabular_regression_sample.py +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,6 +23,19 @@ def get_model_evaluation_tabular_regression_sample( | 23 | 23 | location: str = "us-central1", | 24 | 24 | api_endpoint: str = "us-central1-aiplatform.googleapis.com", | 25 | 25 | ): | | 26 | + """ | | 27 | + To obtain evaluation_id run the following commands where LOCATION | | 28 | + is the region where the model is stored, PROJECT is the project ID, | | 29 | + and MODEL_ID is the ID of your model. | | 30 | +
| | 31 | + model_client = aiplatform.gapic.ModelServiceClient( | | 32 | + client_options={ | | 33 | + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' | | 34 | + } | | 35 | + ) | | 36 | + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') | | 37 | + print("evaluations:", evaluations) | | 38 | + """ | 26 | 39 | # The AI Platform services require regional API endpoints. | 27 | 40 | client_options = {"api_endpoint": api_endpoint} | 28 | 41 | # Initialize client that will be used to create and send requests. | |
Collapse file Copy file name to clipboardExpand all lines: samples/snippets/model_service/get_model_evaluation_tabular_regression_sample_test.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 17 | 17 | import get_model_evaluation_sample | 18 | 18 |
| 19 | 19 | PROJECT_ID = os.getenv("BUILD_SPECIFIC_GCLOUD_PROJECT") | 20 | | -MODEL_ID = "8842430840248991744" # bq all | 21 | | -EVALUATION_ID = "4944816689650806017" # bq all evaluation | | 20 | +MODEL_ID = "626638064948609024" # bq all | | 21 | +EVALUATION_ID = "3002272024979570688" # bq all evaluation | 22 | 22 |
| 23 | 23 |
| 24 | 24 | def test_ucaip_generated_get_model_evaluation_sample(capsys): | |
Collapse file Copy file name to clipboardExpand all lines: samples/snippets/model_service/get_model_evaluation_text_classification_sample.py +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,6 +23,19 @@ def get_model_evaluation_text_classification_sample( | 23 | 23 | location: str = "us-central1", | 24 | 24 | api_endpoint: str = "us-central1-aiplatform.googleapis.com", | 25 | 25 | ): | | 26 | + """ | | 27 | + To obtain evaluation_id run the following commands where LOCATION | | 28 | + is the region where the model is stored, PROJECT is the project ID, | | 29 | + and MODEL_ID is the ID of your model. | | 30 | +
| | 31 | + model_client = aiplatform.gapic.ModelServiceClient( | | 32 | + client_options={ | | 33 | + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' | | 34 | + } | | 35 | + ) | | 36 | + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') | | 37 | + print("evaluations:", evaluations) | | 38 | + """ | 26 | 39 | # The AI Platform services require regional API endpoints. | 27 | 40 | client_options = {"api_endpoint": api_endpoint} | 28 | 41 | # Initialize client that will be used to create and send requests. | |
Collapse file Copy file name to clipboardExpand all lines: samples/snippets/model_service/get_model_evaluation_text_entity_extraction_sample.py +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,6 +23,19 @@ def get_model_evaluation_text_entity_extraction_sample( | 23 | 23 | location: str = "us-central1", | 24 | 24 | api_endpoint: str = "us-central1-aiplatform.googleapis.com", | 25 | 25 | ): | | 26 | + """ | | 27 | + To obtain evaluation_id run the following commands where LOCATION | | 28 | + is the region where the model is stored, PROJECT is the project ID, | | 29 | + and MODEL_ID is the ID of your model. | | 30 | +
| | 31 | + model_client = aiplatform.gapic.ModelServiceClient( | | 32 | + client_options={ | | 33 | + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' | | 34 | + } | | 35 | + ) | | 36 | + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') | | 37 | + print("evaluations:", evaluations) | | 38 | + """ | 26 | 39 | # The AI Platform services require regional API endpoints. | 27 | 40 | client_options = {"api_endpoint": api_endpoint} | 28 | 41 | # Initialize client that will be used to create and send requests. | |
Collapse file Copy file name to clipboardExpand all lines: samples/snippets/model_service/get_model_evaluation_text_sentiment_analysis_sample.py +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,6 +23,19 @@ def get_model_evaluation_text_sentiment_analysis_sample( | 23 | 23 | location: str = "us-central1", | 24 | 24 | api_endpoint: str = "us-central1-aiplatform.googleapis.com", | 25 | 25 | ): | | 26 | + """ | | 27 | + To obtain evaluation_id run the following commands where LOCATION | | 28 | + is the region where the model is stored, PROJECT is the project ID, | | 29 | + and MODEL_ID is the ID of your model. | | 30 | +
| | 31 | + model_client = aiplatform.gapic.ModelServiceClient( | | 32 | + client_options={ | | 33 | + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' | | 34 | + } | | 35 | + ) | | 36 | + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') | | 37 | + print("evaluations:", evaluations) | | 38 | + """ | 26 | 39 | # The AI Platform services require regional API endpoints. | 27 | 40 | client_options = {"api_endpoint": api_endpoint} | 28 | 41 | # Initialize client that will be used to create and send requests. | |
Collapse file Copy file name to clipboardExpand all lines: samples/snippets/model_service/get_model_evaluation_video_action_recognition_sample.py +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,6 +23,19 @@ def get_model_evaluation_video_action_recognition_sample( | 23 | 23 | location: str = "us-central1", | 24 | 24 | api_endpoint: str = "us-central1-aiplatform.googleapis.com", | 25 | 25 | ): | | 26 | + """ | | 27 | + To obtain evaluation_id run the following commands where LOCATION | | 28 | + is the region where the model is stored, PROJECT is the project ID, | | 29 | + and MODEL_ID is the ID of your model. | | 30 | +
| | 31 | + model_client = aiplatform.gapic.ModelServiceClient( | | 32 | + client_options={ | | 33 | + 'api_endpoint':'LOCATION-aiplatform.googleapis.com' | | 34 | + } | | 35 | + ) | | 36 | + evaluations = model_client.list_model_evaluations(parent='projects/PROJECT/locations/LOCATION/models/MODEL_ID') | | 37 | + print("evaluations:", evaluations) | | 38 | + """ | 26 | 39 | # The AI Platform services require regional API endpoints. | 27 | 40 | client_options = {"api_endpoint": api_endpoint} | 28 | 41 | # Initialize client that will be used to create and send requests. | |
|