Skip to main content

SDK setup

Install the Embedl Hub SDK and record your first run.

The Embedl Hub SDK records runs, parameters, metrics, tags, and artifacts from your Python code or shell commands. Your own tools perform training, compilation, and evaluation; the SDK records their settings and results.

Before you start#

You need Python 3.10 or newer and an Embedl Hub account.

Install the SDK#

Create a virtual environment:

python3 -m venv .venv
. .venv/bin/activate

Install the package:

pip install embedl-hub

The package installs the equivalent commands embedl-hub and ehub. For installation without internet access, see Offline installation.

Create a workspace#

In the directory for your work, run:

embedl-hub init

This makes the directory a workspace, much as git init makes a repository. The workspace remembers which Hub and project you work with, so commands run anywhere inside it record to the same place. See SDK configuration for what it stores and what to commit.

Configure an API key#

These commands connect to https://hub.embedl.com.

For a self-hosted Hub, use your installation’s URL and an API key created there. See Using a self-hosted Hub.

Create a key on the API keys page, then store it:

embedl-hub auth --api-key -

Paste the key at the prompt, which keeps it out of your shell history. The key is stored for the Hub in use, https://hub.embedl.com unless you have chosen another.

Warning

The key is saved as plain text on your machine. For where it is stored, and for secret stores and CI, see SDK configuration.

Select a project#

embedl-hub use project quantized-classifier
embedl-hub status

Use your own project name. New runs started from this workspace are created in that project. The project itself is created with its first run if it does not exist. status shows where your commands will record: the Hub, project, and API key in use.

Record your first run#

Save this as first_run.py and run it with python first_run.py:

from pathlib import Path
from embedl_hub.tracking import Client

client = Client()
client.use_context_project()

with client.start_run("eval", name="SDK example"):
    client.log_param("model_id", "classifier_int8_v1")
    client.log_tag("sample_data", "true")
    client.log_metric("accuracy", 0.92)
    report = Path("example-report.txt")
    report.write_text("Illustrative accuracy: 0.92\n")
    client.log_artifact(report)

use_context_project() records to the project you selected for the workspace. To name a project in the script instead, see SDK configuration.

The values are illustrative. Open your project in the web app and select Runs to find SDK example. Inspect the parameter, metric, tag, and file.

Next steps#