Now we want to manage the entire lifecycle of our ML model. In this step, you'll need to launch a tracking server. This way we will also have access to the model registry.
Your task is to:
launch the tracking server on your local machine,
select a SQLite db for the backend store and a folder called artifacts for the artifacts store.
You should keep the tracking server running to work on the next two exercises that use the server.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
In this task, we'll launch an MLflow tracking server on our local machine. We'll use a SQLite database as the backend store and a local folder named artifacts as the artifacts store.
Prerequisites
MLflow installed on your system (pip install mlflow)
A terminal or command prompt
Launching the Tracking Server
Here's the command to launch the MLflow tracking server with the specified configurations:
--backend-store-uri sqlite:///mlflow.db: Specifies SQLite as the backend store, storing data in a file named mlflow.db in the current directory. If the file doesn't exist, MLflow will create it.
--default-artifact-root ./artifacts: Sets the default location for storing artifacts (e.g., model files, plots) to a folder named artifacts in the current directory. If the folder doesn't exist, MLflow will create it.
--host 0.0.0.0: Makes the tracking server accessible from any IP address (not just localhost). This is useful if you want to access the server from another machine or a Docker container.
--port 5000: Sets the port number to 5000. You can choose any available port, but 5000 is a common choice for MLflow.
Running the Command
Open a terminal or command prompt.
Navigate to the directory where you want to store the mlflow.db file and the artifacts folder.
Run the mlflow server command above.
You should see output similar to this:
code
[2023-12-01 10:00:00 +0000] [12345] [INFO] Starting gunicorn 20.1.0
[2023-12-01 10:00:00 +0000] [12345] [INFO] Listening at: http://0.0.0.0:5000 (12345)
[2023-12-01 10:00:00 +0000] [12345] [INFO] Using worker: sync
[2023-12-01 10:00:00 +0000] [12346] [INFO] Booting worker with pid: 12346
2023/12/01 10:00:00 INFO mlflow.server: Listening on http://0.0.0.0:5000
2023/12/01 10:00:00 INFO mlflow.server: Backend store: sqlite:///mlflow.db
2023/12/01 10:00:00 INFO mlflow.server: Artifact root: file:///path/to/your/current/directory/artifacts
Verification
Check that the mlflow.db file and artifacts folder have been created in your current directory.
Open a web browser and navigate to http://localhost:5000. You should see the MLflow UI.
Keep the Server Running
Leave the terminal or command prompt open with the tracking server running. You'll need it for the next exercises.
If you accidentally close the terminal or need to restart the server later, simply navigate back to the same directory and run the mlflow server command again.
You're now ready to move on to the next exercises, where you'll interact with this tracking server to log experiments, register models, and more!
Troubleshooting Tips
If you encounter port conflicts, choose a different port (e.g., --port 5001).
Ensure you have write permissions in the current directory for MLflow to create mlflow.db and artifacts.
If the server crashes, check the error messages for hints (e.g., missing dependencies, invalid paths).