This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import vertexai | |
from vertexai.language_models import TextGenerationModel | |
from google.cloud import translate_v2 as translate | |
vertexai.init(project="sascha-playground-doit", location="us-central1") | |
parameters = { | |
"candidate_count": 1, | |
"max_output_tokens": 1024, | |
"temperature": 0.9, | |
"top_p": 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
response = index_endpoint.match( | |
deployed_index_id="similar_text_deployed", | |
queries=[embedding[0]], | |
num_neighbors=5 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"predictions": [ | |
{ | |
"confidence": 0.9409326314926147, | |
"sentiment": "POSITIVE" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
training_data_artifact = aiplatform.Artifact.create( | |
schema_title='system.Dataset', | |
uri='gs://doit-vertex-demo/higgs/training.csv', | |
display_name='data') | |
with aiplatform.start_execution( | |
schema_title="system.ContainerExecution", | |
display_name='training' | |
) as execution: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
experiment_run = aiplatform.ExperimentRun( | |
run_name='run-1668456760', | |
experiment='experiment-demo', | |
) | |
print(experiment_run.get_artifacts()) | |
print(experiment_run.get_metrics()) | |
print(experiment_run.get_params()) | |
print(experiment_run.get_time_series_data_frame()) | |
print(experiment_run.get_classification_metrics()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
experiment_df = aiplatform.get_experiment_df() | |
experiment_df = experiment_df[experiment_df.experiment_name == 'experiment-demo'] | |
experiment_df |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aiplatform.init( | |
project='sascha-playground-doit', | |
location='us-central1', | |
experiment='experiment-sample', | |
experiment_tensorboard='projects/sascha-playground-doit/locations/us-central1/tensorboards/6382621018774568960' | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
experiment_tensorboard = vertex_ai.Tensorboard.create() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
training_data_artifact = aiplatform.Artifact.create( | |
schema_title='system.Dataset', | |
uri='gs://doit-vertex-demo/higgs/training.csv', | |
display_name='training data') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aiplatform.log_time_series_metrics({"mse": 2500.00, "rmse": 50.00}) | |
aiplatform.log_time_series_metrics({"mse": 2600.00, "rmse": 60.00}) | |
aiplatform.log_time_series_metrics({"mse": 2700.00, "rmse": 70.00}) |
NewerOlder