Skip to main content

Label Studio ML Backend

The Label Studio ML backend is an SDK that lets you wrap your machine learning code and turn it into a web server. The web server can be connected to a running Label Studio instance to automate labeling tasks.

How to run it​

This is helper container, you don't need to interact with it directly. All operations are handled by Label Studio.
It's important to run this with GPU, as it's used for inference of your model.

cgc compute create -n auto-yolo -c 2 -m 8 autolabel-yolo -g 1 -gt a5000 -d label_studio_url=<LABEL_STUDIO_URL> -d label_studio_api_key=<LABEL_STUDIO_API_KEY>

Parameters​

  • name - auto-yolo is just an example name, you can use any name you want. It is used to connect ML backend to Label Studio from project settings.
  • label_studio_url - URL to your Label Studio instance, you need running Label Studio instance to use this. Important: Don't use public URL to your Label Studio. Remember that you are working in close environment with private network. To set this up use http://<label-studio-name>:8080 (e.g. http://label-studio:8080)
  • label_studio_api_key - API key to your Label Studio instance, you can generate it in Label Studio web interface. Please refer here

Default port is 9090 - you are going to use ML Backend internaly so valid URL that must be provided into label studio project is
http://auto-yolo:9090

Load custom model​

To load a custom model into the ML backend, follow these steps:

  1. Create a volume - First, create a volume to store your model. If a suitable volume already exists, you can skip this step.
  2. Upload your model - Transfer or copy your model file into the created volume. Or mount this volume to ML Backend and Jupyter Notebook.
  3. Mount the volume - Mount the volume to your ML backend container to ensure the backend has access to the model. For instance:
cgc volume mount <model_volume_name> -t auto-yolo
tip

Usually, you will want to mount the same volume that you use to store your dataset and train models.
This way you don't have to create a new volume just for the model.

What is more, if you're volume is mounted to ML Backend and Jupyter Notebook you can train your model and then use it in Label Studio instantely without need to transfer it to other volume.

Once the volume is mounted, the ML backend will have access to the models stored within it. You can store multiple models in the same volume. To ensure the ML backend knows which model to use, you will need to configure your project environment accordingly:

  1. Set up the model in your project.

After completing these steps you should be able to see predictions on your dataset.

How to use it​

For further steps on how to use it go to Label Studio ML Backend