Skip to content

Commit

Permalink
chore: new owl bot post processor docker image (#121)
Browse files Browse the repository at this point in the history
gcr.io/repo-automation-bots/owlbot-nodejs:latest@sha256:f93bb861d6f12574437bb9aee426b71eafd63b419669ff0ed029f4b7e7162e3f
  • Loading branch information
gcf-owl-bot[bot] authored May 10, 2021
1 parent feaac09 commit 631d2ea
Show file tree
Hide file tree
Showing 16 changed files with 70 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ function main(
// Imports the Google Cloud Pipeline Service Client library
const aiplatform = require('@google-cloud/aiplatform');

const {
definition,
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
const {definition} =
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
const ModelType = definition.AutoMlImageClassificationInputs.ModelType;

// Specifies the location of the api endpoint
Expand All @@ -57,14 +56,13 @@ function main(
const parent = `projects/${project}/locations/${location}`;

// Values should match the input expected by your model.
const trainingTaskInputsMessage = new definition.AutoMlImageClassificationInputs(
{
const trainingTaskInputsMessage =
new definition.AutoMlImageClassificationInputs({
multiLabel: true,
modelType: ModelType.CLOUD,
budgetMilliNodeHours: 8000,
disableEarlyStopping: false,
}
);
});

const trainingTaskInputs = trainingTaskInputsMessage.toValue();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ async function main(
// const location = 'YOUR_PROJECT_LOCATION';

const aiplatform = require('@google-cloud/aiplatform');
const {
definition,
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
const {definition} =
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
const ModelType = definition.AutoMlImageObjectDetectionInputs.ModelType;

// Imports the Google Cloud Pipeline Service Client library
Expand All @@ -56,13 +55,12 @@ async function main(
// Configure the parent resource
const parent = `projects/${project}/locations/${location}`;

const trainingTaskInputsObj = new definition.AutoMlImageObjectDetectionInputs(
{
const trainingTaskInputsObj =
new definition.AutoMlImageObjectDetectionInputs({
disableEarlyStopping: false,
modelType: ModelType.CLOUD_HIGH_ACCURACY_1,
budgetMilliNodeHours: 20000,
}
);
});

const trainingTaskInputs = trainingTaskInputsObj.toValue();
const modelToUpload = {displayName: modelDisplayName};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ async function main(
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
const aiplatform = require('@google-cloud/aiplatform');
const {
definition,
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
const {definition} =
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;

// Imports the Google Cloud Pipeline Service Client library
const {PipelineServiceClient} = aiplatform.v1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ async function main(
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
const aiplatform = require('@google-cloud/aiplatform');
const {
definition,
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
const {definition} =
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;

// Imports the Google Cloud Pipeline Service Client library
const {PipelineServiceClient} = aiplatform.v1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ async function main(
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
const aiplatform = require('@google-cloud/aiplatform');
const {
definition,
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
const {definition} =
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;

// Imports the Google Cloud Pipeline Service Client library
const {PipelineServiceClient} = aiplatform.v1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ async function main(
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
const aiplatform = require('@google-cloud/aiplatform');
const {
definition,
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
const {definition} =
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;

// Imports the Google Cloud Pipeline Service Client library
const {PipelineServiceClient} = aiplatform.v1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ async function main(
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
const aiplatform = require('@google-cloud/aiplatform');
const {
definition,
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
const {definition} =
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;

// Imports the Google Cloud Pipeline Service Client library
const {PipelineServiceClient} = aiplatform.v1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ async function main(
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
const aiplatform = require('@google-cloud/aiplatform');
const {
definition,
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
const {definition} =
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;

// Imports the Google Cloud Pipeline Service Client library
const {PipelineServiceClient} = aiplatform.v1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ async function main(
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
const aiplatform = require('@google-cloud/aiplatform');
const {
definition,
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
const {definition} =
aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
const ModelType = definition.AutoMlVideoObjectTrackingInputs.ModelType;

// Imports the Google Cloud Pipeline Service Client library
Expand All @@ -55,11 +54,10 @@ async function main(
// Configure the parent resource
const parent = `projects/${project}/locations/${location}`;

const trainingTaskInputsObj = new definition.AutoMlVideoObjectTrackingInputs(
{
const trainingTaskInputsObj =
new definition.AutoMlVideoObjectTrackingInputs({
modelType: ModelType.CLOUD,
}
);
});
const trainingTaskInputs = trainingTaskInputsObj.toValue();

const modelToUpload = {displayName: modelDisplayName};
Expand Down
12 changes: 4 additions & 8 deletions ai-platform/snippets/predict-image-classification.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@ function main(filename, endpointId, project, location = 'us-central1') {
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
const aiplatform = require('@google-cloud/aiplatform');
const {
instance,
params,
prediction,
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
const {instance, params, prediction} =
aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;

// Imports the Google Cloud Prediction Service Client library
const {PredictionServiceClient} = aiplatform.v1;
Expand Down Expand Up @@ -77,9 +74,8 @@ function main(filename, endpointId, project, location = 'us-central1') {
const predictions = response.predictions;
console.log('\tPredictions :');
for (const predictionValue of predictions) {
const predictionResultObj = prediction.ClassificationPredictionResult.fromValue(
predictionValue
);
const predictionResultObj =
prediction.ClassificationPredictionResult.fromValue(predictionValue);
for (const [i, label] of predictionResultObj.displayNames.entries()) {
console.log(`\tDisplay name: ${label}`);
console.log(`\tConfidences: ${predictionResultObj.confidences[i]}`);
Expand Down
14 changes: 6 additions & 8 deletions ai-platform/snippets/predict-image-object-detection.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@ async function main(filename, endpointId, project, location = 'us-central1') {
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
const aiplatform = require('@google-cloud/aiplatform');
const {
instance,
params,
prediction,
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
const {instance, params, prediction} =
aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;

// Imports the Google Cloud Prediction Service Client library
const {PredictionServiceClient} = aiplatform.v1;
Expand Down Expand Up @@ -77,9 +74,10 @@ async function main(filename, endpointId, project, location = 'us-central1') {
const predictions = response.predictions;
console.log('Predictions :');
for (const predictionResultVal of predictions) {
const predictionResultObj = prediction.ImageObjectDetectionPredictionResult.fromValue(
predictionResultVal
);
const predictionResultObj =
prediction.ImageObjectDetectionPredictionResult.fromValue(
predictionResultVal
);
for (const [i, label] of predictionResultObj.displayNames.entries()) {
console.log(`\tDisplay name: ${label}`);
console.log(`\tConfidences: ${predictionResultObj.confidences[i]}`);
Expand Down
12 changes: 6 additions & 6 deletions ai-platform/snippets/predict-tabular-classification.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ async function main(endpointId, project, location = 'us-central1') {
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
const aiplatform = require('@google-cloud/aiplatform');
const {
prediction,
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
const {prediction} =
aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;

// Imports the Google Cloud Prediction service client
const {PredictionServiceClient} = aiplatform.v1;
Expand Down Expand Up @@ -72,9 +71,10 @@ async function main(endpointId, project, location = 'us-central1') {
const predictions = response.predictions;
console.log('Predictions :');
for (const predictionResultVal of predictions) {
const predictionResultObj = prediction.TabularClassificationPredictionResult.fromValue(
predictionResultVal
);
const predictionResultObj =
prediction.TabularClassificationPredictionResult.fromValue(
predictionResultVal
);
for (const [i, class_] of predictionResultObj.classes.entries()) {
console.log(`\tClass: ${class_}`);
console.log(`\tScore: ${predictionResultObj.scores[i]}\n\n`);
Expand Down
12 changes: 6 additions & 6 deletions ai-platform/snippets/predict-tabular-regression.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ async function main(endpointId, project, location = 'us-central1') {
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
const aiplatform = require('@google-cloud/aiplatform');
const {
prediction,
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
const {prediction} =
aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;

// Imports the Google Cloud Prediction service client
const {PredictionServiceClient} = aiplatform.v1;
Expand Down Expand Up @@ -92,9 +91,10 @@ async function main(endpointId, project, location = 'us-central1') {
const predictions = response.predictions;
console.log('\tPredictions :');
for (const predictionResultVal of predictions) {
const predictionResultObj = prediction.TabularRegressionPredictionResult.fromValue(
predictionResultVal
);
const predictionResultObj =
prediction.TabularRegressionPredictionResult.fromValue(
predictionResultVal
);
console.log(`\tUpper bound: ${predictionResultObj.upper_bound}`);
console.log(`\tLower bound: ${predictionResultObj.lower_bound}`);
console.log(`\tLower bound: ${predictionResultObj.value}`);
Expand Down
20 changes: 9 additions & 11 deletions ai-platform/snippets/predict-text-classification.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ async function main(text, endpointId, project, location) {
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
const aiplatform = require('@google-cloud/aiplatform');
const {
instance,
prediction,
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
const {instance, prediction} =
aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;

// Imports the Google Cloud Model Service Client library
const {PredictionServiceClient} = aiplatform.v1;
Expand All @@ -48,11 +46,10 @@ async function main(text, endpointId, project, location) {
// Configure the resources
const endpoint = `projects/${project}/locations/${location}/endpoints/${endpointId}`;

const predictionInstance = new instance.TextClassificationPredictionInstance(
{
const predictionInstance =
new instance.TextClassificationPredictionInstance({
content: text,
}
);
});
const instanceValue = predictionInstance.toValue();

const instances = [instanceValue];
Expand All @@ -68,9 +65,10 @@ async function main(text, endpointId, project, location) {
console.log('Prediction results:');

for (const predictionResultValue of response.predictions) {
const predictionResult = prediction.ClassificationPredictionResult.fromValue(
predictionResultValue
);
const predictionResult =
prediction.ClassificationPredictionResult.fromValue(
predictionResultValue
);

for (const [i, label] of predictionResult.displayNames.entries()) {
console.log(`\tDisplay name: ${label}`);
Expand Down
13 changes: 6 additions & 7 deletions ai-platform/snippets/predict-text-entity-extraction.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ async function main(text, endpointId, project, location = 'us-central1') {
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
const aiplatform = require('@google-cloud/aiplatform');
const {
instance,
prediction,
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
const {instance, prediction} =
aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;

// Imports the Google Cloud Model Service Client library
const {PredictionServiceClient} = aiplatform.v1;
Expand Down Expand Up @@ -67,9 +65,10 @@ async function main(text, endpointId, project, location = 'us-central1') {

console.log('\nPredictions :');
for (const predictionResultValue of response.predictions) {
const predictionResult = prediction.TextExtractionPredictionResult.fromValue(
predictionResultValue
);
const predictionResult =
prediction.TextExtractionPredictionResult.fromValue(
predictionResultValue
);

for (const [i, label] of predictionResult.displayNames.entries()) {
const textStartOffset = parseInt(
Expand Down
13 changes: 6 additions & 7 deletions ai-platform/snippets/predict-text-sentiment-analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ async function main(text, endpointId, project, location = 'us-central1') {
// const project = 'YOUR_PROJECT_ID';
// const location = 'YOUR_PROJECT_LOCATION';
const aiplatform = require('@google-cloud/aiplatform');
const {
instance,
prediction,
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
const {instance, prediction} =
aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;

// Imports the Google Cloud Model Service Client library
const {PredictionServiceClient} = aiplatform.v1;
Expand Down Expand Up @@ -67,9 +65,10 @@ async function main(text, endpointId, project, location = 'us-central1') {

console.log('\nPredictions :');
for (const predictionResultValue of response.predictions) {
const predictionResult = prediction.TextSentimentPredictionResult.fromValue(
predictionResultValue
);
const predictionResult =
prediction.TextSentimentPredictionResult.fromValue(
predictionResultValue
);
console.log(`\tSentiment measure: ${predictionResult.sentiment}`);
}
}
Expand Down

0 comments on commit 631d2ea

Please sign in to comment.