Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Unable to locate a tflite file using ml.TFLiteGCSModelSource.from_tflite_model_file

Hello, I hope I'm posting on the right topic, forgive me id that's not the case.

I have created a cloud function with python 3.10 that should update a custom model in my firebase project, everything seems to be working as expected, except for when I need to update the tflite file to the newly generated trained model.

I create the tflite file and upload it to my bucket prior to trying to update the model on firebase, the error I get is "[Errno 2] No such file or directory: 'price_prediction_model.tflite'", which is weird because when I try to print all the files in my bucket, the tflite file I'm looking for indeed appears in the logs.

If someone could enlighten me, I would appreciate.

Here is the code : 

 

#update the model to firebase machine learning
def update_tflite_model(model_name, model_display_name, tflite_model):
     try:
          model = get_model_by_display_name(model_display_name)
          print(model.model_format)
          print('OK 1')
          source = ml.TFLiteGCSModelSource.from_tflite_model_file(f'{model_name}.tflite') # <= NO SUCH FILE OR DIRECTORY ??
          print('OK 2')
          model.model_format = ml.TFLiteFormat(model_source=tflite_model_source)
          updated_model = ml.update_model(model)
          ml.publish_model(updated_model.model_id)
          print("TensorFlow Lite model updated in Firebase Machine Learning successfully!")
     except Exception as e:
          print("Error updating TensorFlow Lite model in Firebase Machine Learning:", e)

 

 

0 0 89
0 REPLIES 0