Skip to main content

SDK setup

Install the Embedl Hub SDK and connect it to your project.

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.

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 replace YOUR_API_KEY below:

embedl-hub auth --base-url https://hub.embedl.com \
  --api-key YOUR_API_KEY
Warning

The CLI saves your API key as plain text in your user configuration directory. The location depends on your operating system. For secret stores and CI, use the environment variables instead.

Select a project#

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

Use your own project name. This saves the CLI project for this directory and those below it, using the nearest .ehub/use.cfg. It does not contact the Hub; the CLI creates the project when the first run starts if it does not exist.

Python code selects its project separately with client.set_project, which creates it immediately if needed. The script below checks the connection and records your first run. For shared projects with the same name, see Configuration.

Record your first run#

Replace quantized-classifier with your project name, 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.set_project("quantized-classifier")

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)

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#