If you use Firebase Machine Learning to host custom models , you must migrate to another solution before the Firebase ML hosting service is shut down on June 15, 2027.
One alternative you might use is to host your models using Cloud Storage for Firebase instead. Follow this guide to migrate your models from Firebase ML to Cloud Storage.
Download your TensorFlow Lite models
If you don't already have your models stored locally, download them from your Firebase project. You have two options for doing so:
Download them one at a time from the Firebase console
- Open the Machine Learning page section in the Firebase console.
- For each model you want to migrate, click its three-dot overflow menu, then click Download model.
Download all of your hosted models in bulk
- Open the Machine Learning page in the Firebase console.
- Click the Get command for bulk downloadbutton to get a
curlcommand that downloads all of the models in the project. These URLs will expire in 7 days. - Run the command in your local terminal or in Cloud Shell
. If using Cloud Shell, note its 5GB disk storage limit
.
The command will download your models to a local folder named
hosted_models.
Host your models using Cloud Storage
Once you have your models locally, you need to upload them to a Cloud Storage bucket.
Choose the upload method that matches your needs:
Upload your models one at a time
- Create a Storage bucket: in the Firebase console, navigate to Databases & Storage > Storage and follow the onboarding steps to create a bucket if you haven't already. Note that this requires a billing account; see Firebase pricing for details.
- Still in the Storagesection, upload your
.tflitemodel files to the desired path.
Upload your models in bulk
- Create a Storage bucket: in the Firebase console, navigate to Databases & Storage > Storage and follow the onboarding steps to create a bucket if you haven't already. Note that this requires a billing account; see Firebase pricing for details.
-
Use the following
gcloudcommand to upload all models from your localhosted_modelsfolder:gcloud storage rsync --recursive ./hosted_models gs://<your-storage-bucket>/models/
Configure security and app integration
-
Ensure your Storage security rules allow your app to read the model files. For example, you can restrict access to authenticated users.
-
Add Storage to your app: follow the setup guides for Android , Apple , or Flutter .
-
Update your application code to download the
.tflitefiles from your new Storage bucket.Android
modelRef = storage . getReferenceFromUrl ( "gs://YOUR_BUCKET/path/to/model.tflite" ) val localFile = File . createTempFile ( "models" , "tflite" ) modelRef . getFile ( localFile ). addOnSuccessListener { // Local temp file has been created }. addOnFailureListener { // Handle any errors }Apple
let gsReference = storage . reference ( forURL : "gs://YOUR_BUCKET/path/to/model.tflite" ) // Create local filesystem URL let localURL = URL ( string : "path/to/model.tflite" ) ! // Download to the local filesystem let downloadTask = gsReference . write ( toFile : localURL ) { url , error in if let error = error { // Uh-oh, an error occurred! } else { // Local file URL for "model.tflite" is returned } }Flutter
final modelRef = FirebaseStorage . instance . refFromURL ( "gs://YOUR_BUCKET/path/to/model.tflite" ); final appDocDir = await getApplicationDocumentsDirectory (); final filePath = " ${ appDocDir . absolute } /models/model.tflite" ; final file = File ( filePath ); final downloadTask = modelRef . writeToFile ( file ); downloadTask . snapshotEvents . listen (( taskSnapshot ) { switch ( taskSnapshot . state ) { case TaskState . running: // TODO: Handle this case. break ; case TaskState . paused: // TODO: Handle this case. break ; case TaskState . success: // TODO: Handle this case. break ; case TaskState . canceled: // TODO: Handle this case. break ; case TaskState . error: // TODO: Handle this case. break ; } });Once the model is downloaded, you can use your existing Tensorflow Lite library to load the model and use it.
-
(Optional) Consider using Firebase Remote Config to dynamically update model paths in your app without requiring a new release.
Optional: Migrate to the LiteRT CompiledModel API
If your app still uses the legacy TensorFlow Lite Interpreter
API, consider
migrating to the LiteRT CompiledModel
API
,
which offers improved hardware acceleration support and other improvements over
the legacy API.

