Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Get the Model ID when i know the name of the model

$
0
0

Im currently trying to run a vertex model on a big query table using python.I am testing my code which is going to be a custom vertex ai batch exec operator for Airflow.

I can see many functions available with aiplatform lib on google documentation, but i would like to use the model name as a parameter.

For example, in the Model Registry, i have the model named My_Model, which has id 12354795461.Instead of executing batch directly with the model id, i would like to use the name and get this model id, with a code looking like that :

aiplatform.init(project=self.project_id, location=self.location)my_model = aiplatform.Model()model_id = my_model.get_model_id(name='My_Model')model_path = 'projects/'+project_id+'/locations/'+location+'/models/'+model_idmodel = aiplatform.Model(model_path)

I am using function model.batch_predict with a bigquery table as input.

By the way, i can't find a way to directly ask for the project id as well. I need to give the folder id (parent id), then list all inside, then filter on project_name.

Is there any working function that returns the id of the project/model by using its name as a parameter ?

Second question, is there a way to run a batch prediction on a big query Table and simply eliminate the use of a column in batch prediction ? so we can keep the id of a line without impacting the predictions ?

Thanks very much for your answer,RegardsNathan

I tried to add the column id on a BQ table, but the model returned errors because of the id column, when it does not when the id column is not there.

Also i can not find any function on google documentation giving a model/project id directly using the name of the project/model.


Viewing all articles
Browse latest Browse all 12111

Trending Articles