Skip to main content

Adding files to a deployment

You can add files to a deployment that's already running using git or the Modelbit Python API. This is useful for adding new versions of running models that have been trained outside of Modelbit.

Adding files using git

To add files to a deployment using git, clone your repository using modelbit clone, check in the new files, and run git push.

Adding files using Python

To add files to a deployment using Python, make sure you are logged in to Modelbit from your Python environment, and then use Modelbit's add_files function.

Log into Modelbit one of three ways:

  • From a Jupyter Notebook or IPython repl, run modelbit.login()
  • Run your Python script from inside a directory that has been cloned from Modelbit using modelbit clone
  • From a CI/CD pipeline, set a Modelbit API key

Then run the add_files function:

mb.add_files("deployment_name", { "path/to/local/file.pkl": "remote_filename.pkl" })

To add multiple files just add them to the previous dictionary:

mb.add_files("deployment_name", {
"path/to/local/file1.pkl": "remote_filename1.pkl",
"path/to/local/file2.pkl": "remote_filename2.pkl"
})

If the filepaths are identical between the local and remote files you can use a list instead of a dictionary:

mb.add_files("deployment_name", [
"path/to/local/file1.pkl",
"path/to/local/file2.pkl"
])

After successfully adding the file to the deployment, this function call will redeploy the deployment.